ZHANGYUXUAN-zR commited on
Commit
1bf5bf4
·
verified ·
1 Parent(s): e16cdbb

Add files using upload-large-folder tool

Browse files
parse/train/4-gBZAkF9ze/4-gBZAkF9ze.md ADDED
@@ -0,0 +1,442 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Attention as Inference via Fenchel Duality
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ Attention has been widely adopted in many state-of-the-art deep learning models. While the significant performance improvements it brings have attracted great interest, attention is still poorly understood theoretically. This paper presents a new perspective to understand attention by showing that it can be seen as a solver of a family of estimation problems. In particular, we describe a convex optimization problem that arises in a family of estimation tasks commonly appearing in the design of deep learning models. Rather than directly solving the convex optimization problem, we solve its Fenchel dual and derive a closed-form approximation of the optimal solution. Remarkably, the solution gives a generalized attention structure, and its special case is equivalent to the popular dot-product attention adopted in transformer networks. We show that T5 transformer has implicitly adopted the general form of the solution by demonstrating that this expression unifies the word mask and the positional encoding functions. Finally, we discuss how the proposed attention structures can be integrated in practical models.
11
+
12
+ # 15 1 Introduction
13
+
14
+ 16 Attention-based deep neural networks are now integrated into cutting-edge language models that
15
+ 17 have revolutionized a broad range of tasks: machine translation [1, 15], sentiment classification [27],
16
+ 18 image captioning [29] and unsupervised representation learning [5], etc. Especially, attention plays a
17
+ 19 pivotal role in the construction of the transformer architecture [25], which has had a profound impact
18
+ 20 on the deep learning field.
19
+ 21 Despite great empirical success, the driving principles of attention are still poorly understood. This
20
+ 22 lack of understanding impedes practitioners from confidently and appropriately using attention layers
21
+ 23 and makes it challenging to develop new attention-based neural architectures.
22
+ 24 In this paper, we offer a new perspective for understanding attention by showing that it is in fact
23
+ 25 a solver for a certain type of optimization problem that corresponds to an inference task. We give
24
+ 26 several examples, all of which can be characterized as follows: given 1) an unreliable estimate of
25
+ 27 the mean of an unknown distribution $p$ on $\mathbb { R } ^ { d }$ and 2) a preference distribution $u$ on $\mathbb { R } ^ { d }$ encoding
26
+ 28 beliefs on $p$ ’s selection, the inference task is to get a better estimate of $p$ ’s mean given its unreliable
27
+ 29 estimate and $u$ . We derive a convex optimization problem that is abstracted from the task and solve it
28
+ 30 by instead solving its Fenchel dual [22, p.104]. Remarkably, the derived expression of the improved
29
+ 31 estimate of $p$ gives a generalized attention structure whose special case is equivalent to the popular
30
+ 32 dot-product attention [15] that is also applied in the transformer network [25]. In addition, we show
31
+ 33 that our generalized attention expression has been implicitly adopted by T5 transformer [19] as the
32
+ 34 expression unifies the concept of word masks and its positional encoding functions. Extra examples
33
+ 35 are given to show how the generalized attention structures can be used in practice.
34
+ 37 Since 2019, several authors have investigated the properties and working mechanism of attention.
35
+ 38 This series of works mainly addresses whether the attention mechanism can serve as a proxy of
36
+ 39 saliency [9, 18, 23, 24, 26, 28]. Most of these works obtain insights into the attention mechanism
37
+ 40 by performing empirical studies. The related methods include analyzing the behaviours of trained
38
+ 41 attention-based networks [4], or pruning a few heads, or analyzing the effects of altering the attention
39
+ 42 weights [18, 26], or a mixture of these [9, 24].
40
+ 43 Apart from understanding attention empirically, some theoretical results presented by Brunner el
41
+ 44 al. [3] and Hahn [7] show that the self-attention layers are not identifiable. This implies there could
42
+ 45 exist multiple combinations of attention weights that can provide equally good final predictions.
43
+ 46 In particular, such non-uniqueness means that the use of attention may complicate interpretability.
44
+ 47 Another important approach to understand attention is to analyze its asymptotic behaviour when
45
+ 48 the number of heads and the network width approach infinity [8, 30]. In this limiting case, the
46
+ 49 entire network can be seen as a Gaussian process [13] and its behaviours can be characterized by
47
+ 50 closed-form expressions that are not available in the finite case.
48
+ 51 Very recently (since 2021) several theoretical works have appeared that study attention outside the
49
+ 52 asymptotic regime. Lu et al. [14] set up a simple attention-based classification model and derive a
50
+ 53 closed-form relationship between the word’s embedding norm and the product of its key and the
51
+ 54 query. They empirically show that such relationship also exists in a more complicated and practical
52
+ 55 configuration. Ramsauer et al. [20] construct an equivalence relationship between attention and
53
+ 56 a newly proposed Hopfield network with continuous states. In particular, they show that the new
54
+ 57 Hopfield network’s update rule is equivalent to the attention mechanism used in transformers [25].
55
+
56
+ # 58 3 A Motivating Example
57
+
58
+ 59 We first consider a seemingly unrelated example, to illustrate the key ingredients of this paper.
59
+
60
+ 60 Assume a probability distribution $p$ on $\mathbb { R } ^ { d }$ has a spherical Gaussian prior $u \sim \mathcal N ( \mu , I _ { d } )$ . Let $h _ { p }$
61
+ 61 denote the mean of the unknown $p$ . Given an unreliable observation $b$ of $h _ { p }$ , what is the best guess
62
+ 62 of $h _ { p }$ ? To solve this problem, we may formulate the following optimization problem
63
+
64
+ $$
65
+ p ^ { * } = \arg \operatorname* { m i n } _ { p } \frac { \alpha } { 2 } \left\| b - \int \mathbf { a } p ( \mathbf { a } ) \ \mathrm { d } \mathbf { a } \right\| ^ { 2 } + K ( p , u ) ,
66
+ $$
67
+
68
+ 63 with $\alpha > 0$ responsible for the relative strength of the two terms, where $\kappa ( p , u )$ denotes the KL
69
+ 64 divergence between $p$ and $u$ . The basic idea behind (1) is that: although $b$ is not reliable, it should
70
+ 65 not be too far from $\begin{array} { r } { \bar { h } _ { p } = \int \mathbf { a } p ( \mathbf { a } ) } \end{array}$ da. Also, as $u$ encodes the preferred value of $p$ , we add the
71
+ 66 KL divergence term to show preference for $p$ that is close to $u$ . As will be discussed later, such a
72
+ 67 formulation can be either obtained from the maximum likelihood principle or from the maximum
73
+ 68 entropy principle [10, 11]. In particular, Rioux et al [21] develop (1) for image de-blurring by applying
74
+ 69 Maximum Entropy on the Mean (MEM), an information-theoretic method due to Gamboa [6] but not
75
+ 70 yet widely known in machine learning.
76
+
77
+ After obtaining the minimizer 71 $p ^ { * }$ of (1), its mean $\int { \bf a } p ^ { * } ( { \bf a } )$ da gives our estimate of $h _ { p }$ . Rioux et al. [21] prove, via Fenchel duality [22, p.104] that the minimizer 72 $p ^ { * }$ takes the form
78
+
79
+ $$
80
+ p ^ { * } ( \mathbf { a } ) = \frac { u ( \mathbf { a } ) \exp \langle \mathbf { a } , \lambda ^ { * } \rangle } { \int u ( \mathbf { a } ^ { \prime } ) \exp \langle \mathbf { a } ^ { \prime } , \lambda ^ { * } \rangle \ \mathbf { d } \mathbf { a } ^ { \prime } } ,
81
+ $$
82
+
83
+ 73 where
84
+
85
+ $$
86
+ \lambda ^ { * } = \arg \operatorname* { m a x } _ { \lambda \in \mathbb { R } ^ { d } } \langle b , \lambda \rangle - \frac { 1 } { 2 \alpha } \left\| \lambda \right\| ^ { 2 } - \log \int _ { \mathbb { R } ^ { d } } u ( \mathbf { a } ) \exp \langle \mathbf { a } , \lambda \rangle \ \mathrm { d } \mathbf { a } .
87
+ $$
88
+
89
+ 74 Note that $\begin{array} { r } { \int _ { \mathbb { R } ^ { d } } u ( { \mathbf { a } } ) \exp \langle { \mathbf { a } } , \lambda \rangle \mathrm { d } { \mathbf { a } } = \exp ( \langle \mu , \lambda \rangle + \frac { 1 } { 2 } \left\| \lambda \right\| ^ { 2 } ) } \end{array}$ as it is the moment generating function
90
+ 75 (MGF) of $u \sim \mathcal N ( \mu , I _ { d } )$ . Substituting the expression into (3) followed by setting the derivative with
91
+ 76 respect to $\lambda$ to zero yields $\begin{array} { r } { \lambda ^ { * } = \frac { \alpha } { \alpha + 1 } ( b - \mu ) } \end{array}$ . By (2), $p ^ { * } ( \mathbf { a } ) \propto \exp ( - \frac { 1 } { 2 } \left\| \mathbf { a } - \boldsymbol { \mu } \right\| ^ { 2 } + \langle \mathbf { a } , \lambda ^ { * } \rangle ) \propto$
92
+ 77 $\begin{array} { r } { \exp ( - \frac { 1 } { 2 } \left\| \mathbf { a } - ( \mu + \lambda ^ { * } ) \right\| ^ { 2 } ) } \end{array}$ . Substituting $\begin{array} { r } { \lambda ^ { * } = \frac { \alpha } { \alpha + 1 } ( b - \mu ) } \end{array}$ into it implies that $p ^ { * }$ follows a Gaussian
93
+ 78 2distribution $\begin{array} { r } { \mathcal { N } ( \frac { 1 } { 1 + \alpha } \mu + \frac { \alpha } { 1 + \alpha } b , I _ { d } ) } \end{array}$ α+1 . Thus, our estimate of $h _ { p }$ is $\textstyle { \frac { 1 } { 1 + \alpha } } \mu + { \frac { \alpha } { 1 + \alpha } } b$ .
94
+ 79 In this paper, we focus on a similar optimization problem that estimates $h _ { p }$ assuming that $u$ is instead
95
+ 80 a discrete distribution. We show that such optimization problems naturally and frequently arise in
96
+ 81 neural network designs. By solving the optimization problem, we derive a closed-form approximation
97
+ 82 for the estimate of $h _ { p }$ , via Fenchel duality. The approximation then gives a generalized attention layer
98
+ 83 structure as shown in Fig 1. A special case of it is equivalent to the familiar dot-product attention [15]
99
+ 84 that is also adopted in transformers [25]. Moreover, we will show that T5 transformer [19] implicitly
100
+ 85 adopts our generalized attention expression.
101
+
102
+ # 86 4 Setup of a Design Problem
103
+
104
+ Throughout the rest of the paper, we consider a machine learning problem in which the objective is to predict an output quantity $Y$ from a given input $X$ . Additionally, $Y$ may include $K$ components, namely, be expressed as $( Y ^ { ( 1 ) } , Y ^ { ( 2 ) } , . . . , Y ^ { ( \bar { K } ) } )$ . To be more concrete, we present a few example machine learning problems and let them run through our development.
105
+
106
+ Example: Translation Problem. In this problem, the input $X$ is a sentence, or a sequence of words, in the source language, and output $Y$ is the sequence of words in the target sentence, where $Y ^ { ( k ) }$ denotes the $k ^ { \mathrm { t h } }$ word.
107
+
108
+ ![](images/1444bafeff68bac9e0d97ac7396815a8edbe11c0d8d54f9e32bebb087ee58b51.jpg)
109
+ Figure 1: A conceptual graph of the deep learning model that we work with. The block $g ^ { ( k ) }$ is the one we will investigate.
110
+
111
+ Example: Image Captioning. In this problem, the input $X$ is a raw image and output $Y$ is the sequence of words in the caption, where $\dot { Y } ^ { ( k ) }$ denotes the $k ^ { \mathrm { t h } }$ word.
112
+
113
+ Example: Filling in the blanks task. This task has been used to train the BERT model [5]. The input $X$ is a sequence of words with certain percentage of words masked. The output $Y$ are the predicted masked words, where $Y ^ { ( k ) }$ denotes the $k ^ { \mathrm { t h } }$ masked one.
114
+
115
+ 108 The objective of any of these problems and that we address in this paper is to learn a function $F$ ,
116
+ 109 mapping from the space of $X$ to the space of $Y$ so that $Y = F ( X )$ . We will denote by $F ^ { ( k ) }$ the part
117
+ 110 of $F$ responsible for predicting $Y ^ { ( k ) }$ (Fig 1a), namely, $Y ^ { ( k ) } = F ^ { ( k ) } ( X )$ . Although we here express
118
+ 111 $F$ as separate functions $( F ^ { ( 1 ) } , F ^ { ( 2 ) } , \dots , F ^ { ( K ) } )$ , we note that it is in fact possible that different $F ^ { ( k ) }$ ’s
119
+ 112 share some component in common. We now focus on the design of $F ^ { ( k ) }$ .
120
+
121
+ We restrict the architectur113 The extraction of feature 114 $F ^ { ( k ) }$ to the form in Fig 1b wa two parallel modules e mand cus on the inference of that directly operate o $h ^ { ( k ) }$ . $h ^ { ( k ) }$ $f _ { \mathrm { e v d } } ^ { ( k ) }$ f (k)
122
+ 115 input followed by a function $g ^ { ( k ) }$ (in Fig 1c), which we will design.
123
+
124
+ 116 The Design Problem We describe the problem of designing $g$ as follows.
125
+
126
+ Suppose that there is an unknown distribution 117 $p ^ { ( k ) }$ on $\mathbb { R } ^ { d }$ whose mean vector is $h ^ { ( k ) }$ , namely,
127
+
128
+ $$
129
+ h ^ { ( k ) } = \int _ { \mathbb { R } ^ { d } } \mathbf { a } p ^ { ( k ) } ( \mathbf { a } ) \ \mathrm { d } \mathbf { a } .
130
+ $$
131
+
132
+ 118 Let $u ^ { ( k ) }$ be another distribution on $\mathbb { R } ^ { d }$ that is generated as the output of a network module $f _ { \mathrm { p r e f } } ^ { ( k ) }$ . Here
133
+ 119 $u ^ { ( k ) }$ is referred to as the preference distribution, which serves as a prior guess of $p ^ { ( k ) }$ . Specifically
134
+ 120 121 $u ^ { ( k ) }$ puts non-zero probabilitabilities are respectively $M$ mplate” vectors (which sum to $\mathbf { t } _ { 1 } ^ { ( k ) } , \mathbf { t } _ { 2 } ^ { ( k ) } , \dots , \mathbf { t } _ { M } ^ { ( k ) }$ in $\mathrm { R } ^ { d }$ , and their
135
+ $u _ { 1 } ^ { ( k ) } , u _ { 2 } ^ { ( k ) } , \dots , u _ { M } ^ { ( k ) }$ 1). Collectively, we will denote the
136
+ 122 set {t(k)1 , $\{ \mathbf { t } _ { 1 } ^ { ( k ) } , \mathbf { t } _ { 2 } ^ { ( k ) } , \dots , \mathbf { t } _ { M } ^ { ( k ) } \}$ of templates by $\mathbf { T } ^ { ( k ) }$ .
137
+
138
+ The preference distribution 123 $u ^ { ( k ) }$ is considered as a good approximation of $p ^ { ( k ) }$ , in the sense that the support of 124 $p ^ { ( k ) }$ is contained in the set $\mathbf { T } ^ { ( k ) }$ of templates. Note that if $\mathbb { R } ^ { d }$ is the word embedding space for a large vocabulary, and if the size 125 $M$ of the template set $\mathbf { T } ^ { ( k ) }$ is relative small, then restricting the support of 126 $p ^ { ( k ) }$ to within $\mathbf { T } ^ { ( k ) }$ imposes a strong constraint on $p ^ { ( k ) }$ .
139
+
140
+ ![](images/675661f9a44ea28e9f1faa371132854800f42f6fcb4c24e8ef6a86bef3b48900.jpg)
141
+ Figure 2: The model architectures of the three running examples. For the $f _ { \mathrm { e v d } } ^ { ( k ) }$ in (a) and (b), the dashed links exist throughout the training and are replaced by the dotted ones in the generation stage.
142
+
143
+ 127 On the other hand, $u ^ { ( k ) }$ is not a sufficiently accurate approximation of $p ^ { ( k ) }$ , in the sense that $u ^ { ( k ) }$ may
144
+ 128 assign probabilities to $\mathbf { T } ^ { ( k ) }$ somewhat differently. Such inaccuracy shifts the mean $\mu ^ { ( k ) }$ of $u ^ { ( k ) }$ from
145
+ 129 the mean $h ^ { ( k ) }$ of $p ^ { ( k ) }$ . Suppose that there is another piece of information $z ^ { ( k ) } \in \mathbb { R } ^ { \dot { d } }$ that is generated
146
+ 130 by another network module $f _ { \mathrm { e v d } } ^ { ( k ) }$ and provides information regarding the mean shift. In particular, we
147
+ 131 assume that $z ^ { ( k ) }$ is a noisy version of the shift, more precisely,
148
+
149
+ $$
150
+ z ^ { ( k ) } = h ^ { ( k ) } - \mu ^ { ( k ) } + \epsilon ,
151
+ $$
152
+
153
+ where 132 $\boldsymbol \epsilon \sim \mathcal { N } ( \mathbf 0 , \sigma ^ { 2 } \mathbf I )$ is the spherical Gaussian noise in $\mathbb { R } ^ { d }$ with covariance $\sigma ^ { 2 } \mathbf { I }$ . We refer to $z ^ { ( k ) }$ as 133 the evidence.
154
+
155
+ 134 Then the design problem is to construct a function, or a network block, $g$ , which infers the unknown distribution 135 $p ^ { ( k ) }$ and hence its mean $h ^ { ( k ) }$ based on the evidence $z ^ { ( k ) }$ and the preference distribution 136 $u ^ { ( k ) }$ .
156
+
157
+ 137 This formulation of the design problem might seem peculiar at the first glance, but we will show
158
+ 38 via examples (see Fig 2) that such a problem naturally arises in the construction of many machine
159
+ 39 learning models in practice.
160
+
161
+ Example: Translation Problem. For the translation problem, consider the model implementation plotted in Fig 2a that is similar to the one proposed in [1]. We will focus on the part of the model responsible for inferring the $k ^ { \mathrm { t h } }$ word of the target sentence. In this model, $h ^ { ( k ) }$ corresponds to the constructed feature according to (4) that serves as an estimate of the context vector collecting the source sentence information. The estimated $h ^ { ( k ) }$ is then fed into a classifier $f _ { \mathrm { o u t } } ^ { ( k ) }$ to predict the $k ^ { \mathrm { t h } }$ word. The preference distribution $u ^ { ( k ) }$ is generated by $f _ { \mathrm { p r e f } } ^ { ( k ) }$ which takes the source sentence words as inputs. In particular, the support of $u ^ { ( k ) }$ consists of the source sentence word embeddings $\mathbf { T }$ (called annotations in [1]) which are pre-processed by two LSTM layers.1 The preference weight for each template depends on some positional encoding functions, which, in principle, should assign higher
162
+
163
+ 49 weights to the templates appearing in the similar locations to the words we are inferring (that is, $h ^ { ( k ) }$
164
+ 50 is assumed to rely on the templates near $\mathbf { t } _ { k }$ more heavily).
165
+ 151 Note that the inferred $p ^ { ( k ) }$ ’s support must be a subset of $u ^ { ( k ) }$ ’s as it is reasonable to assume that the
166
+ 152 target sentence words only depend on those appearing in the source sentence. Besides, although
167
+ 153 the preference weights specified by the positional encoding functions could provide some a priori
168
+ 154 information for the templates’ weights in $p ^ { ( k ) }$ , they cannot be accurate as their inferences do not
169
+ 155 consider the previously generated words $Y ^ { ( i < t ) }$ . This results in the mean $\mu ^ { ( k ) }$ shifted from $h ^ { ( k ) }$ ,
170
+ 156 which is estimated by z(k) = f (k)evd t hat takes all the previously generated words $Y ^ { ( i < t ) }$ into account
171
+ 157 using another LSTM layer. Thus, $h ^ { ( k ) }$ and $p ^ { ( k ) }$ should not be far from $z ^ { ( k ) } + \mu ^ { ( k ) }$ and $u ^ { ( k ) }$ ,
172
+ 158 respectively.
173
+ 159 Example: Image Captioning. The caption generation modelarchitecture reported in [29]. This model shares the designs of 160 $\bar { f } _ { \mathrm { e v d } } ^ { ( k ) }$ enteand $ { f _ { \mathrm { o u t } } ^ { ( k ) } }$ Fig 2b has a similarwith the translation
174
+ 161 model while $f _ { \mathrm { p r e f } } ^ { ( k ) }$ instead extracts the templates from a raw image using a CNN network. In general,
175
+ 162 a word’s position in the caption is independent of the location of the object it describes in the image.
176
+ 163 Therefore, in this model, all templates extracted by the CNN share the same preference weight.
177
+ 164 As similar objects appear in an image would have similar features extracted by the CNN (for example,
178
+ 165 a zebra and a horse), allowing similar templates not in $\mathbf { T }$ to participate in $\bar { h } ^ { ( k ) }$ ’s estimation would
179
+ 166 possibly mix in information not contained in the raw image and harm the word inference accuracy.
180
+ 167 Therefore, we could improve the estimate of $h ^ { ( k ) }$ by choosing $p ^ { ( k ) }$ similar to $u ^ { ( k ) }$ in the sense that
181
+ 168 $p ^ { ( k ) }$ ’s support cannot contain elements not in $u ^ { ( k ) }$ ’s.
182
+ 169 Intuitively, as the generation process proceeds, the context $h ^ { ( k ) }$ should be updated to provide relevant
183
+ 170 information in the image to facilitate the next word inference. Such change is governed by the
184
+ 171 caption’s semantic evolution, which is captured by $z ^ { ( k ) } = f _ { \mathrm { e v d } } ^ { ( k ) }$ that predicts the shift of the mean
185
+ 172 $\mu ^ { ( k ) }$ from . For this reason, $\mu ^ { ( k ) } + z ^ { ( k ) }$ serves as an estimate of $h ^ { ( k ) }$ and should not be far away
186
+ 173 from it. Likewise, $u ^ { k }$ should be close to $p ^ { ( k ) }$ .
187
+
188
+ Example: Filling in the blanks task. For the filling-in-the-blank tasks, let us consider a model architecture plotted in Fig 2c that is similar to the one used in BERT [5]. We focus on the inference of the $k ^ { \mathrm { t h } }$ masked word, which is assumed to be the $j ^ { t h }$ word of the input sentence. In this model, $f _ { \mathrm { p r e f } } ^ { ( k ) }$ and $f _ { \mathrm { e v d } } ^ { ( k ) }$ share the transformation layers (TL) that are commonly used in the NLP tasks to map one sequence of vector representations to another of the same length.2 Taking the output sequence, $f _ { \mathrm { p r e f } } ^ { ( k ) }$ applies a linear map $V$ to each of its elements to form $\mathbf { T }$ as the support of $u ^ { ( k ) }$ while the preference weights are specified by some positional encoding functions. At the same time, $z ^ { ( k ) } = f _ { \mathrm { e v d } } ^ { ( k ) }$ estimates $h ^ { ( k ) }$ ’s shift from the mean $\mu ^ { ( k ) }$ due to the variation of the local information. For the same reasons discussed in the previous two examples, we need $\mu ^ { ( k ) } + z ^ { ( k ) }$ close to $h ^ { ( k ) }$ while $p ^ { ( k ) }$ is close to $u ^ { ( k ) }$ .
189
+
190
+ Notably the formulation of the problem is based on the assumption that the network modules f (k)evd and $f _ { \mathrm { p r e f } } ^ { ( k ) }$ are fixed and generate $z ^ { ( k ) }$ and $u ^ { ( k ) }$ satisfying the above assumed properties. In reality, $f _ { \mathrm { e v d } } ^ { ( k ) }$ and $f _ { \mathrm { p r e f } } ^ { ( k ) }$ are in fact obtained via training. However, we argue that if $g$ is made to satisfy our design objective, then we can at least interpret $f _ { \mathrm { e v d } } ^ { ( k ) }$ and $f _ { \mathrm { p r e f } } ^ { ( k ) }$ obtained from training as serving to produce and with our desired properties.
191
+
192
+ # 5 Formulation of an Optimization Problem
193
+
194
+ The discussion made in the previous section implies that the key optimization problem we are about to focus on should ensure
195
+
196
+ 1. $h ^ { ( k ) }$ is not too far from $\mu ^ { ( k ) } + z ^ { ( k ) }$ , where $h ^ { ( k ) }$ is constructed by $p ^ { ( k ) }$ according to (4) and $\mu ^ { ( k ) }$ is the mean of the preference distribution $u ^ { ( k ) }$ . 2. $p ^ { ( k ) }$ is close to $u ^ { ( k ) }$ while $p ^ { ( k ) }$ ’s support must be a subset of $u ^ { ( k ) }$ ’s.
197
+
198
+ 2Typical implementation of such layers include convolution layers, recurrent layers and self-attention layers.
199
+
200
+ 194 These two desiderata prompt us to optimize:
201
+
202
+ $$
203
+ \operatorname* { m i n } _ { p } \frac { \alpha } { 2 } \left\| \left( \mu ^ { ( k ) } + z ^ { ( k ) } \right) - \int _ { \mathbb { R } ^ { d } } \mathbf { a } p ( \mathbf { a } ) \ \mathrm { d } \mathbf { a } \right\| ^ { 2 } + \mathcal { K } ( p , u ^ { ( k ) } )
204
+ $$
205
+
206
+ 195 with $\alpha > 0$ responsible for the relative strength of the two terms, where $\kappa ( p , u ^ { ( k ) } )$ denotes the KL
207
+ 196 divergence from $p$ to $u ^ { ( k ) }$ . Remarkably, $\kappa ( \boldsymbol { p } , \boldsymbol { u } ^ { ( k ) } )$ has a finite value if and only if $p ^ { ( k ) }$ has non-zero
208
+ 197 values on the support of $u ^ { ( k ) }$ . Thus, both requirements in the second desideratum are satisfied by
209
+ 198 using the KL divergence as a measure for the closeness of $p ^ { ( k ) }$ and $u ^ { ( k ) }$ . Let $\tilde { p } ^ { ( k ) }$ be the minimizer of
210
+ 199 (6). The estimate of $h ^ { ( k ) }$ is
211
+
212
+ $$
213
+ \hat { h } ^ { ( k ) } = \int _ { \mathbb { R } ^ { d } } \mathbf { a } \tilde { p } ^ { ( k ) } ( \mathbf { a } ) \ \mathrm { d } \mathbf { a } .
214
+ $$
215
+
216
+ Naturally, this optimization problem can be derived from two different, though, related perspectives.300
217
+
218
+ 201 A maximum likelihood perspective. The optimization problem in (6) can be derived using the
219
+ 202 maximum log likelihood method by treating the KL-divergence term as a regularizer. According to
220
+ 203 (5), the difference $( \mu ^ { ( k ) } + z ^ { ( k ) } ) - h ^ { ( \bar { k } ) }$ follows a Gaussian distribution ${ \mathcal { N } } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbf { I } )$ . This implies the log
221
+ 204 likelihood function $\begin{array} { r } { \ell ( z ^ { ( k ) } ) \propto - \frac { 1 } { 2 \sigma ^ { 2 } } \left\| ( \mu ^ { ( k ) } + z ^ { ( k ) } ) - h ^ { ( k ) } \right\| ^ { 2 } } \end{array}$ . Maximizing it with the KL-divergence
222
+ 205 term as a regularizer is the same as minimizing
223
+
224
+ $$
225
+ \frac { 1 } { 2 \sigma ^ { 2 } } \left\| \left( \boldsymbol { \mu } ^ { ( k ) } + \boldsymbol { z } ^ { ( k ) } \right) - \boldsymbol { h } ^ { ( k ) } \right\| ^ { 2 } + \eta \mathcal { K } ( p , \boldsymbol { u } ^ { ( k ) } ) ,
226
+ $$
227
+
228
+ 206 where $\eta > 0$ controls the strength of the regularization. Substituting (4) into (8) followed by
229
+ 207 rearrangement yields
230
+
231
+ $$
232
+ \operatorname* { m i n } _ { \boldsymbol { p } } \frac { 1 } { 2 \eta \sigma ^ { 2 } } \left\| \left( \boldsymbol { \mu } ^ { ( k ) } + \boldsymbol { z } ^ { ( k ) } \right) - \int _ { \mathbb { R } ^ { d } } \mathbf { a } \boldsymbol { p } ( \mathbf { a } ) \ \mathrm { d } \mathbf { a } \right\| ^ { 2 } + \mathcal { K } ( \boldsymbol { p } , \boldsymbol { u } ^ { ( k ) } ) ,
233
+ $$
234
+
235
+ which is equivalent to (6) by setting 208 $\alpha ^ { - 1 } = \eta \sigma ^ { 2 }$ .
236
+
237
+ 209 A maximum entropy on the mean perspective Consider a problem that seeks a distribution $p$ such that the expectation 210 $\int _ { \mathbb { R } ^ { d } } \mathbf { a } p ( \mathbf { a } )$ da is not far from $\mu ^ { ( k ) } + z ^ { ( k ) }$ . In particular, we require
238
+
239
+ $$
240
+ \left\| \left( { \boldsymbol { \mu } } ^ { ( k ) } + { \boldsymbol { z } } ^ { ( k ) } \right) - \int _ { \mathbb { R } ^ { d } } \mathbf { a } p ( \mathbf { a } ) ~ \mathrm { d } \mathbf { a } \right\| ^ { 2 } \leq { \frac { 1 } { 2 \alpha } } .
241
+ $$
242
+
243
+ 211 Note that, given $z ^ { ( k ) }$ , there are infinitely many $p$ ’s that satisfy the constraints, which makes it difficult
244
+ 212 to pick a “best” $p$ for later use. A technique known in information theory as the maximum entropy on
245
+ 213 the mean (MEM) [6, 21] solves this problem by picking the best guess of the ground truth $p ^ { * }$ that
246
+ 214 simultaneously satisfies (10) and minimizes the KL divergence to the preference distribution $u ^ { ( k ) }$ .
247
+ 215 That is,
248
+
249
+ $$
250
+ \tilde { p } ^ { ( k ) } = \arg \operatorname* { m i n } _ { p } K ( p , u ^ { ( k ) } ) \qquad \mathrm { s u b j e c t ~ t o } \qquad \left\| \left( \mu ^ { ( k ) } + z ^ { ( k ) } \right) - \int _ { \mathbb { R } ^ { d } } \mathbf { a } p ( \mathbf { a } ) \ \mathrm { d } \mathbf { a } \right\| ^ { 2 } \leq \frac { 1 } { 2 \alpha } ,
251
+ $$
252
+
253
+ 216 which is also the minimizer of (6) according to Equation (18) of [21] and Corollary 4.9 of [2].
254
+
255
+ # 6 Optimal Solution
256
+
257
+ Rioux et al. proved that the optimization problem stated in (6) has the following Fenchel dual (see Theorem 2 of [21]):
258
+
259
+ 220 Theorem 1. The dual of (6) is given by
260
+
261
+ $$
262
+ \operatorname* { m a x } _ { \lambda \in \mathbb { R } ^ { d } } \left\{ \left. \lambda , \mu ^ { ( k ) } + z ^ { ( k ) } \right. - \frac { 1 } { 2 \alpha } \left\| \lambda \right\| ^ { 2 } - \log \int _ { \mathbb { R } ^ { d } } u ^ { ( k ) } ( \mathbf { a } ) \exp \langle \mathbf { a } , \lambda \rangle \ \mathrm { d } \mathbf { a } \right\} .
263
+ $$
264
+
265
+ Given a maximizer 221 $\lambda ^ { * }$ of $( I 2 )$ , one can recover the minimizer $\tilde { p } ^ { ( k ) }$ of (6) via
266
+
267
+ $$
268
+ \widetilde { p } ^ { ( k ) } ( \mathbf { a } ) = \frac { u ( \mathbf { a } ) \exp \langle \mathbf { a } , \lambda ^ { * } \rangle } { \int _ { \mathbb { R } ^ { d } } u ( \mathbf { a } ^ { \prime } ) \exp \langle \mathbf { a } ^ { \prime } , \lambda ^ { * } \rangle \ \mathrm { d } \mathbf { a } ^ { \prime } } .
269
+ $$
270
+
271
+ 3In fact, there is also a Bayesian perspective to derive the problem, which will be discussed in Appendix A.
272
+
273
+ By Theorem 1, the estimated 222 $h ^ { ( k ) }$ defined in (7) can be re-written as
274
+
275
+ $$
276
+ \hat { h } ^ { ( k ) } = \int _ { \mathbb { R } ^ { d } } \mathbf { a } \tilde { p } ^ { ( k ) } ( \mathbf { a } ) ~ \mathrm { d } \mathbf { a } = \int _ { \mathbb { R } ^ { d } } \mathbf { a } ~ \frac { u ^ { ( k ) } ( \mathbf { a } ) \exp \langle \mathbf { a } , \lambda ^ { * } \rangle } { \int _ { \mathbb { R } ^ { d } } u ^ { ( k ) } ( \mathbf { a } ^ { \prime } ) \exp \langle \mathbf { a } ^ { \prime } , \lambda ^ { * } \rangle ~ \mathrm { d } \mathbf { a } ^ { \prime } } ~ \mathrm { d } \mathbf { a } ,
277
+ $$
278
+
279
+ where 223 $\lambda ^ { * }$ is a maximizer of (12).
280
+
281
+ 224 In general, $\lambda ^ { * }$ does not have a closed-form expression in terms of $\alpha$ , $u ^ { ( k ) }$ and $z ^ { ( k ) }$ , and a standard
282
+ 225 paradigm is to search for it using gradient ascent-based methods. In this paper, we will not search for
283
+ 226 $\lambda ^ { * }$ in this way; instead, we will derive a closed-form expression to approximate it. Remarkably, this
284
+ 227 takes the form of the generalized attention presented in Fig 1.
285
+
286
+ Note that the integration in (12) equals $\mathbb { E } _ { u ^ { ( k ) } } [ \exp \langle W , \lambda \rangle ]$ , the expectation of the random variable $\exp \langle W , \lambda \rangle$ where $W$ has the probability distribution $u ^ { ( k ) }$ . The expectation is just the moment generating function (MGF) $M ( \lambda )$ of $W$ , and the value $\log M ( \lambda )$ is called the cumulant of $W$ [17, p.26], which has an expansion [17, (2.4)]
287
+
288
+ $$
289
+ \log M ( \lambda ) = \left. \mu ^ { ( k ) } , \lambda \right. + \frac { 1 } { 2 } \left. \lambda , \Sigma ^ { ( k ) } \lambda \right. + { \mathcal O } ( \left. \lambda \right. ^ { 3 } ) ,
290
+ $$
291
+
292
+ where $\mu ^ { ( k ) } = \int _ { \mathbb { R } ^ { d } }$ a $u ^ { ( k ) } ( \mathbf { a } )$ da and $\begin{array} { r } { \Sigma ^ { ( k ) } = \int _ { \mathbb { R } ^ { d } } \left( \mathbf { a } - \boldsymbol { \mu } ^ { ( k ) } \right) \left( \mathbf { a } - \boldsymbol { \mu } ^ { ( k ) } \right) ^ { T } \boldsymbol { u } ^ { ( k ) } ( \mathbf { a } ) } \end{array}$ da respectively denote the expectation and the variance-covariance matrix of $W$ .
293
+
294
+ 234 Now we assume that $\alpha$ is small and we argue that this assumption is justified in practice. For instance,
295
+ 235 in the translation task, all of words in the dictionary can serve as candidate templates, which could
296
+ 236 be more than 10,000, but $u ^ { ( k ) }$ reduces this size to the length of the source sentence (usually less
297
+ 237 than tens of words). The inference of $p ^ { ( k ) }$ should strongly anchor around this prior information;
298
+ 238 consequently the information provided by $z ^ { ( k ) }$ should weigh less. On the other hand, $z ^ { ( k ) }$ can hardly
299
+ 239 provide an accurate estimate of the mean shift, since the generation of $z ^ { ( k ) }$ is often ignorant of the
300
+ 240 templates selected by $u ^ { ( k ) }$ (for example, in the example translation and image captioning models) or
301
+ 241 generated by a low-capacity module (as in the example filling-in-the-blank model). For these reasons,
302
+ 242 one should de-emphasize the constraint imposed by $z ^ { ( k ) }$ and hence choose a small $\alpha$ .
303
+
304
+ When $\alpha$ is picked to be small enough (see (12)), the optimization of $\lambda$ gets a large penalty on its L2 norm and thus, $\| \lambda ^ { * } \|$ is close to zero. Then, by (15), we have
305
+
306
+ $$
307
+ \log \int _ { { \mathbb { R } } ^ { d } } u ^ { ( k ) } ( { \mathbf { a } } ) \exp \langle { \mathbf { a } } , \lambda ^ { * } \rangle { \mathbf { \Psi } } { \mathrm { d } } { \mathbf { a } } = \log M ( \lambda ^ { * } ) \approx \langle \mu ^ { ( k ) } , \lambda ^ { * } \rangle + \frac { 1 } { 2 } \langle \lambda ^ { * } , \Sigma ^ { ( k ) } \lambda ^ { * } \rangle .
308
+ $$
309
+
310
+ Substituting (16) into (12) followed by setting the derivative with respect to $\lambda$ to zero yields
311
+
312
+ $$
313
+ \lambda ^ { * } = \alpha ( I _ { d } + \alpha \Sigma ^ { ( k ) } ) ^ { - 1 } z ^ { ( k ) } ,
314
+ $$
315
+
316
+ where $I _ { d }$ denotes the $d \times d$ identity matrix. As $\alpha$ is assumed close to zero, (17) is further reduced to
317
+
318
+ $$
319
+ \lambda ^ { * } = \alpha z ^ { ( k ) } .
320
+ $$
321
+
322
+ 47 Plugging the expression into (14) gives the result stated as follows:
323
+
324
+ Theorem 2. For a small enough $\alpha > 0$ , the estimated $h ^ { ( k ) }$ defined in (7) can be approximated by
325
+
326
+ $$
327
+ \hat { h } ^ { ( k ) } = \int _ { \mathbb { R } ^ { d } } \mathbf { a } \frac { u ^ { ( k ) } ( \mathbf { a } ) \exp ( \alpha \langle \mathbf { a } , z ^ { ( k ) } \rangle ) } { \int _ { \mathbb { R } ^ { d } } u ^ { ( k ) } ( \mathbf { a } ^ { \prime } ) \exp ( \alpha \langle \mathbf { a } ^ { \prime } , z ^ { ( k ) } \rangle ) \mathrm { d } \mathbf { a } ^ { \prime } } \mathrm { d } \mathbf { a } .
328
+ $$
329
+
330
+ For the cas249 probability 250 $u ^ { ( k ) }$ distribution with support , (19) becomes simply $\{ \mathbf { t } _ { 1 } ^ { ( k ) } , \mathbf { t } _ { 2 } ^ { ( k ) } , \dots , \mathbf { t } _ { n } ^ { ( k ) } \}$ and the preference $\{ u _ { 1 } ^ { ( k ) } , u _ { 2 } ^ { ( k ) } , \ldots , u _ { n } ^ { ( k ) } \}$
331
+
332
+ $$
333
+ \hat { h } ^ { ( k ) } = \sum _ { i = 1 } ^ { n } \mathbf { t } _ { i } \frac { u _ { i } ^ { ( k ) } \exp ( \alpha \langle \mathbf { t } _ { i } , z ^ { ( k ) } \rangle ) } { \sum _ { j = 1 } ^ { n } u _ { j } ^ { ( k ) } \exp ( \alpha \langle \mathbf { t } _ { j } , z ^ { ( k ) } \rangle ) } .
334
+ $$
335
+
336
+ In Fig 3, we set 251 $d = 2$ and visualize the approximation of $h ^ { ( k ) }$ for different selections of $\alpha$ . We can observe that, as 252 $\alpha$ decreases, (20) outputs a better approximation of $\hat { h } ^ { ( k ) }$ .
337
+
338
+ Let 253 $\alpha = \tau ^ { - \frac { 1 } { 2 } }$ , we rewrite Theorem 2 as follows for later reference.
339
+
340
+ Corollary 1. For a sufficiently large 254 $\tau$ , the best guess of $h ^ { ( k ) }$ defined in (7) with $\alpha = \tau ^ { - \frac { 1 } { 2 } }$ equals
341
+
342
+ $$
343
+ \hat { h } ^ { ( k ) } = \sum _ { i = 1 } ^ { n } \mathbf { t } _ { i } ^ { ( k ) } \frac { u _ { i } ^ { ( k ) } \exp ( \langle \mathbf { t } _ { i } ^ { ( k ) } , z ^ { ( k ) } \rangle / \sqrt { \tau } ) } { \sum _ { j = 1 } ^ { n } u _ { j } ^ { ( k ) } \exp ( \langle \mathbf { t } _ { j } ^ { ( k ) } , z ^ { ( k ) } \rangle / \sqrt { \tau } ) } .
344
+ $$
345
+
346
+ ![](images/0a991ffd1ffdd495cce50e8d736a8ce75c014f38a84cf0314071001a724626ff.jpg)
347
+ Figure 3: The approximation of $\hat { h } ^ { ( k ) }$ for different choices of $\alpha$ . The dots in light blue compose the support of discrete $u ^ { ( k ) }$ with the preference weights labelled above. The dark blue arrow starting from the mean $\mu ^ { ( k ) }$ of $u ^ { ( k ) }$ denotes the evidence $z ^ { ( k ) }$ . The red square marks the $\hat { h } ^ { ( k ) }$ constructed by (14) with the $\lambda ^ { * }$ maximizes (12), while the green one marks the $\hat { h } ^ { ( k ) }$ approximated by (20). As we can observe, (20) gives a precise approximation of $\hat { h } ^ { ( k ) }$ when $\alpha$ is sufficiently small.
348
+
349
+ # 255 7 Discussion
350
+
351
+ In Section 6, we derived an alternative expression of $\hat { h } ^ { ( k ) }$ defined in (7) by solving the Fenchel dual of the optimization problem stated in (6). Although the expression is not in closed form, as we are only interested in the case when $\alpha$ is small, a closed-form approximation of $\hat { h } ^ { ( k ) }$ is derived in Theorem 2 and reduced to the form stated in (21) when considering a discrete distribution $u ^ { ( k ) }$ .
352
+
353
+ As we pointed out, the block $g ^ { ( k ) }$ in Fig 2a, Fig 2b and Fig 2c is expected to find the inferred $\tilde { p } ^ { ( k ) }$ minimizing (6) followed by plugging it into (7) to construct $\hat { h } ^ { ( k ) }$ . Therefore, one can complete the architecture designs of the three running examples by replacing $g ^ { ( k ) }$ with a network layer implementing (21), namely, the structure in Figure 1 (c).
354
+
355
+ The relationship between the optimal solution and the attention models. Remarkably, the expression stated in (21) gives a generalized attention block. By setting $\begin{array} { r } { u _ { i } ^ { ( k ) } = \frac { 1 } { n } } \end{array}$ for all $i$ , the expression is equivalent to the well known dot-product attention [15], which is also applied in the transformer network [25]. The equivalence of the expression of $\hat { h } ^ { ( k ) }$ and the dot-product attention layer tells us: (a) by applying a dot-product attention layer in a model, we essentially ask the model to perform an optimization task defined in (6) and construct the output according to (7). (b) the derivation of $h ^ { ( k ) }$ depends on two relatively independent pieces of information: a preference distribution given the global information and an estimate of the output’s deviation from the preference distribution’s mean according to some local information. This suggests that the design of attention-based model can be decomposed into two parts that respectively estimate these two values.
356
+
357
+ The model consisting of a stack of attention layers. Although our discussion focuses on the case that contains a single attention layer, any attention layer $\mathcal { L }$ in an attention stack fits our frameworks (see Fig 1). In particular, all the attention layers closer to the input $X$ than $\mathcal { L }$ can be grouped into the functions $f _ { \mathrm { p r e f } } ^ { ( k ) }$ or f evd . For those layers that take the current layer’s output as input, we can group them into $f _ { \mathrm { o u t } } ^ { ( k ) }$ , where $\mathbf { c } ^ { ( k ) }$ may contain the outputs of other attention layers working in parallel.
358
+
359
+ 9 T5 transformer implicitly adopts the generalized attention structure. We now show that T5 0 transformer [19] can be seen as a realization of the generalized attention in (21), where the preference weights $u ^ { ( k ) }$ unifies the concepts of word masks and T5’s positional encoding functions. Consider 2 the running example: filing in the blanks, with the preference distribution
360
+
361
+ $$
362
+ u ^ { ( k ) } ( \mathbf { t } _ { i } ) = { \left\{ \begin{array} { l l } { 0 } & { { \mathrm { i f ~ t h e ~ } } i ^ { \mathrm { t h } } { \mathrm { ~ w o r d ~ i s ~ m a s k e d } } } \\ { \exp ( b _ { j - i } ) / Z } & { { \mathrm { o t h e r w i s e } } , } \end{array} \right. }
363
+ $$
364
+
365
+ 283 where $Z$ is a normalizing constant and $b _ { j - i }$ is a trainable scalar that only depends on the relative
366
+ 284 position of word $i$ and word $j$ (which is the $k ^ { \mathrm { t h } }$ masked word that we are inferring). Substituting
367
+ 285 such $u ^ { ( k ) }$ into (21) with $\tau = d$ yields
368
+
369
+ $$
370
+ \hat { h } ^ { ( k ) } = \sum _ { i = 1 } ^ { n } \mathbf { t } _ { i } \frac { \exp \left( \frac { \langle \mathbf { t } _ { i } , z ^ { ( k ) } \rangle } { \sqrt { d } } + b _ { j - i } + \mathbf { 1 } _ { \mathrm { m a s k e d } } ( i ) \right) } { \sum _ { l = 1 } ^ { n } \exp \left( \frac { \langle \mathbf { t } _ { l } , z ^ { ( k ) } \rangle } { \sqrt { d } } + b _ { j - l } + \mathbf { 1 } _ { \mathrm { m a s k e d } } ( l ) \right) } ,
371
+ $$
372
+
373
+ where $\mathbf { 1 } _ { \mathrm { m a s k e d } } ( i )$ is an indicator function that equals $- \infty$ if word $i$ is masked and zero otherwise. The expression in (23) has the same structure as that adopted in T5 transformer, where the indicator function serves as the mask function to prevent the model from assigning weights to the masked words. In this way, the concepts of word masks and the positional encoding functions are unified by $u ^ { ( k ) }$ in (22). Conversely, T5 transformer is a realization of the generalized attention with the preference weights $u ^ { ( k ) }$ specified in (22).
374
+
375
+ Generalized attention structures suggested by the optimal solution. While T5 transformer has implicitly adopted the generalized attention, (21) hints further generalizations could be made. For instance, in T5 transformer, the function outputting template’s preference weights only considers the word masks and the word’s relative positions. This function could be generalized to also consider the input sentence contexts, and the output weights encode the importance of each word before giving the local information stored in $z ^ { ( k ) }$ . The same idea could be applied to the image captioning example to replace the uniform preference weights. By adding a neural network taking the input image to generate non-uniform preference weights, we devise a mechanism to estimate the importance of each part of the image before the caption generation. In this way, the newly added network collects global information from the image to propose a preference distribution, which could be updated locally based on current generation stage encoded in $z ^ { ( k ) }$ .
376
+
377
+ Moreover, although we mainly focus on the case when $u ^ { ( k ) }$ is discrete, we want to emphasize that the analysis performed in Section 6 also covers continuous $u ^ { ( k ) }$ . This hints that a continuous attention mechanism could also be implemented, which might prove to be useful in some applications.
378
+
379
+ Limitations and other comments. The approximations performed in (15) and (18) have implicitly assumed that random variable $W$ following distribution $u ^ { ( \bar { k } ) }$ has bounded moments. For a discrete $u ^ { ( \bar { k } ) }$ with fixed support $\mathbf { T } = \left\{ \mathbf { t } _ { 1 } , \mathbf { t } _ { 2 } , \ldots \mathbf { t } _ { n } \right\}$ , all the moments are bounded and we can always pick a small enough $\alpha$ (or equivalently large enough scaling factor $\tau$ in $\mathrm { C o r 1 }$ ) to make the approximation meet our requirements. A concern may arise as the support $\mathbf { T }$ in our running examples are supplied by some neural layers, which could output templates of increasing norms as the training evolves. This problem could be alleviated by adding norm regularization or using normalized templates instead.
380
+
381
+ # 313 8 Conclusion
382
+
383
+ 314 This paper presented a new perspective to understand the attention mechanism by showing that it can
384
+ 315 be treated as realizing a solver of a family of inference tasks. These tasks involve improving the noisy
385
+ 316 estimate of a distribution $p$ ’s mean by a preference distribution that encodes some beliefs of $p$ ’s value.
386
+ 317 We have used three running examples with the typical model architectures to show that such tasks
387
+ 318 naturally exist in neural network design. We then abstracted a convex optimization problem from
388
+ 319 these tasks and derived a closed-form approximation of the optimal solution by solving the problem’s
389
+ 320 Fenchel dual. We find that the closed-form approximation can be seen as a generalized attention
390
+ 321 layer and show that one of its special cases is equivalent to the dot-product attention adopted in
391
+ 322 transformers. We further performed an analysis on the general form and showed that T5 transformer
392
+ 323 implicitly adopts the generalized attention structure with attention weights unifying the concepts of
393
+ 324 the word masks and the positional encoding functions.
394
+ 325 This paper is the first work that presents a principled justification for the design of attention modules
395
+ 326 in neural networks. The generalized attention structure presented in this paper potentially opens a door
396
+ 327 to a wide design space. For example, the preference weights need not be derived from the positional
397
+ 328 encoding functions; they could integrate a variety of information provided by other components of
398
+ 329 the network. Additionally, this research might have pointed to new ways to analyze the functioning
399
+ 330 of a neural network component, namely, via isolating the component from the complex network
400
+ 331 structure and asking: is there a “local problem” that is solved by the design of this component?
401
+
402
+ Potential negative societal impacts. This paper presents a new perspective to understand attention and derived a generalized attention structure. Our work is foundational, which we believe does not have direct negative societal impacts. Due to the very wide range of applications of attention, such as self-driving [12] and healthcare [16], our work may have unexpected negative impacts on these areas.
403
+
404
+ 336 References [1] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural Machine Translation by Jointly Learning to Align and Translate. In ICLR 2015, pages 1–15, 2014. [2] J. M. Borwein and A. S. Lewis. Partially finite convex programming, part i: Quasi relative interiors and duality theory. Mathematical Programming, 57(1):15–48, 1992. [3] Gino Brunner, Yang Liu, Damián Pascual, Oliver Richter, Massimiliano Ciaramita, and Roger Wattenhofer. On Identifiability in Transformers. In International Conference on Learning Representations (ICLR), 2019. [4] Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. What Does BERT Look at? An Analysis of BERT’s Attention. arXiv preprint arXiv:1906.04341, 2019. [5] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. [6] Fabrice Gamboa. Methode du maximum d’entropie sur la moyenne et applications. Phd Thesis, 1989. [7] Michael Hahn. Theoretical Limitations of Self-Attention in Neural Sequence Models. Transactions of the Association for Computational Linguistics, 8:156–171, 2020. [8] Jiri Hron, Yasaman Bahri, and Jascha Sohl-dickstein Roman. Infinite attention $:$ NNGP and NTK for deep attention networks. In International Conference on Machine Learning (ICML), 2020. [9] Sarthak Jain and Byron C. Wallace. Attention is not Explanation. In Annual Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), 2019. [10] E. T. Jaynes. Information theory and statistical mechanics. Phys. Rev., 106:620–630, May 1957. [11] E. T. Jaynes. Information theory and statistical mechanics. ii. Phys. Rev., 108:171–190, Oct 1957. [12] Jinkyu Kim and John Canny. Interpretable learning for self-driving cars by visualizing causal attention. In 2017 IEEE International Conference on Computer Vision (ICCV), pages 2961– 2969, 2017.
405
+ 367 [13] Jaehoon Lee, Jascha Sohl-dickstein, Jeffrey Pennington, Roman Novak, Sam Schoenholz, and Yasaman Bahri. Deep neural networks as gaussian processes. In International Conference on Learning Representations (ICLR), 2018.
406
+ 370 [14] Haoye Lu, Yongyi Mao, and Amiya Nayak. On the dynamics of training attention models. In International Conference on Learning Representations, 2021. [15] Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1412–1421, Lisbon, Portugal, September 2015. Association for Computational Linguistics. [16] Fenglong Ma, Radha Chitta, Jing Zhou, Quanzeng You, Tong Sun, and Jing Gao. Dipole: Diagnosis prediction in healthcare via attention-based bidirectional recurrent neural networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’17, page 1903–1911, New York, NY, USA, 2017. Association for Computing Machinery. [17] P. McCullagh. Tensor Methods in Statistics : Monographs on Statistics and Applied Probability. Chapman and Hall/CRC, Boca Raton, FL, first edition. edition, 1987.
407
+
408
+ [18] Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? In Neural Information Processing Systems (NIPS), volume 32. Curran Associates, Inc., 2019. [19] 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. Journal of Machine Learning Research, 21(140):1–67, 2020. [20] Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Lukas Gruber, Markus Holzleitner, Thomas Adler, David Kreil, Michael K Kopp, Günter Klambauer, Johannes Brandstetter, and Sepp Hochreiter. Hopfield networks is all you need. In International Conference on Learning Representations, 2021. [21] Gabriel Rioux, Rustum Choksi, Tim Hoheisel, Pierre Marechal, and Christopher Scarvelis. The maximum entropy on the mean method for image deblurring. Inverse Problems, oct 2020. [22] R. Tyrrell Rockafellar. Convex analysis. Princeton mathematical series ; 28. Princeton University Press, Princeton, N.J, 1970. [23] Sofia Serrano and Noah A. Smith. Is attention interpretable? In Annual Meeting of the Association for Computational Linguistics (ACL), 2020. [24] Shikhar Vashishth, Shyam Upadhyay, Gaurav Singh Tomar, and Manaal Faruqui. Attention Interpretability Across NLP Tasks. In International Conference on Learning Representations (ICLR), 2020. [25] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. [26] Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, July 2019. [27] Yequan Wang, Minlie Huang, Xiaoyan Zhu, and Li Zhao. Attention-based LSTM for aspectlevel sentiment classification. In Empirical Methods in Natural Language Processing (EMNLP), pages 606–615, Austin, Texas, November 2016. Association for Computational Linguistics. [28] Sarah Wiegreffe and Yuval Pinter. Attention is not not explanation. In 2019 Conference on Empirical Methods in Natural Language Processing and 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 2019. [29] K. Xu, J. Ba, R. Kiros, K. Cho, A. Courville, R. Salakhudinov, R. Zemel, and Y. Bengio. Show, Attend and Tell: Neural Image Caption Generation with Visual Attention. In Proc. 32nd Int. Conf. Mach. Learn., pages 257–261, 2015. 17 [30] Greg Yang. Tensor Programs I : Wide Feedforward or Recurrent Neural Networks of Any Architecture are Gaussian Processes. In Neural Information Processing Systems (NIPS), 2019.
409
+
410
+ # Checklist
411
+
412
+ 1. For all authors...
413
+
414
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
415
+ (b) Did you describe the limitations of your work? [Yes] We have created a sub-section, called Limitations and other comments, in Section 7 to discuss the potential limitations of our work.
416
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] We have discussed this at the end of the paper.
417
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
418
+
419
+ 2. If you are including theoretical results...
420
+
421
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
422
+
423
+ 3. If you ran experiments...
424
+
425
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A] Our work presents a theoretical framework and does not contain any experimental study.
426
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A]
427
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
428
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A]
429
+
430
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
431
+
432
+ (a) If your work uses existing assets, did you cite the creators? [N/A]
433
+ (b) Did you mention the license of the assets? [N/A]
434
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
435
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
436
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
437
+
438
+ 5. If you used crowdsourcing or conducted research with human subjects...
439
+
440
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
441
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
442
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
parse/train/4-gBZAkF9ze/4-gBZAkF9ze_content_list.json ADDED
@@ -0,0 +1,1500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Attention as Inference via Fenchel Duality ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 243,
8
+ 122,
9
+ 754,
10
+ 147
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous Author(s) \nAffiliation \nAddress \nemail ",
17
+ "bbox": [
18
+ 423,
19
+ 200,
20
+ 580,
21
+ 256
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Abstract ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 462,
31
+ 292,
32
+ 535,
33
+ 309
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Attention has been widely adopted in many state-of-the-art deep learning models. While the significant performance improvements it brings have attracted great interest, attention is still poorly understood theoretically. This paper presents a new perspective to understand attention by showing that it can be seen as a solver of a family of estimation problems. In particular, we describe a convex optimization problem that arises in a family of estimation tasks commonly appearing in the design of deep learning models. Rather than directly solving the convex optimization problem, we solve its Fenchel dual and derive a closed-form approximation of the optimal solution. Remarkably, the solution gives a generalized attention structure, and its special case is equivalent to the popular dot-product attention adopted in transformer networks. We show that T5 transformer has implicitly adopted the general form of the solution by demonstrating that this expression unifies the word mask and the positional encoding functions. Finally, we discuss how the proposed attention structures can be integrated in practical models. ",
40
+ "bbox": [
41
+ 148,
42
+ 330,
43
+ 766,
44
+ 525
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "15 1 Introduction ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 148,
54
+ 565,
55
+ 312,
56
+ 582
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "16 Attention-based deep neural networks are now integrated into cutting-edge language models that \n17 have revolutionized a broad range of tasks: machine translation [1, 15], sentiment classification [27], \n18 image captioning [29] and unsupervised representation learning [5], etc. Especially, attention plays a \n19 pivotal role in the construction of the transformer architecture [25], which has had a profound impact \n20 on the deep learning field. \n21 Despite great empirical success, the driving principles of attention are still poorly understood. This \n22 lack of understanding impedes practitioners from confidently and appropriately using attention layers \n23 and makes it challenging to develop new attention-based neural architectures. \n24 In this paper, we offer a new perspective for understanding attention by showing that it is in fact \n25 a solver for a certain type of optimization problem that corresponds to an inference task. We give \n26 several examples, all of which can be characterized as follows: given 1) an unreliable estimate of \n27 the mean of an unknown distribution $p$ on $\\mathbb { R } ^ { d }$ and 2) a preference distribution $u$ on $\\mathbb { R } ^ { d }$ encoding \n28 beliefs on $p$ ’s selection, the inference task is to get a better estimate of $p$ ’s mean given its unreliable \n29 estimate and $u$ . We derive a convex optimization problem that is abstracted from the task and solve it \n30 by instead solving its Fenchel dual [22, p.104]. Remarkably, the derived expression of the improved \n31 estimate of $p$ gives a generalized attention structure whose special case is equivalent to the popular \n32 dot-product attention [15] that is also applied in the transformer network [25]. In addition, we show \n33 that our generalized attention expression has been implicitly adopted by T5 transformer [19] as the \n34 expression unifies the concept of word masks and its positional encoding functions. Extra examples \n35 are given to show how the generalized attention structures can be used in practice. \n37 Since 2019, several authors have investigated the properties and working mechanism of attention. \n38 This series of works mainly addresses whether the attention mechanism can serve as a proxy of \n39 saliency [9, 18, 23, 24, 26, 28]. Most of these works obtain insights into the attention mechanism \n40 by performing empirical studies. The related methods include analyzing the behaviours of trained \n41 attention-based networks [4], or pruning a few heads, or analyzing the effects of altering the attention \n42 weights [18, 26], or a mixture of these [9, 24]. \n43 Apart from understanding attention empirically, some theoretical results presented by Brunner el \n44 al. [3] and Hahn [7] show that the self-attention layers are not identifiable. This implies there could \n45 exist multiple combinations of attention weights that can provide equally good final predictions. \n46 In particular, such non-uniqueness means that the use of attention may complicate interpretability. \n47 Another important approach to understand attention is to analyze its asymptotic behaviour when \n48 the number of heads and the network width approach infinity [8, 30]. In this limiting case, the \n49 entire network can be seen as a Gaussian process [13] and its behaviours can be characterized by \n50 closed-form expressions that are not available in the finite case. \n51 Very recently (since 2021) several theoretical works have appeared that study attention outside the \n52 asymptotic regime. Lu et al. [14] set up a simple attention-based classification model and derive a \n53 closed-form relationship between the word’s embedding norm and the product of its key and the \n54 query. They empirically show that such relationship also exists in a more complicated and practical \n55 configuration. Ramsauer et al. [20] construct an equivalence relationship between attention and \n56 a newly proposed Hopfield network with continuous states. In particular, they show that the new \n57 Hopfield network’s update rule is equivalent to the attention mechanism used in transformers [25]. ",
63
+ "bbox": [
64
+ 148,
65
+ 602,
66
+ 825,
67
+ 671
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "",
74
+ "bbox": [
75
+ 150,
76
+ 678,
77
+ 825,
78
+ 719
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "",
85
+ "bbox": [
86
+ 147,
87
+ 727,
88
+ 825,
89
+ 892
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "",
96
+ "bbox": [
97
+ 147,
98
+ 121,
99
+ 825,
100
+ 204
101
+ ],
102
+ "page_idx": 1
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "",
107
+ "bbox": [
108
+ 145,
109
+ 209,
110
+ 825,
111
+ 321
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "",
118
+ "bbox": [
119
+ 147,
120
+ 327,
121
+ 825,
122
+ 424
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "58 3 A Motivating Example ",
129
+ "text_level": 1,
130
+ "bbox": [
131
+ 153,
132
+ 443,
133
+ 395,
134
+ 460
135
+ ],
136
+ "page_idx": 1
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "59 We first consider a seemingly unrelated example, to illustrate the key ingredients of this paper. ",
141
+ "bbox": [
142
+ 156,
143
+ 474,
144
+ 789,
145
+ 489
146
+ ],
147
+ "page_idx": 1
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "60 Assume a probability distribution $p$ on $\\mathbb { R } ^ { d }$ has a spherical Gaussian prior $u \\sim \\mathcal N ( \\mu , I _ { d } )$ . Let $h _ { p }$ \n61 denote the mean of the unknown $p$ . Given an unreliable observation $b$ of $h _ { p }$ , what is the best guess \n62 of $h _ { p }$ ? To solve this problem, we may formulate the following optimization problem ",
152
+ "bbox": [
153
+ 147,
154
+ 494,
155
+ 825,
156
+ 537
157
+ ],
158
+ "page_idx": 1
159
+ },
160
+ {
161
+ "type": "equation",
162
+ "img_path": "images/9255d457e86a94ef9ef6ac5a4dc3d1b08b439d574cf7363f22ae390454dd1f92.jpg",
163
+ "text": "$$\np ^ { * } = \\arg \\operatorname* { m i n } _ { p } \\frac { \\alpha } { 2 } \\left\\| b - \\int \\mathbf { a } p ( \\mathbf { a } ) \\ \\mathrm { d } \\mathbf { a } \\right\\| ^ { 2 } + K ( p , u ) ,\n$$",
164
+ "text_format": "latex",
165
+ "bbox": [
166
+ 338,
167
+ 545,
168
+ 658,
169
+ 583
170
+ ],
171
+ "page_idx": 1
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "63 with $\\alpha > 0$ responsible for the relative strength of the two terms, where $\\kappa ( p , u )$ denotes the KL \n64 divergence between $p$ and $u$ . The basic idea behind (1) is that: although $b$ is not reliable, it should \n65 not be too far from $\\begin{array} { r } { \\bar { h } _ { p } = \\int \\mathbf { a } p ( \\mathbf { a } ) } \\end{array}$ da. Also, as $u$ encodes the preferred value of $p$ , we add the \n66 KL divergence term to show preference for $p$ that is close to $u$ . As will be discussed later, such a \n67 formulation can be either obtained from the maximum likelihood principle or from the maximum \n68 entropy principle [10, 11]. In particular, Rioux et al [21] develop (1) for image de-blurring by applying \n69 Maximum Entropy on the Mean (MEM), an information-theoretic method due to Gamboa [6] but not \n70 yet widely known in machine learning. ",
176
+ "bbox": [
177
+ 145,
178
+ 588,
179
+ 825,
180
+ 700
181
+ ],
182
+ "page_idx": 1
183
+ },
184
+ {
185
+ "type": "text",
186
+ "text": "After obtaining the minimizer 71 $p ^ { * }$ of (1), its mean $\\int { \\bf a } p ^ { * } ( { \\bf a } )$ da gives our estimate of $h _ { p }$ . Rioux et al. [21] prove, via Fenchel duality [22, p.104] that the minimizer 72 $p ^ { * }$ takes the form ",
187
+ "bbox": [
188
+ 151,
189
+ 705,
190
+ 823,
191
+ 734
192
+ ],
193
+ "page_idx": 1
194
+ },
195
+ {
196
+ "type": "equation",
197
+ "img_path": "images/7a119a0aad8715b96f7f4b89ba3f4c1c55c6d105461ced6e1511720ff65195ab.jpg",
198
+ "text": "$$\np ^ { * } ( \\mathbf { a } ) = \\frac { u ( \\mathbf { a } ) \\exp \\langle \\mathbf { a } , \\lambda ^ { * } \\rangle } { \\int u ( \\mathbf { a } ^ { \\prime } ) \\exp \\langle \\mathbf { a } ^ { \\prime } , \\lambda ^ { * } \\rangle \\ \\mathbf { d } \\mathbf { a } ^ { \\prime } } ,\n$$",
199
+ "text_format": "latex",
200
+ "bbox": [
201
+ 385,
202
+ 739,
203
+ 611,
204
+ 775
205
+ ],
206
+ "page_idx": 1
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "73 where ",
211
+ "bbox": [
212
+ 147,
213
+ 782,
214
+ 215,
215
+ 795
216
+ ],
217
+ "page_idx": 1
218
+ },
219
+ {
220
+ "type": "equation",
221
+ "img_path": "images/93032beeef5732c7f1e4b27edc878208ae406954c9e804e32d1a65141961027b.jpg",
222
+ "text": "$$\n\\lambda ^ { * } = \\arg \\operatorname* { m a x } _ { \\lambda \\in \\mathbb { R } ^ { d } } \\langle b , \\lambda \\rangle - \\frac { 1 } { 2 \\alpha } \\left\\| \\lambda \\right\\| ^ { 2 } - \\log \\int _ { \\mathbb { R } ^ { d } } u ( \\mathbf { a } ) \\exp \\langle \\mathbf { a } , \\lambda \\rangle \\ \\mathrm { d } \\mathbf { a } .\n$$",
223
+ "text_format": "latex",
224
+ "bbox": [
225
+ 292,
226
+ 791,
227
+ 702,
228
+ 824
229
+ ],
230
+ "page_idx": 1
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "74 Note that $\\begin{array} { r } { \\int _ { \\mathbb { R } ^ { d } } u ( { \\mathbf { a } } ) \\exp \\langle { \\mathbf { a } } , \\lambda \\rangle \\mathrm { d } { \\mathbf { a } } = \\exp ( \\langle \\mu , \\lambda \\rangle + \\frac { 1 } { 2 } \\left\\| \\lambda \\right\\| ^ { 2 } ) } \\end{array}$ as it is the moment generating function \n75 (MGF) of $u \\sim \\mathcal N ( \\mu , I _ { d } )$ . Substituting the expression into (3) followed by setting the derivative with \n76 respect to $\\lambda$ to zero yields $\\begin{array} { r } { \\lambda ^ { * } = \\frac { \\alpha } { \\alpha + 1 } ( b - \\mu ) } \\end{array}$ . By (2), $p ^ { * } ( \\mathbf { a } ) \\propto \\exp ( - \\frac { 1 } { 2 } \\left\\| \\mathbf { a } - \\boldsymbol { \\mu } \\right\\| ^ { 2 } + \\langle \\mathbf { a } , \\lambda ^ { * } \\rangle ) \\propto$ \n77 $\\begin{array} { r } { \\exp ( - \\frac { 1 } { 2 } \\left\\| \\mathbf { a } - ( \\mu + \\lambda ^ { * } ) \\right\\| ^ { 2 } ) } \\end{array}$ . Substituting $\\begin{array} { r } { \\lambda ^ { * } = \\frac { \\alpha } { \\alpha + 1 } ( b - \\mu ) } \\end{array}$ into it implies that $p ^ { * }$ follows a Gaussian \n78 2distribution $\\begin{array} { r } { \\mathcal { N } ( \\frac { 1 } { 1 + \\alpha } \\mu + \\frac { \\alpha } { 1 + \\alpha } b , I _ { d } ) } \\end{array}$ α+1 . Thus, our estimate of $h _ { p }$ is $\\textstyle { \\frac { 1 } { 1 + \\alpha } } \\mu + { \\frac { \\alpha } { 1 + \\alpha } } b$ . \n79 In this paper, we focus on a similar optimization problem that estimates $h _ { p }$ assuming that $u$ is instead \n80 a discrete distribution. We show that such optimization problems naturally and frequently arise in \n81 neural network designs. By solving the optimization problem, we derive a closed-form approximation \n82 for the estimate of $h _ { p }$ , via Fenchel duality. The approximation then gives a generalized attention layer \n83 structure as shown in Fig 1. A special case of it is equivalent to the familiar dot-product attention [15] \n84 that is also adopted in transformers [25]. Moreover, we will show that T5 transformer [19] implicitly \n85 adopts our generalized attention expression. ",
235
+ "bbox": [
236
+ 147,
237
+ 827,
238
+ 825,
239
+ 915
240
+ ],
241
+ "page_idx": 1
242
+ },
243
+ {
244
+ "type": "text",
245
+ "text": "",
246
+ "bbox": [
247
+ 145,
248
+ 90,
249
+ 825,
250
+ 189
251
+ ],
252
+ "page_idx": 2
253
+ },
254
+ {
255
+ "type": "text",
256
+ "text": "86 4 Setup of a Design Problem ",
257
+ "text_level": 1,
258
+ "bbox": [
259
+ 151,
260
+ 207,
261
+ 428,
262
+ 224
263
+ ],
264
+ "page_idx": 2
265
+ },
266
+ {
267
+ "type": "text",
268
+ "text": "Throughout the rest of the paper, we consider a machine learning problem in which the objective is to predict an output quantity $Y$ from a given input $X$ . Additionally, $Y$ may include $K$ components, namely, be expressed as $( Y ^ { ( 1 ) } , Y ^ { ( 2 ) } , . . . , Y ^ { ( \\bar { K } ) } )$ . To be more concrete, we present a few example machine learning problems and let them run through our development. ",
269
+ "bbox": [
270
+ 163,
271
+ 237,
272
+ 433,
273
+ 376
274
+ ],
275
+ "page_idx": 2
276
+ },
277
+ {
278
+ "type": "text",
279
+ "text": "Example: Translation Problem. In this problem, the input $X$ is a sentence, or a sequence of words, in the source language, and output $Y$ is the sequence of words in the target sentence, where $Y ^ { ( k ) }$ denotes the $k ^ { \\mathrm { t h } }$ word. ",
280
+ "bbox": [
281
+ 173,
282
+ 383,
283
+ 433,
284
+ 467
285
+ ],
286
+ "page_idx": 2
287
+ },
288
+ {
289
+ "type": "image",
290
+ "img_path": "images/1444bafeff68bac9e0d97ac7396815a8edbe11c0d8d54f9e32bebb087ee58b51.jpg",
291
+ "image_caption": [
292
+ "Figure 1: A conceptual graph of the deep learning model that we work with. The block $g ^ { ( k ) }$ is the one we will investigate. "
293
+ ],
294
+ "image_footnote": [],
295
+ "bbox": [
296
+ 447,
297
+ 236,
298
+ 821,
299
+ 411
300
+ ],
301
+ "page_idx": 2
302
+ },
303
+ {
304
+ "type": "text",
305
+ "text": "Example: Image Captioning. In this problem, the input $X$ is a raw image and output $Y$ is the sequence of words in the caption, where $\\dot { Y } ^ { ( k ) }$ denotes the $k ^ { \\mathrm { t h } }$ word. ",
306
+ "bbox": [
307
+ 166,
308
+ 473,
309
+ 821,
310
+ 503
311
+ ],
312
+ "page_idx": 2
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "Example: Filling in the blanks task. This task has been used to train the BERT model [5]. The input $X$ is a sequence of words with certain percentage of words masked. The output $Y$ are the predicted masked words, where $Y ^ { ( k ) }$ denotes the $k ^ { \\mathrm { t h } }$ masked one. ",
317
+ "bbox": [
318
+ 171,
319
+ 508,
320
+ 825,
321
+ 553
322
+ ],
323
+ "page_idx": 2
324
+ },
325
+ {
326
+ "type": "text",
327
+ "text": "108 The objective of any of these problems and that we address in this paper is to learn a function $F$ , \n109 mapping from the space of $X$ to the space of $Y$ so that $Y = F ( X )$ . We will denote by $F ^ { ( k ) }$ the part \n110 of $F$ responsible for predicting $Y ^ { ( k ) }$ (Fig 1a), namely, $Y ^ { ( k ) } = F ^ { ( k ) } ( X )$ . Although we here express \n111 $F$ as separate functions $( F ^ { ( 1 ) } , F ^ { ( 2 ) } , \\dots , F ^ { ( K ) } )$ , we note that it is in fact possible that different $F ^ { ( k ) }$ ’s \n112 share some component in common. We now focus on the design of $F ^ { ( k ) }$ . ",
328
+ "bbox": [
329
+ 145,
330
+ 559,
331
+ 825,
332
+ 636
333
+ ],
334
+ "page_idx": 2
335
+ },
336
+ {
337
+ "type": "text",
338
+ "text": "We restrict the architectur113 The extraction of feature 114 $F ^ { ( k ) }$ to the form in Fig 1b wa two parallel modules e mand cus on the inference of that directly operate o $h ^ { ( k ) }$ . $h ^ { ( k ) }$ $f _ { \\mathrm { e v d } } ^ { ( k ) }$ f (k) \n115 input followed by a function $g ^ { ( k ) }$ (in Fig 1c), which we will design. ",
339
+ "bbox": [
340
+ 145,
341
+ 642,
342
+ 826,
343
+ 694
344
+ ],
345
+ "page_idx": 2
346
+ },
347
+ {
348
+ "type": "text",
349
+ "text": "116 The Design Problem We describe the problem of designing $g$ as follows. ",
350
+ "bbox": [
351
+ 145,
352
+ 705,
353
+ 676,
354
+ 722
355
+ ],
356
+ "page_idx": 2
357
+ },
358
+ {
359
+ "type": "text",
360
+ "text": "Suppose that there is an unknown distribution 117 $p ^ { ( k ) }$ on $\\mathbb { R } ^ { d }$ whose mean vector is $h ^ { ( k ) }$ , namely, ",
361
+ "bbox": [
362
+ 147,
363
+ 727,
364
+ 781,
365
+ 742
366
+ ],
367
+ "page_idx": 2
368
+ },
369
+ {
370
+ "type": "equation",
371
+ "img_path": "images/357e7fec9becbf4e8d9d69a3d286b6ab883a9a50a270612e2007b6e16df7eeec.jpg",
372
+ "text": "$$\nh ^ { ( k ) } = \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } p ^ { ( k ) } ( \\mathbf { a } ) \\ \\mathrm { d } \\mathbf { a } .\n$$",
373
+ "text_format": "latex",
374
+ "bbox": [
375
+ 416,
376
+ 744,
377
+ 581,
378
+ 776
379
+ ],
380
+ "page_idx": 2
381
+ },
382
+ {
383
+ "type": "text",
384
+ "text": "118 Let $u ^ { ( k ) }$ be another distribution on $\\mathbb { R } ^ { d }$ that is generated as the output of a network module $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ . Here \n119 $u ^ { ( k ) }$ is referred to as the preference distribution, which serves as a prior guess of $p ^ { ( k ) }$ . Specifically \n120 121 $u ^ { ( k ) }$ puts non-zero probabilitabilities are respectively $M$ mplate” vectors (which sum to $\\mathbf { t } _ { 1 } ^ { ( k ) } , \\mathbf { t } _ { 2 } ^ { ( k ) } , \\dots , \\mathbf { t } _ { M } ^ { ( k ) }$ in $\\mathrm { R } ^ { d }$ , and their \n$u _ { 1 } ^ { ( k ) } , u _ { 2 } ^ { ( k ) } , \\dots , u _ { M } ^ { ( k ) }$ 1). Collectively, we will denote the \n122 set {t(k)1 , $\\{ \\mathbf { t } _ { 1 } ^ { ( k ) } , \\mathbf { t } _ { 2 } ^ { ( k ) } , \\dots , \\mathbf { t } _ { M } ^ { ( k ) } \\}$ of templates by $\\mathbf { T } ^ { ( k ) }$ . ",
385
+ "bbox": [
386
+ 140,
387
+ 785,
388
+ 825,
389
+ 875
390
+ ],
391
+ "page_idx": 2
392
+ },
393
+ {
394
+ "type": "text",
395
+ "text": "The preference distribution 123 $u ^ { ( k ) }$ is considered as a good approximation of $p ^ { ( k ) }$ , in the sense that the support of 124 $p ^ { ( k ) }$ is contained in the set $\\mathbf { T } ^ { ( k ) }$ of templates. Note that if $\\mathbb { R } ^ { d }$ is the word embedding space for a large vocabulary, and if the size 125 $M$ of the template set $\\mathbf { T } ^ { ( k ) }$ is relative small, then restricting the support of 126 $p ^ { ( k ) }$ to within $\\mathbf { T } ^ { ( k ) }$ imposes a strong constraint on $p ^ { ( k ) }$ . ",
396
+ "bbox": [
397
+ 145,
398
+ 881,
399
+ 825,
400
+ 912
401
+ ],
402
+ "page_idx": 2
403
+ },
404
+ {
405
+ "type": "image",
406
+ "img_path": "images/675661f9a44ea28e9f1faa371132854800f42f6fcb4c24e8ef6a86bef3b48900.jpg",
407
+ "image_caption": [
408
+ "Figure 2: The model architectures of the three running examples. For the $f _ { \\mathrm { e v d } } ^ { ( k ) }$ in (a) and (b), the dashed links exist throughout the training and are replaced by the dotted ones in the generation stage. "
409
+ ],
410
+ "image_footnote": [],
411
+ "bbox": [
412
+ 189,
413
+ 89,
414
+ 808,
415
+ 381
416
+ ],
417
+ "page_idx": 3
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "",
422
+ "bbox": [
423
+ 145,
424
+ 445,
425
+ 825,
426
+ 477
427
+ ],
428
+ "page_idx": 3
429
+ },
430
+ {
431
+ "type": "text",
432
+ "text": "127 On the other hand, $u ^ { ( k ) }$ is not a sufficiently accurate approximation of $p ^ { ( k ) }$ , in the sense that $u ^ { ( k ) }$ may \n128 assign probabilities to $\\mathbf { T } ^ { ( k ) }$ somewhat differently. Such inaccuracy shifts the mean $\\mu ^ { ( k ) }$ of $u ^ { ( k ) }$ from \n129 the mean $h ^ { ( k ) }$ of $p ^ { ( k ) }$ . Suppose that there is another piece of information $z ^ { ( k ) } \\in \\mathbb { R } ^ { \\dot { d } }$ that is generated \n130 by another network module $f _ { \\mathrm { e v d } } ^ { ( k ) }$ and provides information regarding the mean shift. In particular, we \n131 assume that $z ^ { ( k ) }$ is a noisy version of the shift, more precisely, ",
433
+ "bbox": [
434
+ 142,
435
+ 483,
436
+ 825,
437
+ 563
438
+ ],
439
+ "page_idx": 3
440
+ },
441
+ {
442
+ "type": "equation",
443
+ "img_path": "images/0369a0cbcff6c1cb3bf9496af618bad6f2d070252d2655929e97327d2b28195b.jpg",
444
+ "text": "$$\nz ^ { ( k ) } = h ^ { ( k ) } - \\mu ^ { ( k ) } + \\epsilon ,\n$$",
445
+ "text_format": "latex",
446
+ "bbox": [
447
+ 419,
448
+ 568,
449
+ 576,
450
+ 587
451
+ ],
452
+ "page_idx": 3
453
+ },
454
+ {
455
+ "type": "text",
456
+ "text": "where 132 $\\boldsymbol \\epsilon \\sim \\mathcal { N } ( \\mathbf 0 , \\sigma ^ { 2 } \\mathbf I )$ is the spherical Gaussian noise in $\\mathbb { R } ^ { d }$ with covariance $\\sigma ^ { 2 } \\mathbf { I }$ . We refer to $z ^ { ( k ) }$ as 133 the evidence. ",
457
+ "bbox": [
458
+ 151,
459
+ 592,
460
+ 825,
461
+ 622
462
+ ],
463
+ "page_idx": 3
464
+ },
465
+ {
466
+ "type": "text",
467
+ "text": "134 Then the design problem is to construct a function, or a network block, $g$ , which infers the unknown distribution 135 $p ^ { ( k ) }$ and hence its mean $h ^ { ( k ) }$ based on the evidence $z ^ { ( k ) }$ and the preference distribution 136 $u ^ { ( k ) }$ . ",
468
+ "bbox": [
469
+ 148,
470
+ 626,
471
+ 826,
472
+ 670
473
+ ],
474
+ "page_idx": 3
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "137 This formulation of the design problem might seem peculiar at the first glance, but we will show \n38 via examples (see Fig 2) that such a problem naturally arises in the construction of many machine \n39 learning models in practice. ",
479
+ "bbox": [
480
+ 151,
481
+ 676,
482
+ 826,
483
+ 718
484
+ ],
485
+ "page_idx": 3
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "Example: Translation Problem. For the translation problem, consider the model implementation plotted in Fig 2a that is similar to the one proposed in [1]. We will focus on the part of the model responsible for inferring the $k ^ { \\mathrm { t h } }$ word of the target sentence. In this model, $h ^ { ( k ) }$ corresponds to the constructed feature according to (4) that serves as an estimate of the context vector collecting the source sentence information. The estimated $h ^ { ( k ) }$ is then fed into a classifier $f _ { \\mathrm { o u t } } ^ { ( k ) }$ to predict the $k ^ { \\mathrm { t h } }$ word. The preference distribution $u ^ { ( k ) }$ is generated by $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ which takes the source sentence words as inputs. In particular, the support of $u ^ { ( k ) }$ consists of the source sentence word embeddings $\\mathbf { T }$ (called annotations in [1]) which are pre-processed by two LSTM layers.1 The preference weight for each template depends on some positional encoding functions, which, in principle, should assign higher ",
490
+ "bbox": [
491
+ 169,
492
+ 724,
493
+ 825,
494
+ 863
495
+ ],
496
+ "page_idx": 3
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "49 weights to the templates appearing in the similar locations to the words we are inferring (that is, $h ^ { ( k ) }$ \n50 is assumed to rely on the templates near $\\mathbf { t } _ { k }$ more heavily). \n151 Note that the inferred $p ^ { ( k ) }$ ’s support must be a subset of $u ^ { ( k ) }$ ’s as it is reasonable to assume that the \n152 target sentence words only depend on those appearing in the source sentence. Besides, although \n153 the preference weights specified by the positional encoding functions could provide some a priori \n154 information for the templates’ weights in $p ^ { ( k ) }$ , they cannot be accurate as their inferences do not \n155 consider the previously generated words $Y ^ { ( i < t ) }$ . This results in the mean $\\mu ^ { ( k ) }$ shifted from $h ^ { ( k ) }$ , \n156 which is estimated by z(k) = f (k)evd t hat takes all the previously generated words $Y ^ { ( i < t ) }$ into account \n157 using another LSTM layer. Thus, $h ^ { ( k ) }$ and $p ^ { ( k ) }$ should not be far from $z ^ { ( k ) } + \\mu ^ { ( k ) }$ and $u ^ { ( k ) }$ , \n158 respectively. \n159 Example: Image Captioning. The caption generation modelarchitecture reported in [29]. This model shares the designs of 160 $\\bar { f } _ { \\mathrm { e v d } } ^ { ( k ) }$ enteand $ { f _ { \\mathrm { o u t } } ^ { ( k ) } }$ Fig 2b has a similarwith the translation \n161 model while $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ instead extracts the templates from a raw image using a CNN network. In general, \n162 a word’s position in the caption is independent of the location of the object it describes in the image. \n163 Therefore, in this model, all templates extracted by the CNN share the same preference weight. \n164 As similar objects appear in an image would have similar features extracted by the CNN (for example, \n165 a zebra and a horse), allowing similar templates not in $\\mathbf { T }$ to participate in $\\bar { h } ^ { ( k ) }$ ’s estimation would \n166 possibly mix in information not contained in the raw image and harm the word inference accuracy. \n167 Therefore, we could improve the estimate of $h ^ { ( k ) }$ by choosing $p ^ { ( k ) }$ similar to $u ^ { ( k ) }$ in the sense that \n168 $p ^ { ( k ) }$ ’s support cannot contain elements not in $u ^ { ( k ) }$ ’s. \n169 Intuitively, as the generation process proceeds, the context $h ^ { ( k ) }$ should be updated to provide relevant \n170 information in the image to facilitate the next word inference. Such change is governed by the \n171 caption’s semantic evolution, which is captured by $z ^ { ( k ) } = f _ { \\mathrm { e v d } } ^ { ( k ) }$ that predicts the shift of the mean \n172 $\\mu ^ { ( k ) }$ from . For this reason, $\\mu ^ { ( k ) } + z ^ { ( k ) }$ serves as an estimate of $h ^ { ( k ) }$ and should not be far away \n173 from it. Likewise, $u ^ { k }$ should be close to $p ^ { ( k ) }$ . ",
501
+ "bbox": [
502
+ 150,
503
+ 90,
504
+ 825,
505
+ 119
506
+ ],
507
+ "page_idx": 4
508
+ },
509
+ {
510
+ "type": "text",
511
+ "text": "",
512
+ "bbox": [
513
+ 140,
514
+ 125,
515
+ 825,
516
+ 247
517
+ ],
518
+ "page_idx": 4
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "",
523
+ "bbox": [
524
+ 142,
525
+ 252,
526
+ 826,
527
+ 333
528
+ ],
529
+ "page_idx": 4
530
+ },
531
+ {
532
+ "type": "text",
533
+ "text": "",
534
+ "bbox": [
535
+ 140,
536
+ 338,
537
+ 825,
538
+ 411
539
+ ],
540
+ "page_idx": 4
541
+ },
542
+ {
543
+ "type": "text",
544
+ "text": "",
545
+ "bbox": [
546
+ 142,
547
+ 417,
548
+ 825,
549
+ 496
550
+ ],
551
+ "page_idx": 4
552
+ },
553
+ {
554
+ "type": "text",
555
+ "text": "Example: Filling in the blanks task. For the filling-in-the-blank tasks, let us consider a model architecture plotted in Fig 2c that is similar to the one used in BERT [5]. We focus on the inference of the $k ^ { \\mathrm { t h } }$ masked word, which is assumed to be the $j ^ { t h }$ word of the input sentence. In this model, $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ and $f _ { \\mathrm { e v d } } ^ { ( k ) }$ share the transformation layers (TL) that are commonly used in the NLP tasks to map one sequence of vector representations to another of the same length.2 Taking the output sequence, $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ applies a linear map $V$ to each of its elements to form $\\mathbf { T }$ as the support of $u ^ { ( k ) }$ while the preference weights are specified by some positional encoding functions. At the same time, $z ^ { ( k ) } = f _ { \\mathrm { e v d } } ^ { ( k ) }$ estimates $h ^ { ( k ) }$ ’s shift from the mean $\\mu ^ { ( k ) }$ due to the variation of the local information. For the same reasons discussed in the previous two examples, we need $\\mu ^ { ( k ) } + z ^ { ( k ) }$ close to $h ^ { ( k ) }$ while $p ^ { ( k ) }$ is close to $u ^ { ( k ) }$ . ",
556
+ "bbox": [
557
+ 168,
558
+ 501,
559
+ 825,
560
+ 651
561
+ ],
562
+ "page_idx": 4
563
+ },
564
+ {
565
+ "type": "text",
566
+ "text": "Notably the formulation of the problem is based on the assumption that the network modules f (k)evd and $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ are fixed and generate $z ^ { ( k ) }$ and $u ^ { ( k ) }$ satisfying the above assumed properties. In reality, $f _ { \\mathrm { e v d } } ^ { ( k ) }$ and $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ are in fact obtained via training. However, we argue that if $g$ is made to satisfy our design objective, then we can at least interpret $f _ { \\mathrm { e v d } } ^ { ( k ) }$ and $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ obtained from training as serving to produce and with our desired properties. ",
567
+ "bbox": [
568
+ 171,
569
+ 659,
570
+ 826,
571
+ 751
572
+ ],
573
+ "page_idx": 4
574
+ },
575
+ {
576
+ "type": "text",
577
+ "text": "5 Formulation of an Optimization Problem ",
578
+ "text_level": 1,
579
+ "bbox": [
580
+ 169,
581
+ 768,
582
+ 549,
583
+ 787
584
+ ],
585
+ "page_idx": 4
586
+ },
587
+ {
588
+ "type": "text",
589
+ "text": "The discussion made in the previous section implies that the key optimization problem we are about to focus on should ensure ",
590
+ "bbox": [
591
+ 173,
592
+ 800,
593
+ 823,
594
+ 829
595
+ ],
596
+ "page_idx": 4
597
+ },
598
+ {
599
+ "type": "text",
600
+ "text": "1. $h ^ { ( k ) }$ is not too far from $\\mu ^ { ( k ) } + z ^ { ( k ) }$ , where $h ^ { ( k ) }$ is constructed by $p ^ { ( k ) }$ according to (4) and $\\mu ^ { ( k ) }$ is the mean of the preference distribution $u ^ { ( k ) }$ . 2. $p ^ { ( k ) }$ is close to $u ^ { ( k ) }$ while $p ^ { ( k ) }$ ’s support must be a subset of $u ^ { ( k ) }$ ’s. ",
601
+ "bbox": [
602
+ 210,
603
+ 837,
604
+ 825,
605
+ 890
606
+ ],
607
+ "page_idx": 4
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "2Typical implementation of such layers include convolution layers, recurrent layers and self-attention layers. ",
612
+ "bbox": [
613
+ 187,
614
+ 897,
615
+ 821,
616
+ 912
617
+ ],
618
+ "page_idx": 4
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "194 These two desiderata prompt us to optimize: ",
623
+ "bbox": [
624
+ 143,
625
+ 90,
626
+ 465,
627
+ 106
628
+ ],
629
+ "page_idx": 5
630
+ },
631
+ {
632
+ "type": "equation",
633
+ "img_path": "images/001929eb04960c50efa1c68cf2824781303e0aa4f6cc09ddb55069df583e0bdb.jpg",
634
+ "text": "$$\n\\operatorname* { m i n } _ { p } \\frac { \\alpha } { 2 } \\left\\| \\left( \\mu ^ { ( k ) } + z ^ { ( k ) } \\right) - \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } p ( \\mathbf { a } ) \\ \\mathrm { d } \\mathbf { a } \\right\\| ^ { 2 } + \\mathcal { K } ( p , u ^ { ( k ) } )\n$$",
635
+ "text_format": "latex",
636
+ "bbox": [
637
+ 313,
638
+ 109,
639
+ 683,
640
+ 147
641
+ ],
642
+ "page_idx": 5
643
+ },
644
+ {
645
+ "type": "text",
646
+ "text": "195 with $\\alpha > 0$ responsible for the relative strength of the two terms, where $\\kappa ( p , u ^ { ( k ) } )$ denotes the KL \n196 divergence from $p$ to $u ^ { ( k ) }$ . Remarkably, $\\kappa ( \\boldsymbol { p } , \\boldsymbol { u } ^ { ( k ) } )$ has a finite value if and only if $p ^ { ( k ) }$ has non-zero \n197 values on the support of $u ^ { ( k ) }$ . Thus, both requirements in the second desideratum are satisfied by \n198 using the KL divergence as a measure for the closeness of $p ^ { ( k ) }$ and $u ^ { ( k ) }$ . Let $\\tilde { p } ^ { ( k ) }$ be the minimizer of \n199 (6). The estimate of $h ^ { ( k ) }$ is ",
647
+ "bbox": [
648
+ 140,
649
+ 152,
650
+ 826,
651
+ 228
652
+ ],
653
+ "page_idx": 5
654
+ },
655
+ {
656
+ "type": "equation",
657
+ "img_path": "images/1117ce5ce1a94083b7a4739f2312f1728ec81b5ff8b76051a16450f3bb2d7d9d.jpg",
658
+ "text": "$$\n\\hat { h } ^ { ( k ) } = \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } \\tilde { p } ^ { ( k ) } ( \\mathbf { a } ) \\ \\mathrm { d } \\mathbf { a } .\n$$",
659
+ "text_format": "latex",
660
+ "bbox": [
661
+ 416,
662
+ 227,
663
+ 581,
664
+ 260
665
+ ],
666
+ "page_idx": 5
667
+ },
668
+ {
669
+ "type": "text",
670
+ "text": "Naturally, this optimization problem can be derived from two different, though, related perspectives.300 ",
671
+ "bbox": [
672
+ 153,
673
+ 262,
674
+ 821,
675
+ 277
676
+ ],
677
+ "page_idx": 5
678
+ },
679
+ {
680
+ "type": "text",
681
+ "text": "201 A maximum likelihood perspective. The optimization problem in (6) can be derived using the \n202 maximum log likelihood method by treating the KL-divergence term as a regularizer. According to \n203 (5), the difference $( \\mu ^ { ( k ) } + z ^ { ( k ) } ) - h ^ { ( \\bar { k } ) }$ follows a Gaussian distribution ${ \\mathcal { N } } ( \\mathbf { 0 } , \\sigma ^ { 2 } \\mathbf { I } )$ . This implies the log \n204 likelihood function $\\begin{array} { r } { \\ell ( z ^ { ( k ) } ) \\propto - \\frac { 1 } { 2 \\sigma ^ { 2 } } \\left\\| ( \\mu ^ { ( k ) } + z ^ { ( k ) } ) - h ^ { ( k ) } \\right\\| ^ { 2 } } \\end{array}$ . Maximizing it with the KL-divergence \n205 term as a regularizer is the same as minimizing ",
682
+ "bbox": [
683
+ 138,
684
+ 282,
685
+ 825,
686
+ 359
687
+ ],
688
+ "page_idx": 5
689
+ },
690
+ {
691
+ "type": "equation",
692
+ "img_path": "images/3e2810c9e87c07f0e534f4b4c4fda14c7b67295449f43ce31a8edda2f53090c4.jpg",
693
+ "text": "$$\n\\frac { 1 } { 2 \\sigma ^ { 2 } } \\left\\| \\left( \\boldsymbol { \\mu } ^ { ( k ) } + \\boldsymbol { z } ^ { ( k ) } \\right) - \\boldsymbol { h } ^ { ( k ) } \\right\\| ^ { 2 } + \\eta \\mathcal { K } ( p , \\boldsymbol { u } ^ { ( k ) } ) ,\n$$",
694
+ "text_format": "latex",
695
+ "bbox": [
696
+ 346,
697
+ 363,
698
+ 650,
699
+ 392
700
+ ],
701
+ "page_idx": 5
702
+ },
703
+ {
704
+ "type": "text",
705
+ "text": "206 where $\\eta > 0$ controls the strength of the regularization. Substituting (4) into (8) followed by \n207 rearrangement yields ",
706
+ "bbox": [
707
+ 140,
708
+ 396,
709
+ 830,
710
+ 425
711
+ ],
712
+ "page_idx": 5
713
+ },
714
+ {
715
+ "type": "equation",
716
+ "img_path": "images/5da640929ddcbf283fb9b11383de91a26482d05ff18e2a41aae358cdaaa24b54.jpg",
717
+ "text": "$$\n\\operatorname* { m i n } _ { \\boldsymbol { p } } \\frac { 1 } { 2 \\eta \\sigma ^ { 2 } } \\left\\| \\left( \\boldsymbol { \\mu } ^ { ( k ) } + \\boldsymbol { z } ^ { ( k ) } \\right) - \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } \\boldsymbol { p } ( \\mathbf { a } ) \\ \\mathrm { d } \\mathbf { a } \\right\\| ^ { 2 } + \\mathcal { K } ( \\boldsymbol { p } , \\boldsymbol { u } ^ { ( k ) } ) ,\n$$",
718
+ "text_format": "latex",
719
+ "bbox": [
720
+ 300,
721
+ 429,
722
+ 694,
723
+ 467
724
+ ],
725
+ "page_idx": 5
726
+ },
727
+ {
728
+ "type": "text",
729
+ "text": "which is equivalent to (6) by setting 208 $\\alpha ^ { - 1 } = \\eta \\sigma ^ { 2 }$ . ",
730
+ "bbox": [
731
+ 140,
732
+ 470,
733
+ 493,
734
+ 487
735
+ ],
736
+ "page_idx": 5
737
+ },
738
+ {
739
+ "type": "text",
740
+ "text": "209 A maximum entropy on the mean perspective Consider a problem that seeks a distribution $p$ such that the expectation 210 $\\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } p ( \\mathbf { a } )$ da is not far from $\\mu ^ { ( k ) } + z ^ { ( k ) }$ . In particular, we require ",
741
+ "bbox": [
742
+ 147,
743
+ 491,
744
+ 825,
745
+ 522
746
+ ],
747
+ "page_idx": 5
748
+ },
749
+ {
750
+ "type": "equation",
751
+ "img_path": "images/78e65efb598c11f5774b46e43977ba3f6b755f4df09d87e8d372248cd73c806e.jpg",
752
+ "text": "$$\n\\left\\| \\left( { \\boldsymbol { \\mu } } ^ { ( k ) } + { \\boldsymbol { z } } ^ { ( k ) } \\right) - \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } p ( \\mathbf { a } ) ~ \\mathrm { d } \\mathbf { a } \\right\\| ^ { 2 } \\leq { \\frac { 1 } { 2 \\alpha } } .\n$$",
753
+ "text_format": "latex",
754
+ "bbox": [
755
+ 356,
756
+ 527,
757
+ 640,
758
+ 565
759
+ ],
760
+ "page_idx": 5
761
+ },
762
+ {
763
+ "type": "text",
764
+ "text": "211 Note that, given $z ^ { ( k ) }$ , there are infinitely many $p$ ’s that satisfy the constraints, which makes it difficult \n212 to pick a “best” $p$ for later use. A technique known in information theory as the maximum entropy on \n213 the mean (MEM) [6, 21] solves this problem by picking the best guess of the ground truth $p ^ { * }$ that \n214 simultaneously satisfies (10) and minimizes the KL divergence to the preference distribution $u ^ { ( k ) }$ . \n215 That is, ",
765
+ "bbox": [
766
+ 140,
767
+ 569,
768
+ 826,
769
+ 642
770
+ ],
771
+ "page_idx": 5
772
+ },
773
+ {
774
+ "type": "equation",
775
+ "img_path": "images/90f7ffd836550e86f7389ef570a824ecca68e18ecefe78533021fbc9585fbc54.jpg",
776
+ "text": "$$\n\\tilde { p } ^ { ( k ) } = \\arg \\operatorname* { m i n } _ { p } K ( p , u ^ { ( k ) } ) \\qquad \\mathrm { s u b j e c t ~ t o } \\qquad \\left\\| \\left( \\mu ^ { ( k ) } + z ^ { ( k ) } \\right) - \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } p ( \\mathbf { a } ) \\ \\mathrm { d } \\mathbf { a } \\right\\| ^ { 2 } \\leq \\frac { 1 } { 2 \\alpha } ,\n$$",
777
+ "text_format": "latex",
778
+ "bbox": [
779
+ 189,
780
+ 646,
781
+ 781,
782
+ 683
783
+ ],
784
+ "page_idx": 5
785
+ },
786
+ {
787
+ "type": "text",
788
+ "text": "216 which is also the minimizer of (6) according to Equation (18) of [21] and Corollary 4.9 of [2]. ",
789
+ "bbox": [
790
+ 145,
791
+ 685,
792
+ 785,
793
+ 702
794
+ ],
795
+ "page_idx": 5
796
+ },
797
+ {
798
+ "type": "text",
799
+ "text": "6 Optimal Solution ",
800
+ "text_level": 1,
801
+ "bbox": [
802
+ 160,
803
+ 718,
804
+ 349,
805
+ 737
806
+ ],
807
+ "page_idx": 5
808
+ },
809
+ {
810
+ "type": "text",
811
+ "text": "Rioux et al. proved that the optimization problem stated in (6) has the following Fenchel dual (see Theorem 2 of [21]): ",
812
+ "bbox": [
813
+ 169,
814
+ 750,
815
+ 825,
816
+ 779
817
+ ],
818
+ "page_idx": 5
819
+ },
820
+ {
821
+ "type": "text",
822
+ "text": "220 Theorem 1. The dual of (6) is given by ",
823
+ "bbox": [
824
+ 148,
825
+ 781,
826
+ 436,
827
+ 796
828
+ ],
829
+ "page_idx": 5
830
+ },
831
+ {
832
+ "type": "equation",
833
+ "img_path": "images/373d138d4037e0977dacfd2b745afe72f2d6b4b152d4c542d27b468d3061b2a3.jpg",
834
+ "text": "$$\n\\operatorname* { m a x } _ { \\lambda \\in \\mathbb { R } ^ { d } } \\left\\{ \\left. \\lambda , \\mu ^ { ( k ) } + z ^ { ( k ) } \\right. - \\frac { 1 } { 2 \\alpha } \\left\\| \\lambda \\right\\| ^ { 2 } - \\log \\int _ { \\mathbb { R } ^ { d } } u ^ { ( k ) } ( \\mathbf { a } ) \\exp \\langle \\mathbf { a } , \\lambda \\rangle \\ \\mathrm { d } \\mathbf { a } \\right\\} .\n$$",
835
+ "text_format": "latex",
836
+ "bbox": [
837
+ 263,
838
+ 801,
839
+ 732,
840
+ 835
841
+ ],
842
+ "page_idx": 5
843
+ },
844
+ {
845
+ "type": "text",
846
+ "text": "Given a maximizer 221 $\\lambda ^ { * }$ of $( I 2 )$ , one can recover the minimizer $\\tilde { p } ^ { ( k ) }$ of (6) via ",
847
+ "bbox": [
848
+ 140,
849
+ 840,
850
+ 669,
851
+ 857
852
+ ],
853
+ "page_idx": 5
854
+ },
855
+ {
856
+ "type": "equation",
857
+ "img_path": "images/2ffe8c967bcd2802ae1a92bb052ba409cd4a84f13bbbc014b6d34c91a42d76bf.jpg",
858
+ "text": "$$\n\\widetilde { p } ^ { ( k ) } ( \\mathbf { a } ) = \\frac { u ( \\mathbf { a } ) \\exp \\langle \\mathbf { a } , \\lambda ^ { * } \\rangle } { \\int _ { \\mathbb { R } ^ { d } } u ( \\mathbf { a } ^ { \\prime } ) \\exp \\langle \\mathbf { a } ^ { \\prime } , \\lambda ^ { * } \\rangle \\ \\mathrm { d } \\mathbf { a } ^ { \\prime } } .\n$$",
859
+ "text_format": "latex",
860
+ "bbox": [
861
+ 374,
862
+ 859,
863
+ 622,
864
+ 895
865
+ ],
866
+ "page_idx": 5
867
+ },
868
+ {
869
+ "type": "text",
870
+ "text": "3In fact, there is also a Bayesian perspective to derive the problem, which will be discussed in Appendix A. ",
871
+ "bbox": [
872
+ 186,
873
+ 897,
874
+ 820,
875
+ 912
876
+ ],
877
+ "page_idx": 5
878
+ },
879
+ {
880
+ "type": "text",
881
+ "text": "By Theorem 1, the estimated 222 $h ^ { ( k ) }$ defined in (7) can be re-written as ",
882
+ "bbox": [
883
+ 142,
884
+ 89,
885
+ 620,
886
+ 106
887
+ ],
888
+ "page_idx": 6
889
+ },
890
+ {
891
+ "type": "equation",
892
+ "img_path": "images/613f01bd29aadd5ef6651b683f68cb1fe49e64ea77690a3962b032cddb8145ec.jpg",
893
+ "text": "$$\n\\hat { h } ^ { ( k ) } = \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } \\tilde { p } ^ { ( k ) } ( \\mathbf { a } ) ~ \\mathrm { d } \\mathbf { a } = \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } ~ \\frac { u ^ { ( k ) } ( \\mathbf { a } ) \\exp \\langle \\mathbf { a } , \\lambda ^ { * } \\rangle } { \\int _ { \\mathbb { R } ^ { d } } u ^ { ( k ) } ( \\mathbf { a } ^ { \\prime } ) \\exp \\langle \\mathbf { a } ^ { \\prime } , \\lambda ^ { * } \\rangle ~ \\mathrm { d } \\mathbf { a } ^ { \\prime } } ~ \\mathrm { d } \\mathbf { a } ,\n$$",
894
+ "text_format": "latex",
895
+ "bbox": [
896
+ 276,
897
+ 107,
898
+ 720,
899
+ 143
900
+ ],
901
+ "page_idx": 6
902
+ },
903
+ {
904
+ "type": "text",
905
+ "text": "where 223 $\\lambda ^ { * }$ is a maximizer of (12). ",
906
+ "bbox": [
907
+ 145,
908
+ 143,
909
+ 388,
910
+ 160
911
+ ],
912
+ "page_idx": 6
913
+ },
914
+ {
915
+ "type": "text",
916
+ "text": "224 In general, $\\lambda ^ { * }$ does not have a closed-form expression in terms of $\\alpha$ , $u ^ { ( k ) }$ and $z ^ { ( k ) }$ , and a standard \n225 paradigm is to search for it using gradient ascent-based methods. In this paper, we will not search for \n226 $\\lambda ^ { * }$ in this way; instead, we will derive a closed-form expression to approximate it. Remarkably, this \n227 takes the form of the generalized attention presented in Fig 1. ",
917
+ "bbox": [
918
+ 143,
919
+ 164,
920
+ 826,
921
+ 222
922
+ ],
923
+ "page_idx": 6
924
+ },
925
+ {
926
+ "type": "text",
927
+ "text": "Note that the integration in (12) equals $\\mathbb { E } _ { u ^ { ( k ) } } [ \\exp \\langle W , \\lambda \\rangle ]$ , the expectation of the random variable $\\exp \\langle W , \\lambda \\rangle$ where $W$ has the probability distribution $u ^ { ( k ) }$ . The expectation is just the moment generating function (MGF) $M ( \\lambda )$ of $W$ , and the value $\\log M ( \\lambda )$ is called the cumulant of $W$ [17, p.26], which has an expansion [17, (2.4)] ",
928
+ "bbox": [
929
+ 158,
930
+ 226,
931
+ 825,
932
+ 285
933
+ ],
934
+ "page_idx": 6
935
+ },
936
+ {
937
+ "type": "equation",
938
+ "img_path": "images/a1cc7b2f77109499563135fcbc9767ed9aa5c2e3fefdd629041b022d40666282.jpg",
939
+ "text": "$$\n\\log M ( \\lambda ) = \\left. \\mu ^ { ( k ) } , \\lambda \\right. + \\frac { 1 } { 2 } \\left. \\lambda , \\Sigma ^ { ( k ) } \\lambda \\right. + { \\mathcal O } ( \\left. \\lambda \\right. ^ { 3 } ) ,\n$$",
940
+ "text_format": "latex",
941
+ "bbox": [
942
+ 323,
943
+ 286,
944
+ 671,
945
+ 315
946
+ ],
947
+ "page_idx": 6
948
+ },
949
+ {
950
+ "type": "text",
951
+ "text": "where $\\mu ^ { ( k ) } = \\int _ { \\mathbb { R } ^ { d } }$ a $u ^ { ( k ) } ( \\mathbf { a } )$ da and $\\begin{array} { r } { \\Sigma ^ { ( k ) } = \\int _ { \\mathbb { R } ^ { d } } \\left( \\mathbf { a } - \\boldsymbol { \\mu } ^ { ( k ) } \\right) \\left( \\mathbf { a } - \\boldsymbol { \\mu } ^ { ( k ) } \\right) ^ { T } \\boldsymbol { u } ^ { ( k ) } ( \\mathbf { a } ) } \\end{array}$ da respectively denote the expectation and the variance-covariance matrix of $W$ . ",
952
+ "bbox": [
953
+ 165,
954
+ 319,
955
+ 825,
956
+ 351
957
+ ],
958
+ "page_idx": 6
959
+ },
960
+ {
961
+ "type": "text",
962
+ "text": "234 Now we assume that $\\alpha$ is small and we argue that this assumption is justified in practice. For instance, \n235 in the translation task, all of words in the dictionary can serve as candidate templates, which could \n236 be more than 10,000, but $u ^ { ( k ) }$ reduces this size to the length of the source sentence (usually less \n237 than tens of words). The inference of $p ^ { ( k ) }$ should strongly anchor around this prior information; \n238 consequently the information provided by $z ^ { ( k ) }$ should weigh less. On the other hand, $z ^ { ( k ) }$ can hardly \n239 provide an accurate estimate of the mean shift, since the generation of $z ^ { ( k ) }$ is often ignorant of the \n240 templates selected by $u ^ { ( k ) }$ (for example, in the example translation and image captioning models) or \n241 generated by a low-capacity module (as in the example filling-in-the-blank model). For these reasons, \n242 one should de-emphasize the constraint imposed by $z ^ { ( k ) }$ and hence choose a small $\\alpha$ . ",
963
+ "bbox": [
964
+ 140,
965
+ 354,
966
+ 826,
967
+ 489
968
+ ],
969
+ "page_idx": 6
970
+ },
971
+ {
972
+ "type": "text",
973
+ "text": "When $\\alpha$ is picked to be small enough (see (12)), the optimization of $\\lambda$ gets a large penalty on its L2 norm and thus, $\\| \\lambda ^ { * } \\|$ is close to zero. Then, by (15), we have ",
974
+ "bbox": [
975
+ 160,
976
+ 494,
977
+ 825,
978
+ 523
979
+ ],
980
+ "page_idx": 6
981
+ },
982
+ {
983
+ "type": "equation",
984
+ "img_path": "images/b0725fc5622b7800397d03672432e1b79e013cbacf1f4ec3a8cca0d2978e44f1.jpg",
985
+ "text": "$$\n\\log \\int _ { { \\mathbb { R } } ^ { d } } u ^ { ( k ) } ( { \\mathbf { a } } ) \\exp \\langle { \\mathbf { a } } , \\lambda ^ { * } \\rangle { \\mathbf { \\Psi } } { \\mathrm { d } } { \\mathbf { a } } = \\log M ( \\lambda ^ { * } ) \\approx \\langle \\mu ^ { ( k ) } , \\lambda ^ { * } \\rangle + \\frac { 1 } { 2 } \\langle \\lambda ^ { * } , \\Sigma ^ { ( k ) } \\lambda ^ { * } \\rangle .\n$$",
986
+ "text_format": "latex",
987
+ "bbox": [
988
+ 248,
989
+ 525,
990
+ 748,
991
+ 558
992
+ ],
993
+ "page_idx": 6
994
+ },
995
+ {
996
+ "type": "text",
997
+ "text": "Substituting (16) into (12) followed by setting the derivative with respect to $\\lambda$ to zero yields ",
998
+ "bbox": [
999
+ 168,
1000
+ 559,
1001
+ 772,
1002
+ 574
1003
+ ],
1004
+ "page_idx": 6
1005
+ },
1006
+ {
1007
+ "type": "equation",
1008
+ "img_path": "images/f3591647e3f9a3b6fc157e16b092b9e293ae36c507bbf6d20fa9c2bc4af11e06.jpg",
1009
+ "text": "$$\n\\lambda ^ { * } = \\alpha ( I _ { d } + \\alpha \\Sigma ^ { ( k ) } ) ^ { - 1 } z ^ { ( k ) } ,\n$$",
1010
+ "text_format": "latex",
1011
+ "bbox": [
1012
+ 403,
1013
+ 574,
1014
+ 591,
1015
+ 593
1016
+ ],
1017
+ "page_idx": 6
1018
+ },
1019
+ {
1020
+ "type": "text",
1021
+ "text": "where $I _ { d }$ denotes the $d \\times d$ identity matrix. As $\\alpha$ is assumed close to zero, (17) is further reduced to ",
1022
+ "bbox": [
1023
+ 165,
1024
+ 594,
1025
+ 821,
1026
+ 609
1027
+ ],
1028
+ "page_idx": 6
1029
+ },
1030
+ {
1031
+ "type": "equation",
1032
+ "img_path": "images/df51b42801fe9a9cedb232971e5b60cac50daf3c91f118e1af12d4c02f728dca.jpg",
1033
+ "text": "$$\n\\lambda ^ { * } = \\alpha z ^ { ( k ) } .\n$$",
1034
+ "text_format": "latex",
1035
+ "bbox": [
1036
+ 457,
1037
+ 609,
1038
+ 540,
1039
+ 627
1040
+ ],
1041
+ "page_idx": 6
1042
+ },
1043
+ {
1044
+ "type": "text",
1045
+ "text": "47 Plugging the expression into (14) gives the result stated as follows: ",
1046
+ "bbox": [
1047
+ 153,
1048
+ 630,
1049
+ 625,
1050
+ 646
1051
+ ],
1052
+ "page_idx": 6
1053
+ },
1054
+ {
1055
+ "type": "text",
1056
+ "text": "Theorem 2. For a small enough $\\alpha > 0$ , the estimated $h ^ { ( k ) }$ defined in (7) can be approximated by ",
1057
+ "bbox": [
1058
+ 158,
1059
+ 647,
1060
+ 812,
1061
+ 664
1062
+ ],
1063
+ "page_idx": 6
1064
+ },
1065
+ {
1066
+ "type": "equation",
1067
+ "img_path": "images/33eaaaabe5aa956cafc9bdf2760bfbe7a34e12f28046ee7adeeeaedfe78a1920.jpg",
1068
+ "text": "$$\n\\hat { h } ^ { ( k ) } = \\int _ { \\mathbb { R } ^ { d } } \\mathbf { a } \\frac { u ^ { ( k ) } ( \\mathbf { a } ) \\exp ( \\alpha \\langle \\mathbf { a } , z ^ { ( k ) } \\rangle ) } { \\int _ { \\mathbb { R } ^ { d } } u ^ { ( k ) } ( \\mathbf { a } ^ { \\prime } ) \\exp ( \\alpha \\langle \\mathbf { a } ^ { \\prime } , z ^ { ( k ) } \\rangle ) \\mathrm { d } \\mathbf { a } ^ { \\prime } } \\mathrm { d } \\mathbf { a } .\n$$",
1069
+ "text_format": "latex",
1070
+ "bbox": [
1071
+ 325,
1072
+ 664,
1073
+ 669,
1074
+ 702
1075
+ ],
1076
+ "page_idx": 6
1077
+ },
1078
+ {
1079
+ "type": "text",
1080
+ "text": "For the cas249 probability 250 $u ^ { ( k ) }$ distribution with support , (19) becomes simply $\\{ \\mathbf { t } _ { 1 } ^ { ( k ) } , \\mathbf { t } _ { 2 } ^ { ( k ) } , \\dots , \\mathbf { t } _ { n } ^ { ( k ) } \\}$ and the preference $\\{ u _ { 1 } ^ { ( k ) } , u _ { 2 } ^ { ( k ) } , \\ldots , u _ { n } ^ { ( k ) } \\}$ ",
1081
+ "bbox": [
1082
+ 138,
1083
+ 709,
1084
+ 825,
1085
+ 746
1086
+ ],
1087
+ "page_idx": 6
1088
+ },
1089
+ {
1090
+ "type": "equation",
1091
+ "img_path": "images/d11ef6c429541f8e0ad8dd71b31cd4470b939f705165e867b6dc22dfec602734.jpg",
1092
+ "text": "$$\n\\hat { h } ^ { ( k ) } = \\sum _ { i = 1 } ^ { n } \\mathbf { t } _ { i } \\frac { u _ { i } ^ { ( k ) } \\exp ( \\alpha \\langle \\mathbf { t } _ { i } , z ^ { ( k ) } \\rangle ) } { \\sum _ { j = 1 } ^ { n } u _ { j } ^ { ( k ) } \\exp ( \\alpha \\langle \\mathbf { t } _ { j } , z ^ { ( k ) } \\rangle ) } .\n$$",
1093
+ "text_format": "latex",
1094
+ "bbox": [
1095
+ 354,
1096
+ 747,
1097
+ 643,
1098
+ 791
1099
+ ],
1100
+ "page_idx": 6
1101
+ },
1102
+ {
1103
+ "type": "text",
1104
+ "text": "In Fig 3, we set 251 $d = 2$ and visualize the approximation of $h ^ { ( k ) }$ for different selections of $\\alpha$ . We can observe that, as 252 $\\alpha$ decreases, (20) outputs a better approximation of $\\hat { h } ^ { ( k ) }$ . ",
1105
+ "bbox": [
1106
+ 150,
1107
+ 799,
1108
+ 825,
1109
+ 832
1110
+ ],
1111
+ "page_idx": 6
1112
+ },
1113
+ {
1114
+ "type": "text",
1115
+ "text": "Let 253 $\\alpha = \\tau ^ { - \\frac { 1 } { 2 } }$ , we rewrite Theorem 2 as follows for later reference. ",
1116
+ "bbox": [
1117
+ 145,
1118
+ 838,
1119
+ 611,
1120
+ 854
1121
+ ],
1122
+ "page_idx": 6
1123
+ },
1124
+ {
1125
+ "type": "text",
1126
+ "text": "Corollary 1. For a sufficiently large 254 $\\tau$ , the best guess of $h ^ { ( k ) }$ defined in (7) with $\\alpha = \\tau ^ { - \\frac { 1 } { 2 } }$ equals ",
1127
+ "bbox": [
1128
+ 151,
1129
+ 856,
1130
+ 810,
1131
+ 872
1132
+ ],
1133
+ "page_idx": 6
1134
+ },
1135
+ {
1136
+ "type": "equation",
1137
+ "img_path": "images/3841b1e955986faf77868c2555ac51070671e222978b5ef2c12f485a17d13b5e.jpg",
1138
+ "text": "$$\n\\hat { h } ^ { ( k ) } = \\sum _ { i = 1 } ^ { n } \\mathbf { t } _ { i } ^ { ( k ) } \\frac { u _ { i } ^ { ( k ) } \\exp ( \\langle \\mathbf { t } _ { i } ^ { ( k ) } , z ^ { ( k ) } \\rangle / \\sqrt { \\tau } ) } { \\sum _ { j = 1 } ^ { n } u _ { j } ^ { ( k ) } \\exp ( \\langle \\mathbf { t } _ { j } ^ { ( k ) } , z ^ { ( k ) } \\rangle / \\sqrt { \\tau } ) } .\n$$",
1139
+ "text_format": "latex",
1140
+ "bbox": [
1141
+ 334,
1142
+ 873,
1143
+ 663,
1144
+ 916
1145
+ ],
1146
+ "page_idx": 6
1147
+ },
1148
+ {
1149
+ "type": "image",
1150
+ "img_path": "images/0a991ffd1ffdd495cce50e8d736a8ce75c014f38a84cf0314071001a724626ff.jpg",
1151
+ "image_caption": [
1152
+ "Figure 3: The approximation of $\\hat { h } ^ { ( k ) }$ for different choices of $\\alpha$ . The dots in light blue compose the support of discrete $u ^ { ( k ) }$ with the preference weights labelled above. The dark blue arrow starting from the mean $\\mu ^ { ( k ) }$ of $u ^ { ( k ) }$ denotes the evidence $z ^ { ( k ) }$ . The red square marks the $\\hat { h } ^ { ( k ) }$ constructed by (14) with the $\\lambda ^ { * }$ maximizes (12), while the green one marks the $\\hat { h } ^ { ( k ) }$ approximated by (20). As we can observe, (20) gives a precise approximation of $\\hat { h } ^ { ( k ) }$ when $\\alpha$ is sufficiently small. "
1153
+ ],
1154
+ "image_footnote": [],
1155
+ "bbox": [
1156
+ 199,
1157
+ 87,
1158
+ 797,
1159
+ 195
1160
+ ],
1161
+ "page_idx": 7
1162
+ },
1163
+ {
1164
+ "type": "text",
1165
+ "text": "255 7 Discussion ",
1166
+ "text_level": 1,
1167
+ "bbox": [
1168
+ 145,
1169
+ 305,
1170
+ 294,
1171
+ 323
1172
+ ],
1173
+ "page_idx": 7
1174
+ },
1175
+ {
1176
+ "type": "text",
1177
+ "text": "In Section 6, we derived an alternative expression of $\\hat { h } ^ { ( k ) }$ defined in (7) by solving the Fenchel dual of the optimization problem stated in (6). Although the expression is not in closed form, as we are only interested in the case when $\\alpha$ is small, a closed-form approximation of $\\hat { h } ^ { ( k ) }$ is derived in Theorem 2 and reduced to the form stated in (21) when considering a discrete distribution $u ^ { ( k ) }$ . ",
1178
+ "bbox": [
1179
+ 174,
1180
+ 334,
1181
+ 825,
1182
+ 397
1183
+ ],
1184
+ "page_idx": 7
1185
+ },
1186
+ {
1187
+ "type": "text",
1188
+ "text": "As we pointed out, the block $g ^ { ( k ) }$ in Fig 2a, Fig 2b and Fig 2c is expected to find the inferred $\\tilde { p } ^ { ( k ) }$ minimizing (6) followed by plugging it into (7) to construct $\\hat { h } ^ { ( k ) }$ . Therefore, one can complete the architecture designs of the three running examples by replacing $g ^ { ( k ) }$ with a network layer implementing (21), namely, the structure in Figure 1 (c). ",
1189
+ "bbox": [
1190
+ 173,
1191
+ 402,
1192
+ 825,
1193
+ 463
1194
+ ],
1195
+ "page_idx": 7
1196
+ },
1197
+ {
1198
+ "type": "text",
1199
+ "text": "The relationship between the optimal solution and the attention models. Remarkably, the expression stated in (21) gives a generalized attention block. By setting $\\begin{array} { r } { u _ { i } ^ { ( k ) } = \\frac { 1 } { n } } \\end{array}$ for all $i$ , the expression is equivalent to the well known dot-product attention [15], which is also applied in the transformer network [25]. The equivalence of the expression of $\\hat { h } ^ { ( k ) }$ and the dot-product attention layer tells us: (a) by applying a dot-product attention layer in a model, we essentially ask the model to perform an optimization task defined in (6) and construct the output according to (7). (b) the derivation of $h ^ { ( k ) }$ depends on two relatively independent pieces of information: a preference distribution given the global information and an estimate of the output’s deviation from the preference distribution’s mean according to some local information. This suggests that the design of attention-based model can be decomposed into two parts that respectively estimate these two values. ",
1200
+ "bbox": [
1201
+ 173,
1202
+ 469,
1203
+ 826,
1204
+ 614
1205
+ ],
1206
+ "page_idx": 7
1207
+ },
1208
+ {
1209
+ "type": "text",
1210
+ "text": "The model consisting of a stack of attention layers. Although our discussion focuses on the case that contains a single attention layer, any attention layer $\\mathcal { L }$ in an attention stack fits our frameworks (see Fig 1). In particular, all the attention layers closer to the input $X$ than $\\mathcal { L }$ can be grouped into the functions $f _ { \\mathrm { p r e f } } ^ { ( k ) }$ or f evd . For those layers that take the current layer’s output as input, we can group them into $f _ { \\mathrm { o u t } } ^ { ( k ) }$ , where $\\mathbf { c } ^ { ( k ) }$ may contain the outputs of other attention layers working in parallel. ",
1211
+ "bbox": [
1212
+ 171,
1213
+ 619,
1214
+ 825,
1215
+ 700
1216
+ ],
1217
+ "page_idx": 7
1218
+ },
1219
+ {
1220
+ "type": "text",
1221
+ "text": "9 T5 transformer implicitly adopts the generalized attention structure. We now show that T5 0 transformer [19] can be seen as a realization of the generalized attention in (21), where the preference weights $u ^ { ( k ) }$ unifies the concepts of word masks and T5’s positional encoding functions. Consider 2 the running example: filing in the blanks, with the preference distribution ",
1222
+ "bbox": [
1223
+ 153,
1224
+ 704,
1225
+ 825,
1226
+ 762
1227
+ ],
1228
+ "page_idx": 7
1229
+ },
1230
+ {
1231
+ "type": "equation",
1232
+ "img_path": "images/74486b45af8c39b3af1b92dcb2e0bbb14108f5ef87e0b4e572d58539cae76323.jpg",
1233
+ "text": "$$\nu ^ { ( k ) } ( \\mathbf { t } _ { i } ) = { \\left\\{ \\begin{array} { l l } { 0 } & { { \\mathrm { i f ~ t h e ~ } } i ^ { \\mathrm { t h } } { \\mathrm { ~ w o r d ~ i s ~ m a s k e d } } } \\\\ { \\exp ( b _ { j - i } ) / Z } & { { \\mathrm { o t h e r w i s e } } , } \\end{array} \\right. }\n$$",
1234
+ "text_format": "latex",
1235
+ "bbox": [
1236
+ 320,
1237
+ 768,
1238
+ 676,
1239
+ 805
1240
+ ],
1241
+ "page_idx": 7
1242
+ },
1243
+ {
1244
+ "type": "text",
1245
+ "text": "283 where $Z$ is a normalizing constant and $b _ { j - i }$ is a trainable scalar that only depends on the relative \n284 position of word $i$ and word $j$ (which is the $k ^ { \\mathrm { t h } }$ masked word that we are inferring). Substituting \n285 such $u ^ { ( k ) }$ into (21) with $\\tau = d$ yields ",
1246
+ "bbox": [
1247
+ 142,
1248
+ 810,
1249
+ 825,
1250
+ 857
1251
+ ],
1252
+ "page_idx": 7
1253
+ },
1254
+ {
1255
+ "type": "equation",
1256
+ "img_path": "images/085af32420704578476fbc2f8c6cc536d8f4171cfa06def1b1c06c1fa6ce8e82.jpg",
1257
+ "text": "$$\n\\hat { h } ^ { ( k ) } = \\sum _ { i = 1 } ^ { n } \\mathbf { t } _ { i } \\frac { \\exp \\left( \\frac { \\langle \\mathbf { t } _ { i } , z ^ { ( k ) } \\rangle } { \\sqrt { d } } + b _ { j - i } + \\mathbf { 1 } _ { \\mathrm { m a s k e d } } ( i ) \\right) } { \\sum _ { l = 1 } ^ { n } \\exp \\left( \\frac { \\langle \\mathbf { t } _ { l } , z ^ { ( k ) } \\rangle } { \\sqrt { d } } + b _ { j - l } + \\mathbf { 1 } _ { \\mathrm { m a s k e d } } ( l ) \\right) } ,\n$$",
1258
+ "text_format": "latex",
1259
+ "bbox": [
1260
+ 312,
1261
+ 862,
1262
+ 684,
1263
+ 916
1264
+ ],
1265
+ "page_idx": 7
1266
+ },
1267
+ {
1268
+ "type": "text",
1269
+ "text": "where $\\mathbf { 1 } _ { \\mathrm { m a s k e d } } ( i )$ is an indicator function that equals $- \\infty$ if word $i$ is masked and zero otherwise. The expression in (23) has the same structure as that adopted in T5 transformer, where the indicator function serves as the mask function to prevent the model from assigning weights to the masked words. In this way, the concepts of word masks and the positional encoding functions are unified by $u ^ { ( k ) }$ in (22). Conversely, T5 transformer is a realization of the generalized attention with the preference weights $u ^ { ( k ) }$ specified in (22). ",
1270
+ "bbox": [
1271
+ 140,
1272
+ 92,
1273
+ 825,
1274
+ 178
1275
+ ],
1276
+ "page_idx": 8
1277
+ },
1278
+ {
1279
+ "type": "text",
1280
+ "text": "Generalized attention structures suggested by the optimal solution. While T5 transformer has implicitly adopted the generalized attention, (21) hints further generalizations could be made. For instance, in T5 transformer, the function outputting template’s preference weights only considers the word masks and the word’s relative positions. This function could be generalized to also consider the input sentence contexts, and the output weights encode the importance of each word before giving the local information stored in $z ^ { ( k ) }$ . The same idea could be applied to the image captioning example to replace the uniform preference weights. By adding a neural network taking the input image to generate non-uniform preference weights, we devise a mechanism to estimate the importance of each part of the image before the caption generation. In this way, the newly added network collects global information from the image to propose a preference distribution, which could be updated locally based on current generation stage encoded in $z ^ { ( k ) }$ . ",
1281
+ "bbox": [
1282
+ 173,
1283
+ 184,
1284
+ 825,
1285
+ 338
1286
+ ],
1287
+ "page_idx": 8
1288
+ },
1289
+ {
1290
+ "type": "text",
1291
+ "text": "Moreover, although we mainly focus on the case when $u ^ { ( k ) }$ is discrete, we want to emphasize that the analysis performed in Section 6 also covers continuous $u ^ { ( k ) }$ . This hints that a continuous attention mechanism could also be implemented, which might prove to be useful in some applications. ",
1292
+ "bbox": [
1293
+ 160,
1294
+ 344,
1295
+ 825,
1296
+ 390
1297
+ ],
1298
+ "page_idx": 8
1299
+ },
1300
+ {
1301
+ "type": "text",
1302
+ "text": "Limitations and other comments. The approximations performed in (15) and (18) have implicitly assumed that random variable $W$ following distribution $u ^ { ( \\bar { k } ) }$ has bounded moments. For a discrete $u ^ { ( \\bar { k } ) }$ with fixed support $\\mathbf { T } = \\left\\{ \\mathbf { t } _ { 1 } , \\mathbf { t } _ { 2 } , \\ldots \\mathbf { t } _ { n } \\right\\}$ , all the moments are bounded and we can always pick a small enough $\\alpha$ (or equivalently large enough scaling factor $\\tau$ in $\\mathrm { C o r 1 }$ ) to make the approximation meet our requirements. A concern may arise as the support $\\mathbf { T }$ in our running examples are supplied by some neural layers, which could output templates of increasing norms as the training evolves. This problem could be alleviated by adding norm regularization or using normalized templates instead. ",
1303
+ "bbox": [
1304
+ 171,
1305
+ 396,
1306
+ 825,
1307
+ 494
1308
+ ],
1309
+ "page_idx": 8
1310
+ },
1311
+ {
1312
+ "type": "text",
1313
+ "text": "313 8 Conclusion ",
1314
+ "text_level": 1,
1315
+ "bbox": [
1316
+ 142,
1317
+ 544,
1318
+ 299,
1319
+ 561
1320
+ ],
1321
+ "page_idx": 8
1322
+ },
1323
+ {
1324
+ "type": "text",
1325
+ "text": "314 This paper presented a new perspective to understand the attention mechanism by showing that it can \n315 be treated as realizing a solver of a family of inference tasks. These tasks involve improving the noisy \n316 estimate of a distribution $p$ ’s mean by a preference distribution that encodes some beliefs of $p$ ’s value. \n317 We have used three running examples with the typical model architectures to show that such tasks \n318 naturally exist in neural network design. We then abstracted a convex optimization problem from \n319 these tasks and derived a closed-form approximation of the optimal solution by solving the problem’s \n320 Fenchel dual. We find that the closed-form approximation can be seen as a generalized attention \n321 layer and show that one of its special cases is equivalent to the dot-product attention adopted in \n322 transformers. We further performed an analysis on the general form and showed that T5 transformer \n323 implicitly adopts the generalized attention structure with attention weights unifying the concepts of \n324 the word masks and the positional encoding functions. \n325 This paper is the first work that presents a principled justification for the design of attention modules \n326 in neural networks. The generalized attention structure presented in this paper potentially opens a door \n327 to a wide design space. For example, the preference weights need not be derived from the positional \n328 encoding functions; they could integrate a variety of information provided by other components of \n329 the network. Additionally, this research might have pointed to new ways to analyze the functioning \n330 of a neural network component, namely, via isolating the component from the complex network \n331 structure and asking: is there a “local problem” that is solved by the design of this component? ",
1326
+ "bbox": [
1327
+ 138,
1328
+ 593,
1329
+ 825,
1330
+ 746
1331
+ ],
1332
+ "page_idx": 8
1333
+ },
1334
+ {
1335
+ "type": "text",
1336
+ "text": "",
1337
+ "bbox": [
1338
+ 140,
1339
+ 752,
1340
+ 825,
1341
+ 849
1342
+ ],
1343
+ "page_idx": 8
1344
+ },
1345
+ {
1346
+ "type": "text",
1347
+ "text": "Potential negative societal impacts. This paper presents a new perspective to understand attention and derived a generalized attention structure. Our work is foundational, which we believe does not have direct negative societal impacts. Due to the very wide range of applications of attention, such as self-driving [12] and healthcare [16], our work may have unexpected negative impacts on these areas. ",
1348
+ "bbox": [
1349
+ 158,
1350
+ 856,
1351
+ 825,
1352
+ 911
1353
+ ],
1354
+ "page_idx": 8
1355
+ },
1356
+ {
1357
+ "type": "text",
1358
+ "text": "336 References [1] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural Machine Translation by Jointly Learning to Align and Translate. In ICLR 2015, pages 1–15, 2014. [2] J. M. Borwein and A. S. Lewis. Partially finite convex programming, part i: Quasi relative interiors and duality theory. Mathematical Programming, 57(1):15–48, 1992. [3] Gino Brunner, Yang Liu, Damián Pascual, Oliver Richter, Massimiliano Ciaramita, and Roger Wattenhofer. On Identifiability in Transformers. In International Conference on Learning Representations (ICLR), 2019. [4] Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. What Does BERT Look at? An Analysis of BERT’s Attention. arXiv preprint arXiv:1906.04341, 2019. [5] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. [6] Fabrice Gamboa. Methode du maximum d’entropie sur la moyenne et applications. Phd Thesis, 1989. [7] Michael Hahn. Theoretical Limitations of Self-Attention in Neural Sequence Models. Transactions of the Association for Computational Linguistics, 8:156–171, 2020. [8] Jiri Hron, Yasaman Bahri, and Jascha Sohl-dickstein Roman. Infinite attention $:$ NNGP and NTK for deep attention networks. In International Conference on Machine Learning (ICML), 2020. [9] Sarthak Jain and Byron C. Wallace. Attention is not Explanation. In Annual Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), 2019. [10] E. T. Jaynes. Information theory and statistical mechanics. Phys. Rev., 106:620–630, May 1957. [11] E. T. Jaynes. Information theory and statistical mechanics. ii. Phys. Rev., 108:171–190, Oct 1957. [12] Jinkyu Kim and John Canny. Interpretable learning for self-driving cars by visualizing causal attention. In 2017 IEEE International Conference on Computer Vision (ICCV), pages 2961– 2969, 2017. \n367 [13] Jaehoon Lee, Jascha Sohl-dickstein, Jeffrey Pennington, Roman Novak, Sam Schoenholz, and Yasaman Bahri. Deep neural networks as gaussian processes. In International Conference on Learning Representations (ICLR), 2018. \n370 [14] Haoye Lu, Yongyi Mao, and Amiya Nayak. On the dynamics of training attention models. In International Conference on Learning Representations, 2021. [15] Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1412–1421, Lisbon, Portugal, September 2015. Association for Computational Linguistics. [16] Fenglong Ma, Radha Chitta, Jing Zhou, Quanzeng You, Tong Sun, and Jing Gao. Dipole: Diagnosis prediction in healthcare via attention-based bidirectional recurrent neural networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’17, page 1903–1911, New York, NY, USA, 2017. Association for Computing Machinery. [17] P. McCullagh. Tensor Methods in Statistics : Monographs on Statistics and Applied Probability. Chapman and Hall/CRC, Boca Raton, FL, first edition. edition, 1987. ",
1359
+ "bbox": [
1360
+ 143,
1361
+ 41,
1362
+ 828,
1363
+ 916
1364
+ ],
1365
+ "page_idx": 9
1366
+ },
1367
+ {
1368
+ "type": "text",
1369
+ "text": "[18] Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? In Neural Information Processing Systems (NIPS), volume 32. Curran Associates, Inc., 2019. [19] 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. Journal of Machine Learning Research, 21(140):1–67, 2020. [20] Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Lukas Gruber, Markus Holzleitner, Thomas Adler, David Kreil, Michael K Kopp, Günter Klambauer, Johannes Brandstetter, and Sepp Hochreiter. Hopfield networks is all you need. In International Conference on Learning Representations, 2021. [21] Gabriel Rioux, Rustum Choksi, Tim Hoheisel, Pierre Marechal, and Christopher Scarvelis. The maximum entropy on the mean method for image deblurring. Inverse Problems, oct 2020. [22] R. Tyrrell Rockafellar. Convex analysis. Princeton mathematical series ; 28. Princeton University Press, Princeton, N.J, 1970. [23] Sofia Serrano and Noah A. Smith. Is attention interpretable? In Annual Meeting of the Association for Computational Linguistics (ACL), 2020. [24] Shikhar Vashishth, Shyam Upadhyay, Gaurav Singh Tomar, and Manaal Faruqui. Attention Interpretability Across NLP Tasks. In International Conference on Learning Representations (ICLR), 2020. [25] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. [26] Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, July 2019. [27] Yequan Wang, Minlie Huang, Xiaoyan Zhu, and Li Zhao. Attention-based LSTM for aspectlevel sentiment classification. In Empirical Methods in Natural Language Processing (EMNLP), pages 606–615, Austin, Texas, November 2016. Association for Computational Linguistics. [28] Sarah Wiegreffe and Yuval Pinter. Attention is not not explanation. In 2019 Conference on Empirical Methods in Natural Language Processing and 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 2019. [29] K. Xu, J. Ba, R. Kiros, K. Cho, A. Courville, R. Salakhudinov, R. Zemel, and Y. Bengio. Show, Attend and Tell: Neural Image Caption Generation with Visual Attention. In Proc. 32nd Int. Conf. Mach. Learn., pages 257–261, 2015. 17 [30] Greg Yang. Tensor Programs I : Wide Feedforward or Recurrent Neural Networks of Any Architecture are Gaussian Processes. In Neural Information Processing Systems (NIPS), 2019. ",
1370
+ "bbox": [
1371
+ 155,
1372
+ 90,
1373
+ 826,
1374
+ 714
1375
+ ],
1376
+ "page_idx": 10
1377
+ },
1378
+ {
1379
+ "type": "text",
1380
+ "text": "Checklist ",
1381
+ "text_level": 1,
1382
+ "bbox": [
1383
+ 153,
1384
+ 734,
1385
+ 253,
1386
+ 750
1387
+ ],
1388
+ "page_idx": 10
1389
+ },
1390
+ {
1391
+ "type": "text",
1392
+ "text": "1. For all authors... ",
1393
+ "bbox": [
1394
+ 214,
1395
+ 761,
1396
+ 339,
1397
+ 775
1398
+ ],
1399
+ "page_idx": 10
1400
+ },
1401
+ {
1402
+ "type": "text",
1403
+ "text": "(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] \n(b) Did you describe the limitations of your work? [Yes] We have created a sub-section, called Limitations and other comments, in Section 7 to discuss the potential limitations of our work. \n(c) Did you discuss any potential negative societal impacts of your work? [Yes] We have discussed this at the end of the paper. \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1404
+ "bbox": [
1405
+ 236,
1406
+ 780,
1407
+ 825,
1408
+ 912
1409
+ ],
1410
+ "page_idx": 10
1411
+ },
1412
+ {
1413
+ "type": "text",
1414
+ "text": "2. If you are including theoretical results... ",
1415
+ "bbox": [
1416
+ 214,
1417
+ 92,
1418
+ 493,
1419
+ 106
1420
+ ],
1421
+ "page_idx": 11
1422
+ },
1423
+ {
1424
+ "type": "text",
1425
+ "text": "(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] ",
1426
+ "bbox": [
1427
+ 238,
1428
+ 109,
1429
+ 735,
1430
+ 141
1431
+ ],
1432
+ "page_idx": 11
1433
+ },
1434
+ {
1435
+ "type": "text",
1436
+ "text": "3. If you ran experiments... ",
1437
+ "bbox": [
1438
+ 212,
1439
+ 145,
1440
+ 393,
1441
+ 160
1442
+ ],
1443
+ "page_idx": 11
1444
+ },
1445
+ {
1446
+ "type": "text",
1447
+ "text": "(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A] Our work presents a theoretical framework and does not contain any experimental study. \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A] \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] \n(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] ",
1448
+ "bbox": [
1449
+ 238,
1450
+ 164,
1451
+ 825,
1452
+ 296
1453
+ ],
1454
+ "page_idx": 11
1455
+ },
1456
+ {
1457
+ "type": "text",
1458
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1459
+ "bbox": [
1460
+ 215,
1461
+ 301,
1462
+ 823,
1463
+ 315
1464
+ ],
1465
+ "page_idx": 11
1466
+ },
1467
+ {
1468
+ "type": "text",
1469
+ "text": "(a) If your work uses existing assets, did you cite the creators? [N/A] \n(b) Did you mention the license of the assets? [N/A] \n(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] \n(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] ",
1470
+ "bbox": [
1471
+ 238,
1472
+ 319,
1473
+ 825,
1474
+ 440
1475
+ ],
1476
+ "page_idx": 11
1477
+ },
1478
+ {
1479
+ "type": "text",
1480
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1481
+ "bbox": [
1482
+ 214,
1483
+ 444,
1484
+ 705,
1485
+ 459
1486
+ ],
1487
+ "page_idx": 11
1488
+ },
1489
+ {
1490
+ "type": "text",
1491
+ "text": "(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] \n(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] \n(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] ",
1492
+ "bbox": [
1493
+ 238,
1494
+ 463,
1495
+ 825,
1496
+ 553
1497
+ ],
1498
+ "page_idx": 11
1499
+ }
1500
+ ]
parse/train/4-gBZAkF9ze/4-gBZAkF9ze_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/4-gBZAkF9ze/4-gBZAkF9ze_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HJGven05Y7/HJGven05Y7_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/LGgdb4TS4Z/LGgdb4TS4Z.md ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOPOLOGY-AWARE SEGMENTATION USING DISCRETE MORSE THEORY
2
+
3
+ Xiaoling $\mathbf { H } \mathbf { u } ^ { \mathrm { ~ * ~ } }$ Stony Brook University
4
+
5
+ Yusu Wang University of California, San Diego
6
+
7
+ Li Fuxin Oregon State University
8
+
9
+ Dimitris Samaras Stony Brook University
10
+
11
+ Chao Chen Stony Brook University
12
+
13
+ # ABSTRACT
14
+
15
+ In the segmentation of fine-scale structures from natural and biomedical images, per-pixel accuracy is not the only metric of concern. Topological correctness, such as vessel connectivity and membrane closure, is crucial for downstream analysis tasks. In this paper, we propose a new approach to train deep image segmentation networks for better topological accuracy. In particular, leveraging the power of discrete Morse theory (DMT), we identify global structures, including 1D skeletons and 2D patches, which are important for topological accuracy. Trained with a novel loss based on these global structures, the network performance is significantly improved especially near topologically challenging locations (such as weak spots of connections and membranes). On diverse datasets, our method achieves superior performance on both the DICE score and topological metrics.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Segmenting objects while preserving their global structure is a challenging yet important problem. Various methods have been proposed to encourage neural networks to preserve fine details of objects (Long et al., 2015; He et al., 2017; Chen et al., 2014; 2018; 2017). Despite their high per-pixel accuracy, most of them are still prone to structural errors, such as missing small object instances, breaking thin connections, and leaving holes in membranes. These structural errors can significantly damage downstream analysis. For example, in the segmentation of biomedical structures such as membranes and vessels, small pixel errors at a junction will induce significant structure error, leading to catastrophic functional mistakes. See Fig. 1 for an illustration.
20
+
21
+ Topology is a very global characterization that needs a lot of observations to learn. Any training set is insufficient in teaching the network to correctly reason about topology, especially near challenging spots, e.g., blurred membrane locations or weak vessel connections. A neural network tends to learn from the clean-cut cases and converge quickly. Meanwhile, topologically-challenging locations remain mis-classified, causing structural/topological errors. We note that this issue cannot be alleviated even with more annotated (yet still unbalanced) images.
22
+
23
+ We propose a novel approach that identifies critical topological structures during training and teaches a neural network to learn from these structures. Our method can produce segmentations with correct topology, i.e., having the same Betti number (i.e., number of connected components and handles/tunnels) as the ground truth. Underlying our method is the classic Morse theory (Milnor, 1963), which captures singularities of the gradient vector field of the likelihood function. Intuitively speaking, we treat the likelihood as a terrain function and Morse theory helps us capture terrain structures such as ridges and valleys. See Fig. 1 for an illustration. These structures, composed of 1D and 2D manifold pieces, reveal the topological information captured by the (potentially noisy) likelihood function.
24
+
25
+ We consider these Morse structures as topologically critical; they encompass all potential skeletons of the object. We propose a new loss that identifies these structures and enforce higher penalty along them. This way, we effectively address the sampling bias issue and ensure that the networks predict correctly near these topologically difficult locations. Since the Morse structures are identified based on the (potentially noisy) likelihood function, they can be both false negatives (a structure can be a true structure but was missed in the segmentation) and false positives (a hallucination of the model and should be removed). Our loss ensures that both kinds of structural mistakes are corrected.
26
+
27
+ ![](images/d029bdfe2277e2b4e3c941296bf2e116dade6a90ce605b3b012341e3147fdc2a.jpg)
28
+ Figure 1: Illustration of the importance of topological correctness in a neuron image segmentation task and the effectiveness of the proposed DMT-loss. The goal of this task is to segment membranes which partition the image into regions corresponding to neurons. (a) an input neuron image with challenging locations (blur regions) highlighted. (b) ground truth segmentation of the membranes (dark blue) and the result neuron regions. (c) likelihood map of a baseline method without topological guarantee (Ronneberger et al., 2015). (d) segmentation results of the baseline method. Small pixelwise errors lead to broken membranes, resulting in the merging of many neurons into one. (e) The topologically critical structure captured by the proposed DMT-loss (based on the likelihood in (c)). (f) Our method produces the correct topology and the correct partitioning of neurons.
29
+
30
+ Several technical challenges need to be addressed. First, classical Morse theory was defined for smooth functions on continuous domains. Computing the Morse structures can be expensive and numerically unstable. Furthermore, the entire set of Morse structures may include an excessive amount of structures, a large portion of which can be noisy, irrelevant ones. To address these challenges, we use the discrete version of Morse theory by Forman (1998; 2002). For efficiency purposes, we also use an approximation algorithm to compute 2D Morse structures with almost linear time. The idea is to compute zero dimensional Morse structures of the dual image, which boils down to a minimum spanning tree computation. Finally, we use the theory of persistent homology (Edelsbrunner et al., 2000; Edelsbrunner & Harer, 2010) to prune spurious Morse structures that are not relevant.
31
+
32
+ Our discrete-Morse-theory based loss, called the DMT-loss, can be evaluated efficiently and can effectively train the neural network to achieve high performance in both topological accuracy and per-pixel accuracy. Our method outperforms state-of-the-art methods in multiple topology-relevant metrics (e.g., ARI and VOI) on various 2D and 3D benchmarks. It has superior performance in the Betti number error, which is an exact measurement of the topological fidelity of the segmentation.
33
+
34
+ Related work. Closely related to our method are recent works on persistent-homology-based losses (Hu et al., 2019; Clough et al., 2019). These methods identify a set of critical points of the likelihood function, e.g., saddles and extrema, as topologically critical locations for the neural network to memorize. However, only identifying a sparse set of critical points at every epoch is inefficient in terms of training. Instead, our method identifies a much bigger set of critical locations at each epoch, i.e., 1D or 2D Morse skeletons (curves and patches). This is beneficial in both training efficiency and model performance. Extending the critical location sets from points to 1D curves and 2D patches makes it much more efficient in training. Compared with TopoLoss (Hu et al., 2019), we observe a 3-time speedup in practice. Furthermore, by focusing on more critical locations early, our method is more likely to escape poor local minima of the loss landscape. Thus it achieves better topological accuracy than TopoLoss. The shorter training time may also contribute to better stability of the SGD algorithm, and thus better test accuracy (Hardt et al., 2016).
35
+
36
+ Another topology-aware loss (Mosinska et al., 2018) uses pretrained filters to detect broken connections. However, this method cannot be generalized to unobserved geometry and higher dimensional topology (loops and voids). We also refer to other existing work on topological features and their applications (Adams et al., 2017; Reininghaus et al., 2015; Kusano et al., 2016; Carriere et al., 2017; Ni et al., 2017; Wu et al., 2017). Deep neural networks have also been proposed to learn from topological features directly extracted from data (Hofer et al., 2017; Carriere et al., 2019). \` Persistent-homology-inspired objective functions have been proposed for graphics (Poulenard et al., 2018) machine learning (Chen et al., 2019; Hofer et al., 2019). Discrete Morse theory has been used to identify skeleton structures from images; e.g., (Delgado-Friedrichs et al., 2015; Robins et al., 2011; Wang et al., 2015). The resulting 1D Morse structure has been used to enhance neural network architecture: e.g., in (Dey et al., 2019) it is used to both pre- and post-process images, while in (Banerjee et al., 2020), the 1D Morse skeleton is used as a topological prior (part of input) for an encoder-decoder deep network for semantic segmentation of microscopic neuroanatomical data. Our work, in contrast, uses Morse structures (beyond 1D) of the output to strengthen the global structural signal more explicitly in an end-to-end training of a network.
37
+
38
+ ![](images/4718f44af8f7bd6506248dc7c121ec37f67aee649f42a75894680d2cfdf5c69b.jpg)
39
+ Figure 2: Overview of our method. Topologically critical and error-prune structures are highlighted.
40
+
41
+ Many methods have leveraged the power of deep neural networks (Ronneberger et al., 2015; Long et al., 2015; Badrinarayanan et al., 2017; Ding et al., 2019; Kervadec et al., 2019; Karimi & Salcudean, 2019; Mosinska et al., 2018) for fine-scale structure segmentation. One may also enforce connectivity constraints when postprocessing the likelihood map (Han et al., 2003; Le Guyader & Vese, 2008; Sundaramoorthi & Yezzi, 2007; Segonne, 2008; Wu et al., 2017; Gao et al., 2013; Vicente et al., ´ 2008; Nowozin & Lampert, 2009; Zeng et al., 2008; Chen et al., 2011; Andres et al., 2011; Stuhmer et al., 2013; Oswald et al., 2014; Estrada et al., 2014). However, when the deep neural network itself is topology-agnostic, the likelihood map may be fundamentally flawed and cannot be salvaged topologically. Specific to neuron image segmentation, some methods (Funke et al., 2017; Turaga et al., 2009; Januszewski et al., 2018; Uzunbas et al., 2016; Ye et al., 2019) directly find neuron regions instead of their boundary/membranes. These methods cannot be generalized to other types of data such as satellite images, retinal images, vessel images, etc.
42
+
43
+ # 2 METHOD
44
+
45
+ We propose a novel loss to train a topology-aware network end-to-end. It uses global structures captured by discrete Morse theory (DMT) to discover critical topological structures. In particular, through the language of 1- and 2-stable manifolds, DMT helps identify 1D skeletons or 2D sheets (separating 3D regions) that may be critical for structural accuracy. These Morse structures are used to define a DMT-loss that is essentially the cross-entropy loss constrained to these topologically critical structures. As the training continues, the neural network learns to better predict around these critical structures, and eventually achieves better topological accuracy. Please refer to Fig. 2 for an overview of our method.
46
+
47
+ # 2.1 MORSE THEORY
48
+
49
+ Morse theory (Milnor, 1963) identifies topologically critical structures from a likelihood map (Fig. 3(a)). In particular, it views the likelihood as a terrain function (Fig. 3(b)) and extracts its landscape features such as mountain ridges and their high-dimensional counterparts. The broken connection in the likelihood map corresponds to a local dip in the mountain ridge of the terrain in Fig. 3(b) and Fig. 3(c). The bottom of this dip is captured by a so-called saddle point ( $S$ in Fig. 3(c)) of the likelihood map. The mountain ridge connected to this bottom point captures the main part of missing pixels. Such “mountain ridges” can be captured by the so-called stable manifold w.r.t. the saddle point using the language of Morse theory. By finding the saddle points and the stable manifold of the saddle points on the likelihood map, we can ensure the model learns to “correctly” handle pixels near these structures. We note that an analogous scenario can also happen with such 1D signals (such as blood vessels) as well as 2D signals (such as membranes of cells) in 3D images – they can also be captured by saddles (of different indices) and their stable manifolds.
50
+
51
+ ![](images/5010151b4ace4a9218cf7f4bbe564c4e8ed91e78bbe3d802c4d4ada65f7e5584.jpg)
52
+ Figure 3: From left to right: (a) Likelihood map. (b) Density map: the $z$ -axis value is the probability of the likelihood map in the left figure. (c) Density map for the highlighted region in the middle figure. $M _ { 1 }$ and $M _ { 2 }$ are maxima (red dots), $V$ is a minimum (yellow), $S$ is a saddle (green) with its stable manifolds flowing to it from $M _ { 1 }$ and $M _ { 2 }$ .
53
+
54
+ In this paper, we focus on the application of segmenting 2D and 3D images. Specifically, suppose we have a smooth function $f : \dot { \mathbb { R } ^ { d } } \to \mathbb { R }$ to model the likelihood (density) map. Given any point $\boldsymbol { x } \in \mathbb { R } ^ { d }$ , the negative gradient $\begin{array} { r } { - \nabla f ( x ) = - [ \frac { \partial f } { \partial x _ { 1 } } , \frac { \partial f } { \partial x _ { 2 } } , . . . , \frac { \partial f } { \partial x _ { d } } ] ^ { T } } \end{array}$ ∂f∂x ]T indicates the steepest descending direction of $f$ . A point $x = ( x _ { 1 } , x _ { 2 } , \ldots , x _ { k } )$ is critical if the function gradient at this point vanishes (i.e., $\nabla f ( x ) = 0 $ ). For a well-behaved function (more formally, called Morse function) defined on $\mathbb { R } ^ { d }$ , a critical point could be a minimum, a maximum, or $d - 1$ types of saddle points. See Fig. 3(c) for an example. For $d = 2$ , there is only one saddle point type. For $d = 3$ , there are two saddle point types, referred to as index-1 and index-2 saddles. Formally, when taking the eigen-values of the Hessian matrix at a critical point, its index is equal to the number of negative eigenvalues.
55
+
56
+ Intuitively, imagine we put a drop of water on the graph of $f$ (i.e, the terrain in Fig. 3(b)) at the lift of $x$ onto this terrain, then $- \nabla f ( x )$ indicates the direction along which the water will flow down. If we track the trajectory of this water drop as it flows down, this gives rise to a so-called integral line (a flow line). Such flow lines can only start and end at critical points1, where the gradient vanishes.
57
+
58
+ The stable manifold $\mathsf { S } ( p )$ of a critical point $p$ is defined as the collection of points whose flow line ends at $p$ . For a 2D function $f : \mathbb { R } ^ { 2 } \overset { \cdot } { } \mathbb { R }$ , for a saddle $q$ , its stable manifold ${ \mathsf { S } } ( q )$ starts from local maxima (mountain peaks in the terrain) and ends at $q$ , tracing out the mountain ridges separating different valleys (Fig. 3(c)). The stable manifold $\mathsf { S } ( p )$ of a minimum $p$ , on the other hand, corresponds to the entire valley around this minimum $p$ . See the valley point $V$ and its corresponding stable field in Fig. 3(c). For a 3D function $f : \mathbb { R } ^ { 3 } \mathbb { R }$ , the stable manifold w.r.t. an index-2 saddle connects mountain peaks to saddles, tracing 1D mountain ridges as in the case of a 2D function. The stable manifold w.r.t. an index-1 saddle $q$ consists of flow lines starting at index-2 saddles and ending at $q$ Their union, called the 2-stable manifold of $f$ , consists of a collection of 2-manifold pieces.
59
+
60
+ These stable manifolds indicate important topological structures (graph-like or sheet-like) based on the likelihood of the current neural network. Using these structures, we will propose a novel loss (Sec. 2.3) to improve the topological awareness of the model. In practice, for images, we will leverage the discrete version of Morse theory for both numerical stability and easier simplification.
61
+
62
+ Discrete Morse theory. Due to space limitations, we briefly explain discrete Morse theory, leaving technical details to Appendix A.2.1. We view a $d$ -dimensional image, $d = 2$ or 3, as a $d$ -dimensional cubical complex, meaning it consists of 0-, 1-, 2- and 3-dimensional cells corresponding to vertices (pixels/voxels), edges, squares, and cubes as its building blocks. Discrete Morse theory (DMT), originally introduced in (Forman, 1998; 2002), is a combinatorial version of Morse theory for general cell complexes. In this setting, the analog of a gradient vector is a pair of adjacent cells, called discrete gradient vectors. The analog of an integral line (flow line) is a sequence of such cell-pairs (discrete gradient vectors), forming a so-called V-path. Critical points correspond to critical cells which do not participate in any discrete gradient vectors. A minimum, an index-1 saddle, an index-2 saddle and a maximum for a 3D domain intuitively correspond to a critical vertex, a critical edge, a critical square and a critical cube respectively. A 1-stable manifold in 2D will correspond to a V-path, i.e., a sequence of cells, connecting a critical square (a maximum) and a critical edge (a saddle). See Fig. 3(c) for an illustration. In 3D, it will be a V-path connecting a critical cube and a critical square.
63
+
64
+ ![](images/7ad8e3790c3e7c20b370ccdf5302c1d423de6823b4efd4a2a1ac8543bb36ed72.jpg)
65
+ Figure 4: From left to right: (a) Sample likelihood map, (b) Ground truth, (c) improperly pruned structures and (d) properly pruned structures.
66
+
67
+ # 2.2 SIMPLIFICATION AND COMPUTATION
68
+
69
+ In this section, we describe how we extract discrete Morse structures corresponding to the 1-stable and 2-stable manifolds in the continuous analog. First, we prune unnecessary Morse structures, based on the theory of persistent homology (Edelsbrunner et al., 2000; Edelsbrunner & Harer, 2010). Second, we approximate the 2-stable manifold structures using 0-stable manifolds of the dual to achieve high efficiency in practice, because it is rather involved to compute based on the original definition.
70
+
71
+ Persistence-based structure pruning. While Morse structures reveal important structural information, they can be sensitive to noise. Without proper pruning, there can be an excessive amount of Morse structures, many of which are spurious and not relevant to the true signal. See Fig. 4(c) for an example. Similar to previous approaches e.g., (Sousbie, 2011; Delgado-Friedrichs et al., 2015; Wang et al., 2015), we will prune these structures using persistent homology.
72
+
73
+ Persistent homology is one of the most important developments in the field of topological data analysis in the past two decades (Edelsbrunner & Harer, 2010; Edelsbrunner et al., 2000). Intuitively speaking, we grow the complex by starting from the empty set and gradually include more and more cells using a decreasing threshold. Through this course, new topological features can be created upon adding a critical cell, and sometimes a feature can be destroyed upon adding another critical cell. The persistence algorithm (Edelsbrunner et al., 2000) will pair up these critical cells; that is, its output is a set of critical cell pairs, where each pair captures the birth and death of topological features during this evolution. The persistence of a pair is defined as the difference of function values of the two critical cells, intuitively measuring how long the topological feature lives in term of $f$ .
74
+
75
+ Using persistence, we can prune critical cells that are less topologically salient, and thus their corresponding Morse structures. Recall each 1- and 2-stable Morse structure is constituted by V-paths flowing into a critical cell (corresponding to a saddle in the continuous setting). We then use the persistence associated with this critical cell to determine the saliency of the corresponding Morse structure. If the persistence is below a certain threshold $\epsilon$ , we prune the corresponding Morse structure via an operation called Morse cancellation (more details are in the Appendix A.2.2).2 See Fig. 4(d) for example Morse structures after pruning. We denote by $S _ { 1 } ( \epsilon )$ and $\bar { \boldsymbol { S } } _ { 2 } ( \epsilon )$ the remaining sets of 1- and 2-stable manifolds after pruning. We’ll use these Morse structures to define the loss (Sec. 2.3).
76
+
77
+ Computation. We need an efficient algorithm to compute $S _ { 1 } ( \epsilon )$ and $S _ { 2 } ( \epsilon )$ from a given likelihood $f$ , because this computation needs to be carried out at each epoch. It is significantly more involved to define and compute $S _ { 2 } ( \epsilon )$ in the discrete Morse setting (Delgado-Friedrichs et al., 2015). Furthermore, this also requires the computation of persistent homology up to 2-dimensions, which takes time $T = O ( n ^ { \omega } )$ (where $\omega \approx 2 . 3 7$ is the exponent in the matrix multiplication time, i.e., the time to multiply two $n \times n$ matrices). To this end, we propose to approximate $S _ { 2 } ( \epsilon )$ by $\widehat { S } _ { 2 } ( \epsilon )$ (more details can be found in Appendix A.2.3) which intuitively comes from the “boundary” of the stable manifold for minima. Note that in the smooth case for a function $f : \mathbb { R } ^ { 3 } \mathbb { R }$ , the closure of 2-stable manifolds exactly corresponds to the 2D sheets on the boundary of stable manifolds of minima. 3 This is both conceptually clear and also avoids the costly persistence computation. In particular, given a minimum $q$ with persistence greater than the pruning threshold $\epsilon$ , the collections of V-paths ending at the minimum $q$ form a spanning tree $T _ { q }$ . In fact, consider all minima $\{ q _ { 1 } , \ldots , q _ { \ell } \}$ with persistence at least . $\{ T _ { q _ { i } } \}$ form a maximum spanning forest among all edges with persistence value smaller than $\epsilon$ (Bauer et al., 2012; Dey et al., 2018). Hence it can be computed easily in $O ( n \log n )$ time, where $n$ is the image size.
78
+
79
+ We then take all the edges incident to nodes from different trees. The dual of these edges, denoted as $\widehat { S } _ { 2 } ( \epsilon )$ , serves as the “boundaries” separating different spanning trees (representing stable manifolds to different minima with persistence $\geq \epsilon$ ). See Fig. 5. Overall, the computation of $\widehat { S } _ { 2 } ( \epsilon )$ takes only $O ( n \log n )$ by a maximum spanning tree algorithm.
80
+
81
+ As for $S _ { 1 } ( \epsilon )$ , we use a simplified algorithm of (Dey et al., 2018), which can compute $S _ { 1 } ( \epsilon )$ in $O ( n \log n )$ time for a 2D image, in which $n$ is the image size. For a 3D image, the time is $O ( n \log n + T )$ , where $T = { \cal { O } } ( n ^ { \omega } )$ is the time to compute persistent homology, where $\omega \approx 2 . 3 7$ is the exponent in matrix multiplication time.
82
+
83
+ ![](images/e15b49a58cc628664ec16153e13fdc8d2c77db59a909f895edfbba432535bba2.jpg)
84
+ Figure 5: Spanning tree illustration.
85
+
86
+ # 2.3 THE DMT-BASED LOSS FUNCTION AND TRAINING DETAILS
87
+
88
+ Our loss has two terms, the cross-entropy term, $L _ { b c e }$ and the DMT-loss, $L _ { d m t } \colon L ( f , g ) = L _ { b c e } ( f , g ) +$ $\beta L _ { d m t } ( f , g )$ , in which $f$ is the likelihood, $g$ is the ground truth, and $\beta$ is the weight of $L _ { d m t }$ . Here we focus on one single image, while the actual loss is aggregated over the whole training set.
89
+
90
+ The DMT-loss enforces the correctness of the topologically challenging locations discovered by our algorithm. These locations are pixels of the (approximation of) $1 \mathrm { - }$ and 2-stable manifolds $S _ { 1 } ( \epsilon )$ and $\widehat { S } _ { 2 } ( \epsilon )$ of the likelihood, $f$ (Fig. 1(e)). Denote by $\mathcal { M } _ { f }$ a binary mask of the union of pixels of all Morse structures in $S _ { 1 } ( \epsilon ) \cup \widehat { S } _ { 2 } ( \epsilon )$ . We want to enforce these locations to be correctly segmented. We use the cross-entropy between the likelihood map $f$ and ground truth $g$ restricted to the Morse structures, formally, $\bar { L _ { d m t } } ( f , g ) = \bar { L _ { b c e } } ( f \circ \mathcal { M } _ { f } , g \circ \bar { \mathcal { M } } _ { f } )$ , in which $\circ$ is the Hadamard product.
91
+
92
+ Different topological error types. Recall that the Morse structures are computed over the potentially noisy likelihood function of a neural network, which can help identify two types of structural errors: (1) false negative: a true structure that is incomplete in the segmentation, but can be visible in the Morse structures. This types of false negatives (broken connections, holes in membrane) can be restored as the additional cross-entropy loss near the Morse structures will force the network to increase its likelihood value on these structures. (2) false positive: phantom structures hallucinated by the network when they do not exist (spurious branches, membrane pieces). These errors can be eliminated as the extra cross entropy loss on these structures will force the network to decrease the likelihood values along these structures. We provide a more thorough discussion in the Appendix A.1.2.
93
+
94
+ Differentiability. We note that the Morse structures are recomputed at every epoch. The structures, as well as their mask $\mathcal { M } _ { f }$ , may change with $f$ . However, the change is not continuous; the output of the discrete Morse algorithm is a combinatorial solution that does not change continuously with $f$ . Instead, it only changes at singularities, i.e., when the function values of $f$ at different pixels/voxels are the same. In other words, for a general $f$ , the likelihood function is real-valued, so it is unlikely two pixels share the exact same value. In case that they are, the persistence homology algorithm by default will break the tie and choose one as critical. The mask $\mathcal { M } _ { f }$ remains a constant within a small neighborhood of current $f$ . Therefore, the gradient of $L _ { d m t }$ exists and can be computed naturally.
95
+
96
+ Training details. Although our method is architecture-agnostic, for 2D datasets, we select an architecture driven by a 2D U-net (Ronneberger et al., 2015); for 3D datasets, we select an architecture inspired by a 3D U-Net (C¸ ic¸ek et al., 2016). Both U-Net and 3D U-Net were originally designed for neuron segmentation tasks, capturing the fine-structures of images. In practice, we first pretrain the network with only the cross-entropy loss, and then train the network with the combined loss.
97
+
98
+ # 3 EXPERIMENTS ON 2D AND 3D DATASETS
99
+
100
+ Experiments on 2D dataset. Six natural and biomedical 2D datasets are used: ISBI12 (ArgandaCarreras et al., 2015), ISBI13 (Arganda-Carreras et al., 2013), CREMI, CrackTree (Zou et al., 2012), Road (Mnih, 2013) and DRIVE (Staal et al., 2004). More details about the datasets are included in Appendix A.3.1. For all the experiments, we use a 3-fold cross-validation to tune hyperparameters for both the proposed method and other baselines, and report the mean performance over the validation set. This also holds for 3D experiments.
101
+
102
+ Evaluation metrics. We use five different evaluation metrics: Pixel-wise accuracy, DICE score, ARI, VOI and the most important one is Betti number error, which directly compares the topology (number of handles/voids) between the segmentation and the ground truth. More details about the evaluation metrics are provided in Appendix A.3.2. The last three metrics are topology-aware.
103
+
104
+ Table 1: Quantitative results for different models on several 2D image datasets
105
+
106
+ <table><tr><td>Method</td><td>Accuracy</td><td>DICE</td><td>ARI</td><td>VOI</td><td>Betti Error</td></tr><tr><td colspan="6">ISBI13</td></tr><tr><td>DIVE U-Net Mosin. TopoLoss</td><td>0.9642 ± 0.0018 0.9658± 0.0020 0.6923± 0.0134 2.790± 0.025 3.875 ±0.326 0.9631 ± 0.0024 0.9649 ± 0.0057 0.7031 ± 0.0256 2.583 ± 0.078 3.463 ± 0.435 0.9578 ± 0.0029 0.9623 ± 0.0047 0.7483 ± 0.0367 1.534 ± 0.063 2.952 ± 0.379</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="4">0.9569 ± 0.0031 0.9689 ±0.0026 0.8064 ± 0.0112 1.436 ± 0.008 1.253±0.172 DMT 0.9625 ± 0.0027 0.9712 ± 0.0047 0.8289 ± 0.0189 1.176 ± 0.052 1.102 ± 0.203</td><td></td><td></td></tr><tr><td colspan="4">CREMI DIVE 0.9498 ± 0.0029 0.9542 ± 0.0037 0.6532 ± 0.0247 2.513 ± 0.047 4.378 ± 0.152 0.9468 ± 0.0048 0.9523 ± 0.0049 0.6723 ± 0.0312 2.346 ± 0.105 3.016 ± 0.253</td><td></td><td></td></tr><tr><td>U-Net Mosin. TopoLoss DMT</td><td>0.9467 ± 0.0058 0.9489 ± 0.0053 0.7853 ± 0.0281 1.623 ± 0.083 1.973 ± 0.310 0.9456 ± 0.0053 0.9596 ± 0.0029 0.8083 ± 0.0104 1.462 ± 0.028</td><td></td><td></td><td></td><td>31.113±0.224</td></tr><tr><td colspan="4">0.9475 ± 0.0031 0.9653 ± 0.0019 0.8203 ± 0.0147 1.089 ± 0.061 CrackTree</td><td></td><td>0.982 ± 0.179</td></tr><tr><td>DIVE U-Net Mosin.</td><td>0.9854± 0.0052 0.6530± 0.0017 0.8634 ± 0.0376 1.570± 0.078 1.576 ± 0.287 0.9821 ± 0.0097 0.6491 ± 0.0029 0.8749 ± 0.0421 1.625 ± 0.104 1.785 ± 0.303</td><td></td><td></td><td></td><td></td></tr><tr><td>TopoLoss</td><td>0.9833 ± 0.0067 0.6527 ± 0.0010 0.8897 ± 0.0201 1.113 ± 0.057 1.045 ± 0.214 0.9826 ± 0.0084 0.6732 ± 0.0041 0.9291 ±0.0123 0.997 ± 0.011(</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>0.672 ± 0.176</td></tr><tr><td colspan="4"></td><td></td><td></td></tr><tr><td>DMT</td><td>0.9842 ± 0.0041 0.6811 ± 0.0047 0.9307 ± 0.0172 0.901 ± 0.081</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>0.518 ± 0.189</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>Road</td><td></td><td></td></tr><tr><td>DIVE</td><td>0.9734 ± 0.0077 0.6743 ± 0.0051 0.8201 ± 0.0128 2.368 ± 0.203 3.598 ± 0.783</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>U-Net</td><td>0.9786 ± 0.0052 0.6612 ± 0.0016 0.8189 ± 0.0097 2.249 ± 0.175</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>53.439±0.621</td></tr><tr><td>Mosin.</td><td>0.9754 ± 0.0043 0.6673 ± 0.0044 0.8456 ± 0.0174 1.457 ± 0.096 2.781 ± 0.237</td><td></td><td></td><td></td></tr><tr><td>TopoLoss</td><td></td><td>0.9728 ± 0.0063 0.6903 ± 0.0038 0.8671 ± 0.0068 1.234 ± 0.037 1.275 ±0.192</td><td></td><td></td></tr></table>
107
+
108
+ Baselines. DIVE (Fakhry et al., 2016) is a popular neural network that predicts the probability of a pixel being a membrane (border) pixel or not. U-Net (Ronneberger et al., 2015) is one of the most powerful image segmentation methods trained with cross-entropy loss. Mosin. (Mosinska et al., 2018) uses a topology-aware loss based on the response of selected filters from a pretrained CNN. TopoLoss (Hu et al., 2019) proposes a novel topological loss to learn to segment with correct topology. For all methods, we generate segmentations by thresholding the predicted likelihood maps at 0.5, and this also holds for 3D experiments.
109
+
110
+ Quantitative and qualitative results. Table 1 shows quantitative results for four 2D image datasets, ISBI13, CREMI, CrackTree and Road. The results are highlighted when they are significantly better, and statistical significance is determined by t-tests. Results for ISBI12 and DRIVE are included in Appendix A.3.3. The DMT-loss outperforms others in both DICE score and topological accuracy (ARI, VOI and Betti Error). Please note that here the backbone of TopoLoss is the same as in (Hu et al., 2019), a heavily engineered network. The performance of TopoLoss will be worse if we implement it using the same U-Net backbone as DMT-Loss. Comparisons with the same backbones can be found in Appendix A.3.4.
111
+
112
+ Fig. 6 shows qualitative results. Our method correctly segments fine structures such as membranes, roads and vessels. Our loss is a weighted combination of the cross entropy and DMT-losses. When $\beta = 0$ , the proposed method degrades to a standard U-Net. The performance improvement over all datasets (U-Net and DMT line in Table 1) demonstrates that our DMT-loss is helping the deep neural nets to learn a better structural segmentation.
113
+
114
+ Experiments on 3D datasets. We use three different biomedical 3D datasets: ISBI13, CREMI and 3Dircadb (Soler et al., 2010). ISBI13 and CREMI, which have been discussed above, are originally 3D datasets, can be used in both 2D and 3D evaluations. We also evaluate our method on the open dataset 3Dircadb, which contains 20 enhanced CT volumes with artery annotations.
115
+
116
+ Evaluation metrics. We use similar evaluation metrics as the 2D part. Note that, in term of 2D images, for ARI and VOI, we compute the numbers for each slice and then average the numbers for different slices as the final performance; for 3D images, we compute the performance for the whole
117
+
118
+ ![](images/9d314533d98cfaecf5c49496b574c4c0200fad647a4f7137a2a7bfd70e22c388.jpg)
119
+ Figure 6: Qualitative results of the proposed method compared to other models. From left to right: sample images, ground truth, results for DIVE, U-Net, Mosin., TopoLoss and our proposed DMT.
120
+
121
+ Table 2: Quantitative results for different models on several 3D datasets
122
+
123
+ <table><tr><td>Method</td><td>Accuracy</td><td>DICE</td><td>ARI</td><td>VOI</td><td>Betti Error</td></tr><tr><td colspan="6">ISBI13</td></tr><tr><td>3DDIVE 3D U-Net 0.9746 ± 0.0025 0.9701 ± 0.0012 0.8956 ± 0.03911.123 ± 0.091 1.954 ± 0.585 MALA 0.9701 ± 0.0018 0.9699 ± 0.0013 0.8945 ± 0.0481 0.901 ± 0.106 1.103 ± 0.207 3D TopoL0ss 0.9689 ± 0.0031 0.9752 ± 0.0045 0.9043 ± 0.0283 0.792 ± 0.086 0.972 ± 0.245</td><td>0.9723 ± 0.0021 0.9681 ± 0.0043 0.8719 ± 0.0189 1.208 ± 0.149 2.375 ± 0.419</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="4">DMT 0.9701 ± 0.0026 0.9803 ± 0.0019 0.9149 ± 0.0217 0.634 ± 0.086 0.812 ± 0.134 CREMI</td><td></td><td></td></tr><tr><td colspan="4">3D DIVE 0.9503 ± 0.0061 0.9641 ± 0.0011 0.8514 ± 0.0387 1.219 ± 0.103 2.674 ± 0.473 3D U-Net 0.9547 ± 0.0038 0.9618 ± 0.0026 0.8322 ± 0.0315 1.416 ± 0.097 2.313 ± 0.501 MALA 0.9472 ± 0.0027 0.9583 ± 0.0023 0.8713 ± 0.0286 1.109 ± 0.093 1.114 ± 0.309 3D TopoL0ss 0.9523 ± 0.0043 0.9672 ± 0.0010 0.8726 ± 0.0194 1.044 ± 0.128 1.076 ± 0.206</td><td></td><td></td></tr><tr><td colspan="4">DMT 0.9529 ± 0.0031 0.9731 ± 0.0045 0.9013 ± 0.0202 0.891± 0.099 0.726 ± 0.187 3Dircadb</td><td></td><td></td></tr><tr><td colspan="2">3D DIVE</td><td>0.9618± 0.0054 0.6097± 0.0034</td><td></td><td></td><td>4.571 ± 0.505</td></tr><tr><td colspan="2">3D U-Net MALA</td><td>0.9632 ±0.0009 0.5898 ±0.0025</td><td></td><td>/</td><td></td></tr><tr><td colspan="2">0.9546±0.0033 0.5719 ±0.0043 3D TopoL0ss 0.9561 ± 0.0019 0.6138 ± 0.0029</td><td></td><td>/</td><td></td><td>4.131 ± 0.483 2.982 ± 0.105</td></tr><tr><td colspan="2">DMT</td><td>0.9587 ± 0.0023 0.6257 ± 0.0021</td><td>/</td><td>/</td><td>2.245 ± 0.255</td></tr></table>
124
+
125
+ volume. For 2D images, we compute the 1D Betti number (number of holes) to obtain the Betti Error;
126
+ while for 3D images, we compute the 2D Betti number (number of voids) to obtain the Betti Error.
127
+
128
+ Baselines. 3D DIVE (Zeng et al., 2017), 3D U-Net (C¸ ic¸ek et al., 2016), 3D TopoLoss (Hu et al., 2019) are the 3D versions for DIVE, U-Net and TopoLoss. MALA (Funke et al., 2017) trains the U-Net using a new structured loss function.
129
+
130
+ Quantitative and qualitative results. Table 2 shows the quantitative results for three different 3D image datasets, ISBI13, CREMI and 3Dircadb. Our method outperforms existing methods in topological accuracy (in all three topology-aware metrics), which demonstrates the effectiveness of the proposed method. More qualitative results for 3D cases are included in Appendix A.3.5.
131
+
132
+ The benefit of the proposed DMT-loss. Instead of capturing isolated critical points in TopoLoss (Hu et al., 2019), the proposed DMT-loss captures the whole V-path as critical structures. Taking the patch in Fig. 4(a) as an example, TopoLoss identifies $\approx 8 0$ isolated critical pixels for further training, whereas the critical structures captured by the DMT-loss contain $\approx 1 0 0 0$ critical pixels (Fig. 4(d)). We compare the efficiency of DMT-loss and TopoLoss using the same backbone network, evaluated on the CREMI 2D dataset. Both methods start from a reasonable pre-trained likelihood map. TopoLoss achieves 1.113 (Betti Error), taking ${ \approx } 3 \mathrm { h }$ to converge; while DMT-loss achieves 0.956 (Betti Error), taking ${ \approx } 1 . 2 \mathrm { h }$ to converge (the standard U-Net takes ${ \approx } 0 . 5 \mathrm { h }$ instead). Aside from converging faster, the DMT-loss is also less likely to converge to low-quality local minima. We hypothesize that the loss landscape of the topological loss will have more local minima than that of the DMT-loss, even though the global minima of both landscapes may have the same quality.
133
+
134
+ ![](images/7dafce953e80715b65f735c173f5ad688e5eb4028daf994c25560aad96f826d5.jpg)
135
+ Figure 7: Illustration of comparison between the proposed DMT-loss and a simple reweighted cross entropy loss. Please refer to Fig. 10(b) for the likelihood map of a baseline method without topological guarantee. (a) an input neuron image. (b) The topologically critical structures from the likelihood, captured by the proposed discrete Morse algorithm. These structures will be used in the DMT-Loss. (c) ground truth. (d) The FP/FN pixels identified by simple re-weighting cross entropy loss.
136
+
137
+ Ablation study for persistence threshold $\epsilon$ . As illustrated in Fig. 4, different persistence thresholds $\epsilon$ will identify different critical structures. The ablation experiment is also conducted on the CREMI 2D dataset. When $\epsilon = 0 . 2$ (See Fig. 4(d)), the proposed DMT-loss achieves the best performance 0.982 (Betti Error). When $\epsilon = 0 . 1$ and $\epsilon = 0 . 3$ , the performance drops to 1.206 and 2.105 (both in Betti Error), respectively. This makes sense for the following reasons: 1) for $\epsilon = 0 . 1$ , the DMT-loss captures lots of unnecessary structures which mislead the neural networks; 2) for $\epsilon = 0 . 3$ , the DMTloss misses lots of important critical structures, making the performance drop significantly. The $\epsilon$ is chosen via cross-validation. The ablation study for balanced term $\beta$ is provided in Appendix A.3.6.
138
+
139
+ Comparison with other simpler choices. The proposed method essentially highlights geometrically rich locations. To demonstrate the effectiveness of the proposed method, we also compare with two baselines: canny edge detection, and ridge detection, which achieve 2.971 and 2.507 in terms of Betti Error respectively, much worse than our results (Betti Error: 0.982). Although our focus is the Betti error, we also report per-pixel accuracy for reference (See Table 5 in Appendix for details). From the results we observe that the baseline models could not solve topological errors, even though they achieve high per-pixel accuracy. Without a persistent-homology based pruning, these baselines generate too many noisy structures, and thus are not as effective as DMT-loss.
140
+
141
+ Robustness of the proposed method. We run another ablation study on images corrupted with Gaussian noise. The experiment is also conducted on the CREMI 2D dataset. From the results (See Table 6 in Appendix for details), the DMT-loss is fairly robust and maintains good performance even with high noise levels. The reason is that the Morse structures are computed on the likelihood map, which is already robust to noise.
142
+
143
+ Comparison with reweighted cross entropy loss. We run an additional ablation study to compare with a baseline of reweighting the FP and FN pixels in the cross-entropy loss (Reweighting CE). The weights of the FP/FN pixels are hyperparameters tuned via cross-validation. The reweighting CE strategy achieves 2.753 in terms of Betti Error (on CREMI 2D data), and the DMT-loss is better than this baseline. The reason is that the DMT-loss specifically penalizes FP and FN pixels which are topology-critical. Meanwhile, reweighting CE adds weights to FP/FN pixels without discrimination. A majority of these misclassified pixels are not topology-critical. They are near the boundary of the foreground. Please see Fig. 7 for an illustration.
144
+
145
+ # 4 CONCLUSION
146
+
147
+ In this paper, we proposed a new DMT-loss to train deep image segmentation neural networks for better topological accuracy. With the power of discrete Morse theory (DMT), we could identify 1D skeletons and 2D patches which are important for topological accuracy. Trained with the new loss based on these global structures, the networks perform significantly better, especially near topologically challenging locations (such as weak spots of connections and membranes).
148
+
149
+ Acknowledgements. The research of Xiaoling Hu and Chao Chen is partially supported by NSF IIS-1909038. The research of Li Fuxin is partially supported by NSF IIS-1911232. The research of Yusu Wang is partially supported by NSF under grants CCF-1733798, RI-1815697, and by NIH under grants R01EB022899, RF1MH125317. Dimitris Samaras is partially supported by a gift from Adobe, the Partner University Fund, the NSF IUCRC for Visual and Decision Informatics and the SUNY2020 Infrastructure Transportation Security Center.
150
+
151
+ # REFERENCES
152
+
153
+ Henry Adams, Tegan Emerson, Michael Kirby, Rachel Neville, Chris Peterson, Patrick Shipman, Sofya Chepushtanova, Eric Hanson, Francis Motta, and Lori Ziegelmeier. Persistence images: A stable vector representation of persistent homology. The Journal of Machine Learning Research, 18(1):218–252, 2017.
154
+
155
+ Bjoern Andres, Jorg H Kappes, Thorsten Beier, Ullrich K ¨ othe, and Fred A Hamprecht. Probabilistic ¨ image segmentation with closedness constraints. In 2011 International Conference on Computer Vision, pp. 2611–2618. IEEE, 2011.
156
+
157
+ I Arganda-Carreras, HS Seung, A Vishwanathan, and D Berger. 3d segmentation of neurites in em images challenge-isbi 2013, 2013.
158
+
159
+ Ignacio Arganda-Carreras, Srinivas C Turaga, Daniel R Berger, Dan Cires¸an, Alessandro Giusti, Luca M Gambardella, Jurgen Schmidhuber, Dmitry Laptev, Sarvesh Dwivedi, Joachim M Buh- ¨ mann, et al. Crowdsourcing the creation of image segmentation algorithms for connectomics. Frontiers in neuroanatomy, 9:142, 2015.
160
+
161
+ Vijay Badrinarayanan, Alex Kendall, and Roberto Cipolla. Segnet: A deep convolutional encoderdecoder architecture for image segmentation. IEEE transactions on pattern analysis and machine intelligence, 39(12):2481–2495, 2017.
162
+
163
+ Samik Banerjee, Lucas Magee, Dingkang Wang, Xu Li, Bing-Xing Huo, Jaikishan Jayakumar, Katherine Matho, Meng-Kuan Lin, Keerthi Ram, Mohanasankar Sivaprakasam, et al. Semantic segmentation of microscopic neuroanatomical data by combining topological priors with encoder– decoder deep networks. Nature Machine Intelligence, 2(10):585–594, 2020.
164
+
165
+ U. Bauer, C. Lange, and M. Wardetzky. Optimal topological simplification of discrete functions on surfaces. Discr. Comput. Geom., 47(2):347–377, 2012. ISSN 1432-0444.
166
+
167
+ Mathieu Carriere, Marco Cuturi, and Steve Oudot. Sliced wasserstein kernel for persistence diagrams. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 664–673. JMLR. org, 2017.
168
+
169
+ Mathieu Carriere, Fr \` ed´ eric Chazal, Yuichi Ike, Th ´ eo Lacombe, Martin Royer, and Yuhei Umeda. ´ A general neural network architecture for persistence diagrams and graph classification. arXiv preprint arXiv:1904.09378, 2019.
170
+
171
+ Chao Chen, Daniel Freedman, and Christoph H Lampert. Enforcing topological constraints in random field image segmentation. In CVPR 2011, pp. 2089–2096. IEEE, 2011.
172
+
173
+ Chao Chen, Xiuyan Ni, Qinxun Bai, and Yusu Wang. A topological regularizer for classifiers via persistent homology. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 2573–2582, 2019.
174
+
175
+ Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Semantic image segmentation with deep convolutional nets and fully connected crfs. arXiv preprint arXiv:1412.7062, 2014.
176
+
177
+ Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017.
178
+
179
+ Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE transactions on pattern analysis and machine intelligence, 40(4):834–848, 2018.
180
+
181
+ Ozg ¨ un¨ C¸ ic¸ek, Ahmed Abdulkadir, Soeren S Lienkamp, Thomas Brox, and Olaf Ronneberger. 3d u-net: learning dense volumetric segmentation from sparse annotation. In International conference on medical image computing and computer-assisted intervention, pp. 424–432. Springer, 2016.
182
+
183
+ James R. Clough, Ilkay Oksuz, Nicholas Byrne, Veronika A. Zimmer, Julia A. Schnabel, and Andrew P. King. A topological loss function for deep-learning based image segmentation using persistent homology, 2019. arXiv preprint at arXiv:1910.01877.
184
+
185
+ O. Delgado-Friedrichs, V. Robins, and A. Sheppard. Skeletonization and partitioning of digital images using discrete morse theory. IEEE Trans. Pattern Anal. Machine Intelligence, 37(3):654–666, March 2015. ISSN 0162-8828.
186
+
187
+ T. Dey, J. Wang, and Y. Wang. Road network reconstruction from satellite images with machine learning supported by topological methods. In Proc. 27th ACM SIGSPATIAL Intl. Conf. Adv. Geographic Information Systems (GIS), pp. 520–523, 2019.
188
+
189
+ Tamal K. Dey, Jiayuan Wang, and Yusu Wang. Graph reconstruction by discrete morse theory. In Proc. 34th Intl. Sympos. Comput. Geom. (SoCG), pp. 31:1–31:15, 2018.
190
+
191
+ Henghui Ding, Xudong Jiang, Ai Qun Liu, Nadia Magnenat Thalmann, and Gang Wang. Boundaryaware feature propagation for scene segmentation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 6819–6829, 2019.
192
+
193
+ Herbert Edelsbrunner and John Harer. Computational topology: an introduction. American Mathematical Soc., 2010.
194
+
195
+ Herbert Edelsbrunner, David Letscher, and Afra Zomorodian. Topological persistence and simplification. In Proceedings 41st Annual Symposium on Foundations of Computer Science, pp. 454–463. IEEE, 2000.
196
+
197
+ Rolando Estrada, Carlo Tomasi, Scott C Schmidler, and Sina Farsiu. Tree topology estimation. IEEE transactions on pattern analysis and machine intelligence, 37(8):1688–1701, 2014.
198
+
199
+ Ahmed Fakhry, Hanchuan Peng, and Shuiwang Ji. Deep models for brain em image segmentation: novel insights and improved performance. Bioinformatics, 32(15):2352–2358, 2016.
200
+
201
+ R. Forman. Morse theory for cell complexes. Advances in mathematics, 134(1):90–145, 1998.
202
+
203
+ Robin Forman. A user’s guide to discrete morse theory. Sem. Lothar. Combin ´ , 48:35pp, 2002.
204
+
205
+ Jan Funke, Fabian David Tschopp, William Grisaitis, Arlo Sheridan, Chandan Singh, Stephan Saalfeld, and Srinivas C Turaga. A deep structured learning approach towards automating connectome reconstruction from 3d electron micrographs. arXiv preprint arXiv:1709.02974, 2017.
206
+
207
+ Mingchen Gao, Chao Chen, Shaoting Zhang, Zhen Qian, Dimitris Metaxas, and Leon Axel. Segmenting the papillary muscles and the trabeculae from high resolution cardiac ct through restoration of topological handles. In International Conference on Information Processing in Medical Imaging, pp. 184–195. Springer, 2013.
208
+
209
+ Xiao Han, Chenyang Xu, and Jerry L. Prince. A topology preserving level set method for geometric deformable models. IEEE Transactions on Pattern Analysis and Machine Intelligence, 25(6): 755–768, 2003.
210
+
211
+ Moritz Hardt, Ben Recht, and Yoram Singer. Train faster, generalize better: Stability of stochastic gradient descent. In International Conference on Machine Learning, pp. 1225–1234, 2016.
212
+
213
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
214
+
215
+ Christoph Hofer, Roland Kwitt, Marc Niethammer, and Andreas Uhl. Deep learning with topological signatures. In Advances in Neural Information Processing Systems, pp. 1634–1644, 2017.
216
+
217
+ Christoph Hofer, Roland Kwitt, Mandar Dixit, and Marc Niethammer. Connectivity-optimized representation learning via persistent homology. arXiv preprint arXiv:1906.09003, 2019.
218
+
219
+ Xiaoling Hu, Fuxin Li, Dimitris Samaras, and Chao Chen. Topology-preserving deep image segmentation. In Advances in Neural Information Processing Systems, pp. 5658–5669, 2019.
220
+
221
+ Michał Januszewski, Jorgen Kornfeld, Peter H Li, Art Pope, Tim Blakely, Larry Lindsey, Jeremy ¨ Maitin-Shepard, Mike Tyka, Winfried Denk, and Viren Jain. High-precision automated reconstruction of neurons with flood-filling networks. Nature methods, 15(8):605–610, 2018.
222
+
223
+ Davood Karimi and Septimiu E Salcudean. Reducing the hausdorff distance in medical image segmentation with convolutional neural networks. arXiv preprint arXiv:1904.10030, 2019.
224
+
225
+ Hoel Kervadec, Jihene Bouchtiba, Christian Desrosiers, Eric Granger, Jose Dolz, and Ismail Ben Ayed. Boundary loss for highly unbalanced segmentation. In International Conference on Medical Imaging with Deep Learning, pp. 285–296, 2019.
226
+
227
+ Genki Kusano, Yasuaki Hiraoka, and Kenji Fukumizu. Persistence weighted gaussian kernel for topological data analysis. In International Conference on Machine Learning, pp. 2004–2013, 2016.
228
+
229
+ Carole Le Guyader and Luminita A Vese. Self-repelling snakes for topology-preserving segmentation models. IEEE Transactions on Image Processing, 17(5):767–779, 2008.
230
+
231
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431–3440, 2015.
232
+
233
+ John Milnor. Morse theory.(AM-51), volume 51. Princeton university press, 1963.
234
+
235
+ Volodymyr Mnih. Machine learning for aerial image labeling. University of Toronto (Canada), 2013.
236
+
237
+ Agata Mosinska, Pablo Marquez-Neila, Mateusz Kozinski, and Pascal Fua. Beyond the pixel-wise ´ loss for topology-aware delineation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3136–3145, 2018.
238
+
239
+ Xiuyan Ni, Novi Quadrianto, Yusu Wang, and Chao Chen. Composing tree graphical models with persistent homology features for clustering mixed-type data. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2622–2631. JMLR. org, 2017.
240
+
241
+ Sebastian Nowozin and Christoph H Lampert. Global connectivity potentials for random field models. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp. 818–825. IEEE, 2009.
242
+
243
+ Martin Ralf Oswald, Jan Stuhmer, and Daniel Cremers. Generalized connectivity constraints for ¨ spatio-temporal 3d reconstruction. In European Conference on Computer Vision, pp. 32–46. Springer, 2014.
244
+
245
+ Adrien Poulenard, Primoz Skraba, and Maks Ovsjanikov. Topological function optimization for continuous shape matching. In Computer Graphics Forum, volume 37, pp. 13–25. Wiley Online Library, 2018.
246
+
247
+ Jan Reininghaus, Stefan Huber, Ulrich Bauer, and Roland Kwitt. A stable multi-scale kernel for topological machine learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4741–4748, 2015.
248
+
249
+ V. Robins, P. J. Wood, and A. P. Sheppard. Theory and algorithms for constructing discrete morse complexes from grayscale digital images. IEEE Trans. Pattern Anal. Machine Intelligence, 33(8): 1646–1658, Aug 2011. ISSN 0162-8828.
250
+
251
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pp. 234–241. Springer, 2015.
252
+
253
+ Florent Segonne. Active contours under topology control—genus preserving level sets. ´ International Journal of Computer Vision, 79(2):107–117, 2008.
254
+
255
+ L Soler, A Hostettler, V Agnus, A Charnoz, J Fasquel, J Moreau, A Osswald, M Bouhadjar, and J Marescaux. 3d image reconstruction for comparison of algorithm database: a patient-specific anatomical and medical image database. IRCAD, Strasbourg, France, Tech. Rep, 2010.
256
+
257
+ T. Sousbie. The persistent cosmic web and its filamentary structure - I. Theory and implementation. 414:350–383, June 2011.
258
+
259
+ Joes Staal, Michael D Abramoff, Meindert Niemeijer, Max A Viergever, and Bram Van Ginneken. \` Ridge-based vessel segmentation in color images of the retina. IEEE transactions on medical imaging, 23(4):501–509, 2004.
260
+
261
+ Jan Stuhmer, Peter Schroder, and Daniel Cremers. Tree shape priors with connectivity constraints using convex relaxation on general graphs. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2336–2343, 2013.
262
+
263
+ Ganesh Sundaramoorthi and Anthony Yezzi. Global regularizing flows with topology preservation for active contours and polygons. IEEE Transactions on Image Processing, 16(3):803–812, 2007.
264
+
265
+ Srinivas C Turaga, Kevin L Briggman, Moritz Helmstaedter, Winfried Denk, and H Sebastian Seung. Maximin affinity learning of image segmentation. arXiv preprint arXiv:0911.5372, 2009.
266
+
267
+ Mustafa Gokhan Uzunbas, Chao Chen, and Dimitris Metaxas. An efficient conditional random field approach for automatic and interactive neuron segmentation. Medical image analysis, 27:31–44, 2016.
268
+
269
+ Sara Vicente, Vladimir Kolmogorov, and Carsten Rother. Graph cut based image segmentation with connectivity priors. In 2008 IEEE Conference on Computer Vision and Pattern Recognition, pp. 1–8. IEEE, 2008.
270
+
271
+ S. Wang, Y. Wang, and Y. Li. Efficient map reconstruction and augmentation via topological methods. In Proc. 23rd ACM SIGSPATIAL, pp. 25. ACM, 2015.
272
+
273
+ Pengxiang Wu, Chao Chen, Yusu Wang, Shaoting Zhang, Changhe Yuan, Zhen Qian, Dimitris Metaxas, and Leon Axel. Optimal topological cycles and their application in cardiac trabeculae restoration. In International Conference on Information Processing in Medical Imaging, pp. 80–92. Springer, 2017.
274
+
275
+ Ze Ye, Cong Chen, Changhe Yuan, and Chao Chen. Diverse multiple prediction on neuron image reconstruction. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 460–468. Springer, 2019.
276
+
277
+ Tao Zeng, Bian Wu, and Shuiwang Ji. Deepem3d: approaching human-level performance on 3d anisotropic em image segmentation. Bioinformatics, 33(16):2555–2562, 2017.
278
+
279
+ Yun Zeng, Dimitris Samaras, Wei Chen, and Qunsheng Peng. Topology cuts: A novel min-cut/maxflow algorithm for topology preserving segmentation in n–d images. Computer vision and image understanding, 112(1):81–90, 2008.
280
+
281
+ Afra Zomorodian and Gunnar Carlsson. Computing persistent homology. Discrete & Computational Geometry, 33(2):249–274, 2005.
282
+
283
+ Qin Zou, Yu Cao, Qingquan Li, Qingzhou Mao, and Song Wang. Cracktree: Automatic crack detection from pavement images. Pattern Recognition Letters, 33(3):227–238, 2012.
284
+
285
+ # A APPENDIX
286
+
287
+ In Sec. A.1, we will discuss different types of topological errors. In Sec. A.2, we will provide more details for the method part. In Sec. A.3, more details and results for the experiments will be provided.
288
+
289
+ A.1 DIFFERENT TYPES OF TOPOLOGICAL ERRORS
290
+
291
+ # A.1.1 ILLUSTRATION OF 3D TOPOLOGICAL ERRORS
292
+
293
+ In Sec.2.1 of the main paper, we have already introduced discrete Morse theory with a 2D example.
294
+ Here, we would like to illustrate 3D topological errors with 3D examples.
295
+
296
+ Fig. 8 and Fig. 9 illustrate two different types of topological errors for 3D data. Fig.8 illustrates an index-1 topological error for 3D synthetic data. 3D EM/neuron has the same type of topological error as the synthetic data. Fig.9 illustrates index-2 topological error for 3D vessel data.
297
+
298
+ ![](images/9f79c1868bdbb2ea3e535f5fea0be462c39481504054bf24873e24bf4711dd06.jpg)
299
+ Figure 8: Illustration of an index-1 topological error (3D hole in the middle) for a 3D synthetic data. The ground truth is a complete sheet without the hole. We intentionally weaken the likelihood function in the middle. So the segmentation has a hole in the middle. Left: 3D segmentation result. $S$ is a saddle point of the likelihood function. Its Hessian has 1 negative and 2 positive eigenvalues. The stable manifold of the saddle point $S$ is a 2D plane going through the saddle point and cutting the segmentation into two thin slices. Right: the likelihood function visualized on the 2D stable manifold of $S$ . Red arrows illustrate how different $V$ -paths (streamlines of negative gradient) flow to the saddle $S$ .
300
+
301
+ # A.1.2 FALSE NEGATIVE AND FALSE POSITIVE ERRORS
302
+
303
+ In the main paper, we have mentioned that the proposed DMT-loss can capture and fix two different types of topological errors: false negative and false positive. We illustrate these two types in Fig. 10. The two highlighted red rectangles represent the two types of topological errors: 1) The red rectangle on the right represents a sample of false negative error; part of the membrane structure is missing, due to a blurred region near the membrane. 2) The red rectangle on the left represents a sample of false positive error. In this specific case, it is caused by mitochondria which are not the boundary of neurons.
304
+
305
+ In summary, with the help of the proposed DMT-loss, we can identify both these two types of topological errors, and then force the network to increase/decrease its likelihood value on these structures to correctly segment the images with with correct topology.
306
+
307
+ # A.2 ADDITIONAL DETAILS ON THE METHOD
308
+
309
+ # A.2.1 DISCRETE MORSE THEORY
310
+
311
+ We view a $d \mathbf { D }$ image, $d = 2$ or 3, as a $d$ -dimensional cubical complex, meaning it consists of 0-, 1-, 2- and 3-dimensional cells corresponding to vertices, edges, squares, and voxels (cubes) as its building blocks.
312
+
313
+ Discrete Morse theory (DMT), originally introduced in (Forman, 1998; 2002), is a combinatorial version of Morse theory for general cell complexes. There are many beautiful results established for
314
+
315
+ ![](images/bce3089a3336d79b7d26c6ed82820c6d8d92223d36126b9a24c6efca1435410b.jpg)
316
+ Figure 9: Illustration of an index-2 topological error from a 3D vessel image. The vessel segmentation has a broken connection near bottom-left of the Left image. Left: part of the 3D segmentation result. A The saddle point $S$ corresponds to a broken connection. The Hessian of the likelihood at the saddle point has 2 negative and 1 positive eigenvalues. Right: One slice of the 3D likelihood map passing the saddle point. The saddle point (yellow) and its 1-stable manifold (red) are also drawn.
317
+
318
+ ![](images/fc0aec9108fbab88d465e54adc697fd48ad78237a129cc277b24b322ac49193f.jpg)
319
+ Figure 10: Illustration of two different types of topological errors captured by DMT-loss. (a) an input neuron image with challenging locations highlighted. (b) likelihood map of a baseline method without topological guarantee (Ronneberger et al., 2015). (c) ground truth. (d) The topologically critical structure from the likelihood, captured by the proposed discrete Morse algorithm. These structures will be used in the DMT-Loss.
320
+
321
+ DMT, analogous to classical Morse theory. We will however only briefly introduce some relevant concepts for the present paper, and we will describe it in the setting of cubical complexes (instead of simplicial complexes) as it is more suitable for images.
322
+
323
+ Let $K$ be a cubical complex. Given a $p$ -cell $\tau$ , we denote by $\sigma < \tau$ if $\sigma$ is a $( p - 1 )$ -dimensional face for $\tau$ . A discrete gradient vector (also called a V-pair for simplicity) is a pair $( \tau , \sigma )$ where $\sigma < \tau$ Now suppose we are given a collection of $\mathrm { V } .$ -pairs $\mathsf { M } ( K )$ over the cubical complex $K$ . A sequence of cells $\bar { \pi } : \tau _ { 0 } ^ { p + 1 } , \sigma _ { 1 } ^ { p } , \tau _ { 1 } ^ { p + 1 } , \sigma _ { 2 } ^ { p } , \cdot \cdot \cdot , \sigma _ { k } ^ { p } , \tau _ { k } ^ { p + \bar { 1 } } , \sigma _ { k + 1 } ^ { p }$ , where the superscript $p$ in $\alpha ^ { p }$ stands for the dimension of this cell $\alpha$ , form a V-path if $( \tau _ { i } , \sigma _ { i } ) \in \mathsf { M } ( K )$ for for any $i \in [ 1 , k ]$ and $\sigma _ { i } < \tau _ { i - 1 }$ for any $i \in [ 1 , k + 1 ]$ . A $\mathrm { v } .$ -path $\pi$ is acyclic if $( \tau _ { 0 } , \sigma _ { k + 1 } ) \notin \mathsf { M } ( K )$ . This collection of V-pairs ${ \mathsf { M } } ( K )$ form a discrete gradient vector fiel $l ^ { \bar { 4 } }$ if (cond-i) each cell in $\mathsf { M } ( K )$ can only appear in at most one pair in ${ \mathsf { M } } ( K )$ ; and (cond-ii) all $\mathrm { V } .$ -paths in $\mathsf { M } ( K )$ are acyclic. Given a discrete gradient vector field ${ \mathsf { M } } ( K )$ , a simplex $\sigma \in K$ is critical if it is not in any V-pair in ${ \mathsf { M } } ( K )$ .
324
+
325
+ Even though a discrete gradient vector (a V-pair), say $( \tau , \sigma )$ is a combinatorial pair instead of a real vector, it still indicates a “flow” from $\tau$ to its face $\sigma$ . A $\mathrm { V } .$ -path thus corresponds to a flow path (integral line) in the smooth setting. However, to make a collection of V-pairs a valid analog of gradient field, (cond-i) says that at each simplex there should only be one “flow” direction; while (cond-ii) is necessarily as flow lines traced by gradient can only go down in function values and thus never come back (thus acyclic).
326
+
327
+ A critical simplex has “vanishing gradient” as it is not involved in any $\mathrm { v } .$ -pair in ${ \mathsf { M } } ( K )$ (i.e, there is no flow at this simplex). Given a 2D cubical complex $K$ a a discrete gradient vector field ${ \mathsf { M } } ( K )$ , we can view critical 0-, 1-, 2- and 3-cells as minima, saddle points, and maxima, respectively. If $K$ is 3D, then we can view critical 0-, 1-, 2- and 3-cells as minima, index-1 saddle, index-2 saddle and maxima, respectively.
328
+
329
+ Hence, a 1-stable manifold in 2D will correspond to a V-path connecting a critical square (a maximum) and a critical edge (a saddle), while in 3D, it will be a V-path connecting a critical cube and a critical square.
330
+
331
+ Morse cancellation. A given discrete gradient field ${ \mathsf { M } } ( K )$ could be noisy, e.g, there are shallow valleys where the mountain ridge around it should be ignored. Fortunately, the discrete Morse theory provides an elegant and purely combinatorial way to cancel pairs of critical simplices (and thus reduce their stable manifolds). In particular, given ${ \mathsf { M } } ( K )$ , a pair of critical simplices $\langle \delta ^ { ( p + 1 ) , \gamma ^ { p } } \rangle$ is cancellable if there is a unique $\mathrm { v } .$ -path $\pi = \delta = \delta _ { 0 } , \gamma _ { 1 } , \delta _ { 1 } , . . . , \delta _ { s } , \gamma _ { s + 1 } = \gamma$ from $\delta$ to $\gamma$ . The Morse cancellation operation simple reverse all V-pairs along this path by removing all V-pairs along these path, and adding $( \delta _ { i - 1 } , \gamma _ { i } )$ to ${ \mathsf { M } } ( K )$ for any $i \in [ 1 , s + 1 ]$ . It is easy to check that after the cancellation neither $\delta$ nor $\gamma$ is critical.
332
+
333
+ # A.2.2 PERSISTENCE PRUNING
334
+
335
+ We can extend this vertex-valued function $\rho$ to a function $\rho : K \mathbb { R }$ , by setting $\rho ( \sigma )$ for each cell to be the maximum $\rho$ -value of each vertex in $\sigma$ . How to obtain a discrete gradient vector field from such function $\rho : K \mathbb { R } ?$ Following the approach developed in (Wang et al., 2015; Dey et al., 2018), we initialize a trivial discrete gradient vector field where all cells are initially critical. Let $\epsilon > 0$ be a threshold for simplification. We then perform persistence algorithm (Edelsbrunner et al., 2000) induced by the super-level set filtration of $\rho$ and pair up all cells in $K$ , denoted by ${ \mathcal { P } } _ { \rho } ( K )$ .
336
+
337
+ Persistent homology is one of the most important development in the field of topological data analysis in the past two decades (Edelsbrunner & Harer, 2010; Edelsbrunner et al., 2000; Zomorodian $\&$ Carlsson, 2005). We will not introduce it formally here. Imagine we grow the complex $K$ by starting from the empty set and gradually include more and more cells in decreasing $\rho$ values. (More formally, this is the so-called super-level set filtration of $K$ induced by $\rho$ .) Through this course, new topological feature can be created upon adding a simplex $\sigma$ , and sometiems a feature can be destroyed upon adding a simplex $\tau$ . Persistence algorithm (Edelsbrunner et al., 2000) will pair up simplices; that is, its output is a set of pairs of simplices ${ \mathcal { P } } _ { \rho } ( K ) = \{ ( \sigma , \tau ) \}$ , where each pair captures the birth and death of topological features during this evolution. The persistence of a pair, say ${ \sf p } = ( \sigma , \tau )$ , is defined as $\mathrm { p e r s } \bar { ( } \mathsf { p } ) \bar { = } \rho ( \sigma ) - \rho ( \tau )$ , measuring how long the topological feature captured by $\mathsf { p }$ lives in term of $\rho$ . In this case, we also write $\operatorname { p e r s } ( \sigma ) = \operatorname { p e r s } ( \tau ) = \operatorname { p e r s } ( { \mathsf { p } } ) -$ the persistence of a simplex (say $\sigma$ or $\tau$ ) can be viewed as the importance of this simplex.
338
+
339
+ With this intuition of the persistence pairings, we next perform Morse-cancellation operation to all pairs of these cells $( \sigma , \tau ) \in \mathcal { P } _ { \rho } ( K )$ in increasing order their persistence if (i) its persistence $\mathrm { p e r s } ( \delta , \gamma ) < \epsilon$ (i.e, this pair has low persistence and thus not important); and (ii) this pair $( \delta , \gamma )$ is cancellable.
340
+
341
+ Let $\mathsf { M } _ { \epsilon } ( K )$ be the resulting discrete gradient field after simplifying all low-persistence critical simplices. We then construct the 1-stable and 2-stable manifolds for the remaining (high persistence, and thus important) saddles (critical 1-cell and 2-cells) from $\mathsf { M } _ { \epsilon } ( K )$ . Let $\boldsymbol { \mathcal { S } } _ { 1 } ( \boldsymbol { \epsilon } )$ and $S _ { 2 } ( \epsilon )$ be the resulting collection of 1- and 2-stable manifolds respectively. In particular, see an illustration of a V-path (highlighted in black) corresponding to a 1-stable manifold of the green saddle in Fig. 3(c).
342
+
343
+ # A.2.3 MORE DETAILS ON THE APPROXIMATION OF $S _ { 2 }$ VIA $\hat { S } _ { 2 }$ .
344
+
345
+ We approximate $S _ { 2 }$ by taking the boundary of the stable manifold of the minima (basins/valleys in the terrain). This is like a watershed algorithm: growing the basins from all minima until they meet. The stable manifolds of the minima is approximated using spanning trees. This algorithm is inspired by the continuous analog for Morse functions.
346
+
347
+ # A.3 EXPERIMENTS
348
+
349
+ # A.3.1 DATASETS
350
+
351
+ We conduct experiments on six different 2D datasets. The first three datasets are neuron images (Electron Microscopy images). The task is to segment membranes and eventually partition the image into neuron regions.
352
+
353
+ CREMI contains 125 images. The resolution for each image is 1250x1250.
354
+
355
+ ISBI12 (Arganda-Carreras et al., 2015) contains 30 images. The resolution for each image is 512x512.
356
+
357
+ ISBI13 (Arganda-Carreras et al., 2013) contains 100 images. The resolution for each image is 1024x1024.
358
+
359
+ The next three are natural image datasets, and their structures are vital for their functionality.
360
+
361
+ CrackTree (Zou et al., 2012) contains 206 images of cracks in road. The resolution for each image is 600x800.
362
+
363
+ Road (Mnih, 2013) has 1108 images from the Massachusetts Roads Dataset. The resolution for each image is 1500x1500.
364
+
365
+ DRIVE (Staal et al., 2004) is a retinal vessel segmentation dataset with 20 images. The resolution for each image is 584x565.
366
+
367
+ # A.3.2 EVALUATION METRICS
368
+
369
+ We use five different evaluation metrics to evaluate the proposed DMT-loss.
370
+
371
+ Pixel-wise accuracy: Pixel-wise accuracy is one of the most common metrics which measures the percentage of correctly classified pixels.
372
+
373
+ DICE score: DICE score (also known as DICE coefficient, DICE similarity index) is the same as the F1 score.
374
+
375
+ Adapted Rand Index (ARI): ARI is the maximal F-score of the foreground-restricted Rand index, a measure of similarity between two clusters. On this version of the Rand index we exclude the zero component of the original labels (background pixels of the ground truth).
376
+
377
+ Variation of Information (VOI): VOI is a measure of the distance between two clusterings. It is closely related to mutual information; indeed, it is a simple linear expression involving the mutual information.
378
+
379
+ Betti number error: which directly compares the topology (number of handles) between the segmentation and the ground truth. We randomly sample patches over the segmentation and report the average absolute difference between their Betti numbers and the corresponding ground truth patches.
380
+
381
+ A.3.3 QUANTITATIVE RESULTS FOR MORE 2D DATASETS
382
+
383
+ Table. 3 shows quantitative results for ISBI12 and DRIVE.
384
+
385
+ # A.3.4 FAIRNESS COMPARISONS WITH SAME BACKBONE NETWORKS
386
+
387
+ We copy the numbers of TopoLoss from (Hu et al., 2019), which is TopoLoss+DIVE. And in this paper, we use U-Net as the backbone. Indeed, with U-Net, TopoLoss will be worse and the gap will be even bigger. The DIVE used in (Hu et al., 2019) is more expensive and better designed specifically for EM images. We choose U-Net in this manuscript as it is lightweight and easy to generalize to many datasets. We also apply our backbone-agnostic DMT-loss to the DIVE network (Fakhry et al., 2016). All the experiments are conducted on CREMI 2D dataset. The quantitative results (Betti Error) are shown in the Table 4.
388
+
389
+ A.3.5 QUALITATIVE RESULTS FOR 3D DATASETS
390
+
391
+ Fig. 11 shows qualitative results for ISBI13 dataset.
392
+
393
+ Table 3: Quantitative results for different models on several 2D medical datasets
394
+
395
+ <table><tr><td>Method</td><td>Accuracy</td><td>DICE</td><td>ARI</td><td>VOI</td><td>Betti Error</td></tr><tr><td colspan="6">ISBI12</td></tr><tr><td>DIVE U-Net Mosin.</td><td>0.9678 ± 0.0021 0.9699 ± 0.0048 0.9338 ± 0.0072 1.367 ± 0.031 2.785 ± 0.269</td><td></td><td></td><td></td><td>0.9640± 0.0042 0.9709± 0.0029 0.9434 ±0.0087 1.235 ±0.025 3.187 ±0.307</td></tr><tr><td>TopoLoss</td><td>0.9532 ± 0.0063 0.9716 ± 0.0022 0.9312 ± 0.0052 0.983 ± 0.035 1.238 ± 0.251</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="4">0.9626 ± 0.0038 0.9755 ± 0.0041 0.9444 ± 0.0076 0.782 ± 0.019 0.429±0.104 DMT 0.9593 ± 0.0035 0.9796 ±0.0033 0.9527 ±0.0052 0.671 ±0.027(</td></tr><tr><td></td><td></td><td></td><td>0.391 ± 0.114</td></tr><tr><td colspan="3"></td></tr><tr><td></td><td>DRIVE</td><td></td><td></td></tr><tr><td>DIVE 0.9549 ± 0.0023 0.7543 ± 0.0008 0.8407 ± 0.0257 1.936 ± 0.127 3.276 ± 0.642</td><td></td><td></td><td></td></tr><tr><td colspan="2">U-Net 0.9452 ± 0.0058 0.7491 ± 0.0027 0.8343 ± 0.0413 1.975 ± 0.046 3.643 ± 0.536</td><td></td><td></td></tr><tr><td colspan="2">Mosin. 0.9543 ± 0.0047 0.7218 ± 0.0013 0.8870 ± 0.0386 1.167 ± 0.026 2.784 ± 0.293</td><td></td><td></td></tr><tr><td colspan="2">TopoLoss 0.9521 ± 0.0042 0.7621 ± 0.0036 0.9024 ± 0.0113 1.083 ± 0.006 1.076± 0.265</td><td></td><td></td></tr></table>
396
+
397
+ Table 4: Comparison with same backbones
398
+
399
+ <table><tr><td>U-Net DIVE</td></tr><tr><td>TopoLoss 1.451± 0.216 1.113 ± 0.224</td></tr><tr><td>DMT-Loss 0.982 ± 0.179 0.956 ± 0.142</td></tr></table>
400
+
401
+ # A.3.6 THE ABLATION STUDY FOR BALANCED TERM $\beta$ .
402
+
403
+ We conduct another ablation study for the balanced weight of parameter $\beta$ . Note that, the parameter $\beta$ is dataset dependent. We conduct the ablation experiment on CREMI 2D dataset. When $\beta = 3$ , the proposed DMT-loss achieves best performance 0.982 (Betti Error). When $\beta = 2$ and $\beta = 4$ , the performance drops to 1.074 and 1.181 (both in Betti Error), respectively. The parameter $\beta$ is also chosen via cross-validation.
404
+
405
+ # A.3.7 COMPARISON WITH OTHER SIMPLER CHOICES
406
+
407
+ Table 5 shows the results comparing with Canny edge detection and ridge detection
408
+
409
+ Table 5: Comparison with other simpler choices
410
+
411
+ <table><tr><td>Method</td><td>Accuracy</td><td>Betti Error</td></tr><tr><td>DMT</td><td>0.9475</td><td>0.982</td></tr><tr><td>Canny edge detection</td><td>0.9386</td><td>2.971</td></tr><tr><td>Ridge detection</td><td>0.9443</td><td>2.507</td></tr></table>
412
+
413
+ # A.3.8 RESULTS WITH DIFFERENT NOISE LEVELS
414
+
415
+ In Table 6, $1 0 \%$ means the percentage of corrupted pixels, and $\delta / 2 \delta$ means the sdv of the added Gaussian noise. For reference, we note that the performance of the standard U-Net is 3.016 (Betti Error).
416
+
417
+ ![](images/cffa25462e423e398ae26e538837e8c5b96b0a8a08d649a0a640e75fd3f4f44b.jpg)
418
+ Figure 11: Segmentation results for ISBI13 dataset and 3 randomly selected neurons.
419
+
420
+ Table 6: Results with different noise levels
421
+
422
+ <table><tr><td>Method Accuracy</td><td>Betti Error</td></tr><tr><td>DMT 0.9475</td><td>0.982</td></tr><tr><td>Gaussian (10%,δ) 0.9393</td><td>1.086</td></tr><tr><td>Gaussian (20%, δ) 0.9272</td><td>1.391</td></tr></table>
423
+
424
+ <table><tr><td>Method</td><td>Accuracy ]</td><td>Betti Error</td></tr><tr><td>DMT</td><td>0.9475</td><td>0.982</td></tr><tr><td>Reweighted CE</td><td>0.9481</td><td>2.753</td></tr></table>
parse/train/LGgdb4TS4Z/LGgdb4TS4Z_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/LGgdb4TS4Z/LGgdb4TS4Z_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/LGgdb4TS4Z/LGgdb4TS4Z_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/XpSAvlvnMa/XpSAvlvnMa.md ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pretraining Representations for Data-Efficient Reinforcement Learning
2
+
3
+ Max Schwarzer∗1,2, Nitarshan Rajkumar∗1,2, Michael Noukhovitch1,2, Ankesh Anand1,2 Laurent Charlin1,3,5, Devon Hjelm1,4, Philip Bachman4, Aaron Courville1,2,5
4
+
5
+ 1Mila, 2Université de Montréal, 3HEC Montréal, 4Microsoft Research, 5CIFAR
6
+
7
+ # Abstract
8
+
9
+ Data efficiency is a key challenge for deep reinforcement learning. We address this problem by using unlabeled data to pretrain an encoder which is then finetuned on a small amount of task-specific data. To encourage learning representations which capture diverse aspects of the underlying MDP, we employ a combination of latent dynamics modelling and unsupervised goal-conditioned RL. When limited to $1 0 0 \mathrm { k }$ steps of interaction on Atari games (equivalent to two hours of human experience), our approach significantly surpasses prior work combining offline representation pretraining with task-specific finetuning, and compares favourably with other pretraining methods that require orders of magnitude more data. Our approach shows particular promise when combined with larger models as well as more diverse, task-aligned observational data – approaching human-level performance and data-efficiency on Atari in our best setting. We provide code associated with this work at https://github.com/mila-iqia/SGI.
10
+
11
+ # 1 Introduction
12
+
13
+ Deep reinforcement learning (RL) methods often focus on training networks tabula rasa from random initializations without using any prior knowledge about the environment. In contrast, humans rely a great deal on visual and dynamics priors about the world to perform decision making efficiently (Dubey et al., 2018; Lake et al., 2017). Thus, it is not surprising that RL algorithms which learn tabula rasa suffer from severe overfitting (Zhang et al., 2018) and poor sample efficiency compared to humans (Tsividis et al., 2017).
14
+
15
+ Self-supervised learning (SSL) provides a promising approach to learning useful priors from past data or experiences. SSL methods leverage unlabelled data to learn strong representations, which can be used to bootstrap learning on downstream tasks. Pretraining with self-supervised learning has been shown to be quite successful in vision (Hénaff et al., 2019; Grill et al., 2020; Chen et al., 2020a) and language (Devlin et al., 2019; Brown et al., 2020) settings.
16
+
17
+ Pretraining can also be used in an RL context to learn priors over representations or dynamics. One approach to pretraining for RL is to train agents to explore their environment in an unsupervised fashion, forcing them to learn useful skills and representations (Hansen et al., 2020; Liu & Abbeel, 2021; Campos et al., 2021). Unfortunately, current unsupervised exploration methods require months or years of real-time experience, which may be impractical for real-world systems with limits and costs to interaction — agents cannot be run faster than real-time, may require significant human oversight for safety, and can be expensive to run in parallel. It is thus important to develop pretraining methods that work with practical quantities of data, and ideally that can be applied offline to fixed datasets collected from prior experiments or expert demonstrations (as in Stooke et al., 2021).
18
+
19
+ ![](images/248876d76f1003db8ceef9252b1ab672ded898149e4b7ef393e829cc8d40e013.jpg)
20
+ Figure 1: A schematic diagram showing our two stage pretrain-then-finetune method. All unsupervised training losses and task-specific RL use the shared torso on the left.
21
+
22
+ To this end, we propose to use a combination of self-supervised objectives for representation learning on offline data, requiring orders of magnitude less pretraining data than existing methods, while approaching human-level data-efficiency when finetuned on downstream tasks. We summarize our work below:
23
+
24
+ RL-aligned representation learning objectives: We propose to pretrain representations using a combination of latent dynamics modeling, unsupervised goal-conditioned reinforcement learning, and inverse dynamics modeling – with the intuition that a collection of such objectives can capture more information about the dynamical and temporal aspects of the environment of interest than any single objective. We refer to our method as SGI (SPR, Goal-conditioned RL and Inverse modeling).
25
+
26
+ Significant advances for data-efficiency on Atari: SGI’s combination of objectives performs better than any in isolation and significantly improves performance over previous representation pretraining baselines such as ATC (Stooke et al., 2021). Our results are competitive with explorationbased approaches such as APT or VISR (Liu & Abbeel, 2021; Hansen et al., 2020), which require two to three orders of magnitude more pretraining data and the ability to interact with the environment during training, while SGI can learn with a small offline dataset of exploration data.
27
+
28
+ Scaling with data quality and model size: SGI’s performance also scales with data quality and quantity, increasing as data comes from better-performing or more-exploratory policies. Additionally, we find that SGI’s performance scales robustly with model size; while larger models are unstable or bring limited benefits in standard RL, SGI pretraining allows their finetuning performance to significantly exceed that of smaller networks.
29
+
30
+ We assume familiarity with RL in the following sections (with a brief overview in Appendix A).
31
+
32
+ # 2 Representation Learning Objectives
33
+
34
+ A wide range of SSL objectives have been proposed for RL which leverage various aspects of the structure available in agent interactions. For example, the temporal dynamics of an environment can be exploited to create a forward prediction task (e.g., Gelada et al., 2019; Guo et al., 2018; Stooke et al., 2021; Schwarzer et al., 2021) in which an agent is trained to predict its immediate future observations, perhaps conditioned on a sequence of actions to perform.
35
+
36
+ Structure in RL goes far beyond forward dynamics, however. We propose to combine multiple representation learning objectives, covering different agent-centric and temporal aspects of the MDP. Based on the intuition that knowledge of an environment is best represented in multiple ways (Hessel et al., 2021; Degris & Modayil, 2012), we expect this to outperform monolithic representation learning methods such as temporal contrastive learning (e.g., Stooke et al., 2021). In deciding which tasks to use, we consider questions an adequate representation should be able to answer about its environment, including:
37
+
38
+ • If I take action $a$ in state $s$ , what state $s ^ { \prime }$ am I likely to see next? • If I transitioned from state $s$ to state $s ^ { \prime }$ , what action $a$ did I take? • What action $a$ would I take in state $s$ so that I reach another state $s ^ { \prime }$ as soon as possible
39
+
40
+ Note that none of these questions are tied to task reward, allowing them to be answered in a fullyunsupervised fashion. Additionally, these are questions about the environment, and not any specific policy, allowing them to be used in offline pretraining with arbitrary behavioral policies.
41
+
42
+ In general, the first question may be answered by forward dynamics modeling, which as mentioned above is well-established in RL. The second question corresponds to inverse dynamics modeling, which has also been commonly used in the past (Lesort et al., 2018). The third question corresponds to self-supervised goal-conditioned reinforcement learning which has the advantage of being structurally similar to the downstream target task, as both require learning to control the environment.
43
+
44
+ To facilitate their joint use, we formulate these objectives so that they operate in the latent representation space provided by a shared encoder. We provide an overview of these components in Figure 1 and describe them in greater detail below; we also provide detailed pseudocode in Appendix D.
45
+
46
+ # 2.1 Self-Predictive Representations
47
+
48
+ SPR (Schwarzer et al., 2021) is a representation learning algorithm developed for data-efficient reinforcement learning. SPR learns a latent-space transition model, directly predicting representations of future states without reconstruction or negative samples. As in its base algorithm, Rainbow (Hessel et al., 2018), SPR learns a convolutional encoder, denoted as $f _ { o }$ , which produces representations of states as $z _ { t } = f _ { o } ( s _ { t } )$ . SPR then uses a dynamics model $h$ to recursively estimate the representations of future states, as $\hat { z } _ { t + k + 1 } = h ( \hat { z } _ { t + k } , a _ { t + k } )$ , beginning from $\hat { z _ { t } } \ \triangleq z _ { t }$ . These representations are projected to a lower-dimensional space by a projection function $p _ { o }$ to produce $\hat { y } _ { t + k } \triangleq p _ { o } ( \hat { z } _ { t + k } )$ .
49
+
50
+ Simultaneously, SPR uses a target encoder $f _ { m }$ to produce target representations $\tilde { z } _ { t + k } \triangleq f _ { m } ( s _ { t + k } )$ , which are further projected by a target projection function $p _ { m }$ to produce $\tilde { y } _ { t + k } \triangleq p _ { m } ( \tilde { z } _ { t + k } )$ . SPR then maximizes the cosine similarity between these predictions and targets, using a learned linear prediction function $q$ to translate from $\hat { y }$ to $\tilde { y }$ :
51
+
52
+ $$
53
+ \mathcal { L } _ { \theta } ^ { \mathrm { S P R } } ( s _ { t : t + K } , a _ { t : t + K } ) = - \sum _ { k = 1 } ^ { K } \frac { q ( \hat { y } _ { t + k } ) \cdot \tilde { y } _ { t + k } } { | | q ( \hat { y } _ { t + k } ) | | _ { 2 } \cdot | | \tilde { y } _ { t + k } | | _ { 2 } } .
54
+ $$
55
+
56
+ The parameters of these target modules $\theta _ { m }$ are defined as an exponential moving average of the parameters $\theta _ { o }$ of $f _ { o }$ and $p _ { o } \colon \theta _ { m } = \tau \theta _ { m } + ( 1 - \tau ) \theta _ { o }$ .
57
+
58
+ # 2.2 Goal-Conditioned Reinforcement Learning
59
+
60
+ Inspired by works such as Dabney et al. (2021) that show that modeling many different value functions is a useful representation learning objective, we propose to augment SPR with an unsupervised goalconditioned reinforcement learning objective. We define goals $g$ to be normalized vectors of the same size as the output of the agent’s convolutional encoder (3,136- or 4,704-dimensional vectors, for the architectures we consider). We use these goals to annotate transitions with synthetic rewards, and train a modified version of Rainbow (Hessel et al., 2018) to estimate $Q ( s _ { t } , a , g )$ , the expected return from taking action $a$ in state $s _ { t }$ to reach goal $g$ if optimal actions are taken in subsequent states.
61
+
62
+ We select goals using a scheme inspired by hindsight experience replay (Andrychowicz et al., 2017), seeking to generate goal vectors that are both semantically meaningful and highly diverse. As in hindsight experience replay, we begin by sampling a state from another trajectory or the future of the current trajectory. However, we take the additional step of applying stochastic noise to encourage goals to lie somewhat off of the current representation manifold. We provide details in Appendix C.2.
63
+
64
+ # 2.3 Inverse Dynamics Modeling
65
+
66
+ We propose to use an inverse dynamics modeling task (Lesort et al., 2018), in which the model is trained to predict $a _ { t }$ from $s _ { t }$ and $s _ { t + 1 }$ . Because this is a classification task (in discrete control) or regression task (continuous control), it is naturally not prone to representational collapse, which may complement and stabilize our other objectives. We directly integrate inverse modeling into the rollout structure of SPR, modeling $p ( a _ { t + k } | \hat { y } _ { t + k } , \tilde { y } _ { t + k + 1 } )$ for each $\bar { k ^ { \prime } } \in \left( 0 , \ldots , K { - } 1 \right)$ , using a two-layer MLP trained by cross-entropy.
67
+
68
+ # 3 Related Work
69
+
70
+ Data-Efficiency In order to address data efficiency in RL, Kaiser et al. (2019) introduced the Atari $1 0 0 \mathrm { k }$ benchmark, in which agents are limited to 100,000 steps of environment interaction, and proposed SimPLe, a model-based algorithm that substantially outperformed previous model-free methods. However, van Hasselt et al. (2019) and Kielak (2020) found that simply modifying the hyperparameters of existing model-free algorithms allowed them to exceed SimPLe’s performance. Later, DrQ (Kostrikov et al., 2021) found that adding mild image augmentation to model-free methods dramatically enhanced their sample efficiency, while SPR (Schwarzer et al., 2021) combined data augmentation with an auxiliary self-supervised learning objective. SGI employs SPR as one of its objectives in offline pretraining, leading to significant improvements in data-efficiency.
71
+
72
+ Exploratory pretraining A number of recent works have sought to improve reinforcement learning via the addition of an unsupervised pretraining stage prior to finetuning on the target task. One common approach has been to allow the agent a period of fully-unsupervised interaction with the environment, during which the agent is trained to maximize a surrogate exploration-based task such as the diversity of the states it encounters, as in APT (Liu & Abbeel, 2021) or ProtoRL (Yarats et al., 2021), or to learn a set of skills associated with different paths through the environment, as in DIAYN (Eysenbach et al., 2018), VISR (Hansen et al., 2020), and DADS (Sharma et al., 2019). Others have proposed to use self-supervised objectives to generate intrinsic rewards encouraging agents to visit new states; e.g. Pathak et al. (2017) and Burda et al. (2018) use the loss of an inverse dynamics model like that used in SGI, while Sekar et al. (2020) uses the disagreement between an ensemble of latent-space dynamics models. Finally, Campos et al. (2021) report strong results based on massive-scale unsupervised pretraining.
73
+
74
+ Many of these methods are used to pretrain agents that are later adapted to specific reinforcement learning tasks. However, SGI differs in that it can be used offline and is agnostic to how data is collected. As such, if no pre-existing offline data is available, one of the methods above can be used to generate a dataset for SGI; we use Burda et al. (2018) for this in Section 4.2.
75
+
76
+ Visual Representation Learning Computer vision has seen a series of dramatic advances in selfsupervised representation learning, including contrastive methods (Oord et al., 2018; Hjelm et al., 2019; Bachman et al., 2019; He et al., 2020; Chen et al., 2020a) as well as purely predictive ones (Grill et al., 2020). Variants of these approaches have also been shown to improve performance when coupled with a small quantity of labeled data, in a semi-supervised setting (Chen et al., 2020b; Hénaff et al., 2019), and several self-supervised methods have been designed specifically for this case (for example, Sohn et al., 2020; Tarvainen & Valpola, 2017).
77
+
78
+ These advances have spurred similar growth in methods aimed specifically at improving performance in RL. We refer the reader to Lesort et al. (2018) for a review of earlier methods, including inverse dynamics modeling which is used in SGI. Recent research has focused on leveraging latent-space dynamics modeling as an auxiliary task. Gelada et al. (2019) propose a simple next-step prediction task, coupled with reward prediction, but found it is prone to latent space collapse and requires an auxiliary reconstruction loss for experiments on Atari. Guo et al. (2020) use a pair of networks for both forward and backward prediction, and show improved performance in extremely large-data multi-task settings. Mazoure et al. (2020) use a temporal contrastive objective for representation learning, and show improvement in continual RL settings. Concurrently, SPR (Schwarzer et al., 2021) proposed a multi-step latent prediction task with similarities to BYOL (Grill et al., 2020).
79
+
80
+ Two works similar to ours, Anand et al. (2019) and Stooke et al. (2021), propose reward-free temporalcontrastive methods to pretrain representations. Anand et al. (2019) show that representations from encoders trained with ST-DIM contain a great deal of information about environment states, but they do not examine whether or not representations learned via their method are, in fact, useful for reinforcement learning. However, Stooke et al. (2021) employ a similar algorithm and find only relatively minor improvements in performance compared to standard baselines in the large-data regime; our controlled comparisons show that SGI’s representations are far better for data-efficiency. Concurrent to our work, FERM (Zhan et al., 2020) propose contrastive pretraining from human demonstrations in a robotics setting. As FERM is quite similar to ATC, we are optimistic that our improvements over ATC in Atari 100k would translate to FERM’s setting. Finally, Yang & Nachum (2021) propose a family of algorithms for learning representations for DRL from state observations; we believe that these might be promising in DRL from pixels, but they have not yet been adapted to that setting.
81
+
82
+ # 4 Experimental Details
83
+
84
+ In our experiments, We seek to address two main challenges for the deployment of RL agents in the real world (Dulac-Arnold et al., 2020): (1) training the RL agent with a limited budget of interactions in the real environment, and (2) leveraging existing interaction data of arbitrary quality.
85
+
86
+ # 4.1 Environment and Evaluation
87
+
88
+ To address the first challenge, we focus our experimentation on the Atari $1 0 0 \mathrm { k }$ benchmark introduced by Kaiser et al. (2019), in which agents are allowed only 100k steps of interaction with their environment.2 This is roughly equivalent to the two hours human testers were given to learn these games by Mnih et al. (2015), providing a baseline of human sample-efficiency.
89
+
90
+ Atari is also an ideal setting due to its complex observational spaces and diverse tasks, with 26 different games included in the Atari $1 0 0 \mathrm { k }$ benchmark. These factors have led to Atari’s extensive use for representation learning and exploratory pretraining (Anand et al., 2019; Stooke et al., 2021; Campos et al., 2021), and specifically Atari $1 0 0 \mathrm { k }$ for data-efficient RL (e.g., Kaiser et al., 2019; Kostrikov et al., 2021; Schwarzer et al., 2021), including finetuning after exploratory pretraining (e.g., Hansen et al., 2020; Liu & Abbeel, 2021), providing strong baselines to compare to.
91
+
92
+ Our evaluation metric for an agent on a game is human-normalized score (HNS), defined as $\frac { a g e n t \_ s c o r e - r a n d o m \_ s c o r e } { h u m a n \_ s c o r e - r a n d o m \_ s c o r e }$ . We calculate this per game by averaging scores over 100 evaluation trajectories at the end of training, and across 10 random seeds for training. We report both mean (Mn) and median (Mdn) HNS over the 26 Atari-100K games, as well as on how many games a method achieves super-human performance $\mathrm { ( > H ) }$ and greater than random performance $( > 0 )$ . Following the guidelines of Agarwal et al. (2021) we also report interquartile mean HNS (IQM) and quantify uncertainty via bootstrapping in Appendix B.
93
+
94
+ # 4.2 Pretraining Data
95
+
96
+ The second challenge pertains to pretraining data. Although some prior work on offline representational pretraining has focused on expert-quality data (Stooke et al., 2021), we expect real-world pretraining data to be of greatly varying quality. We thus construct four different pretraining datasets to approximate different data quality scenarios.
97
+
98
+ • (R)andom To assess performance near the lower limit of data quality, we use a random policy to gather a dataset of 6M transitions for each game. To encourage the agent to venture further from the starting state, we execute each action for a random number of steps sampled from a Geometric $\left( { \frac { 1 } { 3 } } \right)$ distribution. • $\mathbf { ( E ) }$ xploratory To emulate slightly better data that covers a larger range of the state space, we use an exploratory policy. Specifically, we employ the IDF (inverse dynamics) variant of the algorithm proposed by Burda et al. (2018). We log the first 6M steps from an agent trained in each game. This algorithm achieves better-than-random performance on only $70 \%$ of tasks, setting it far below the performance of more modern unsupervised exploration methods.
99
+
100
+ To create higher-quality datasets, we follow Stooke et al. (2021) and use experience gathered during the training of standard DQN agents (Mnih et al., 2015). We opt to use the publicly-available DQN Replay dataset (Agarwal et al., 2020), which contains data from training for 50M steps (across all 57 games, with five different random seeds). Although we might prefer to use data from recent unsupervised exploration methods such as APT (Liu & Abbeel, 2021), VISR (Hansen et al., 2020), or CPT (Campos et al., 2021), none of these works provide code or datasets, making this impractical. We address using data collected from on-task agents with a behavioural cloning baseline in Section 5, with surprising findings relative to prior work.
101
+
102
+ • (W)eak We first generate a weak dataset by selecting the first 1M steps for each of the 5 available runs in the DQN Replay dataset. This data is generated with an $\epsilon$ -greedy policy with high, gradually decaying $\epsilon$ , leading to substantial action diversity and many suboptimal exploratory actions. Although the behavioral policies used to generate this agent are not especially competent (see Table 1), they have above-random performance on almost all games, suggesting that that this dataset includes more task-relevant transitions.
103
+ (M)ixed Finally, for a realistic best-case scenario, we create a dataset of both medium and lowquality data. To simulate a real-world collection of data from different policies, we concatenate multiple checkpoints evenly spread throughout training of a DQN. We believe this is also a reasonable approximation for data from a modern unsupervised exploration method such as CPT (Campos et al., 2021); as shown in Table 1, the agent for this dataset has performance in between CPT and VISR, with median closer to CPT and mean closer to VISR. This data is also lower quality than the expert data originally used in the method most similar to ours, ATC (Stooke et al., 2021). 3 We create a dataset of 3M steps and a larger dataset of 6M steps; all M experiments use the 3M step dataset unless otherwise noted.
104
+
105
+ We compare the agents used for our datasets to those for unsupervised exploration pretraining baselines in Table 1. We estimate the performance of the Weak and Mixed agents as the average of the corresponding logged evaluations in the Dopamine (Castro et al., 2018) baselines. Even our largest dataset is quite small compared to the amounts of data gathered by unsupervised exploration methods (see the “Data” column in Table 1); this is intentional, as we believe that unsupervised interactional data may be expensive in real world applications. We show the performance of the non-random data collection policies in Table 2 (note that a fullyrandom policy has a score of 0 by definition).
106
+
107
+ Table 1: Performance of agents used in pretraining data collection compared to external baselines on 26 Atari games (Kaiser et al., 2019)
108
+
109
+ <table><tr><td>Method</td><td>Mdn Mean</td><td>&gt;H</td><td>&gt;0</td><td>Data</td></tr><tr><td colspan="5">Exploratory Pretraining Baselines 5</td></tr><tr><td>VISR@0</td><td>0.056</td><td>0.817</td><td>19</td><td>250M</td></tr><tr><td>APT@01</td><td>0.038</td><td>0.476 2 12</td><td>18</td><td>250M</td></tr><tr><td>CPT@0</td><td>0.809</td><td>4.945</td><td>25</td><td>4B</td></tr><tr><td colspan="5">Offline Datasets</td></tr><tr><td>Exploratory</td><td>0.039</td><td>0.042</td><td>0 18</td><td>6M</td></tr><tr><td>Weak2</td><td>0.028</td><td>0.056</td><td>0 23</td><td>5M</td></tr><tr><td>Mixed2</td><td>0.618</td><td>1.266</td><td>10 26</td><td>3M</td></tr></table>
110
+
111
+ 1 Calculated from ICLR 2021 OpenReview submission; unreported in arXiv version. 2 Upper-bound estimate from averaging evaluation performance of corresponding agents in Dopamine.
112
+
113
+ # 4.3 Training Details
114
+
115
+ We optimize our three representation learning objectives jointly during unsupervised pretraining, summing their losses. During finetuning, we optimize only the reinforcement learning and forward dynamics losses, following Schwarzer et al. (2021) (see Section 5.5), and lower the learning rates for the pretrained encoder and dynamics model by two orders of magnitude (see Section 5.4).
116
+
117
+ We consider the standard three-layer convolutional encoder introduced by Mnih et al. (2015), a ResNet inspired by Espeholt et al. (2018), as well as an enlarged ResNet of the same design. In other respects, our implementation matches that of SPR and is based on its publicly-released code. Full implementation and hyperparameter details are provided in Appendix C. We refer to agents by the model architecture and pretraining dataset type used: SGI-R is pretrained on Random, SGI-E on Exploratory, SGI-W on Weak, and SGI-M on Mixed. To investigate scaling, we vary the size of the encoder used in SGI-M: the standard Mnih et al. (2015) encoder is SGI-M/S (for small), our standard ResNet is simply SGI-M and using a larger ResNet is SGI-M/L (for large)4. For SGI-M/L we also use the 6M step dataset described earlier. All ablations are conducted in comparison to SGI-M unless otherwise noted. Finally, agents without pretraining are denoted SGI-None; SGI-None/S would be roughly equivalent to SPR (Schwarzer et al., 2021).
118
+
119
+ For baselines, we compare to no-pretraining Atari 100k methods (Kaiser et al., 2019; van Hasselt et al., 2019; Kostrikov et al., 2021; Schwarzer et al., 2021). For our models trained on Random and Exploratory data we compare against previous pretraining-via-exploration approaches applied to Atari 100k (Liu & Abbeel, 2021; Hansen et al., 2020; Campos et al., 2021). In the higher quality data regime, we compare to recent work on data-agnostic unsupervised pretraining, ATC (Stooke et al.,
120
+
121
+ 2021), as well as behavioural cloning (BC).
122
+
123
+ # 5 Results and Discussion
124
+
125
+ We find that SGI performs competitively on the Atari-100K benchmark; presenting aggregate results in Table 2, and full per-game data in Appendix E. Our best setting, SGI-M/L, achieves a median HNS of 0.753, approaching humanlevel sample-efficiency and outperforming all comparable methods except the recently proposed CPT (Campos et al., 2021). With less data and a smaller model, SGI-M achieves a median HNS of 0.679, significantly outperforming the prior method ATC on the same data (ATC-M). Meanwhile, SGI-E achieves a median HNS of 0.456, matching or exceeding other exploratory methods such as APT (Liu & Abbeel, 2021) and VISR (Hansen et al., 2020), as well as ATC-E.
126
+
127
+ Pretraining data efficiency SGI achieves strong performance with only limited pretraining data; our largest dataset contains 6M transitions, or roughly 4.5 days of experience. This compares favourably to recent works on unsupervised exploration such as APT or CPT, which require far larger amounts of data and environment interaction (250M steps or 193 days for APT, 4B steps or 8.45 years for CPT). We expect SGI would perform even better if used in these large-data settingss, as we find that it scales robustly with data (see Section 5.2).
128
+
129
+ Table 2: HNS on Atari100k for SGI and baselines.
130
+
131
+ <table><tr><td>Method</td><td>Mdn</td><td>Mn</td><td>&gt;H</td><td>&gt;0</td><td>Data</td></tr><tr><td colspan="6">No Pretraining (Finetuning Only)</td></tr><tr><td>SimPLe</td><td>0.144</td><td>0.443</td><td>2</td><td>26</td><td>0</td></tr><tr><td>DER</td><td>0.161</td><td>0.285</td><td></td><td>26</td><td>0</td></tr><tr><td>DrQ</td><td>0.268</td><td>0.357</td><td></td><td>24</td><td>0</td></tr><tr><td>SPR</td><td>0.415</td><td>0.704</td><td>227</td><td>26</td><td>0</td></tr><tr><td>SGI-None</td><td>0.343</td><td>0.565</td><td>3</td><td>26</td><td>0</td></tr></table>
132
+
133
+ Behavioural cloning is a strong baseline Although ATC pretrains with expert data, they did not investigate behavioral cloning as a baseline pretraining objective. We do so on our Mixed dataset, the only one to be generated by policies with significantly above-random performance. Behavioral cloning without finetuning $\mathbf { \Gamma } ( \mathbf { B C - M @ 0 } )$ performs poorly, perhaps due to the varying behavioural quality in the dataset. But when finetuned, BC-M yields very respectable performance, surpassing ATC-M but not SGIM. All fine-tuning settings for BC-M match SGIM.
134
+
135
+ # 5.1 Data quality matters
136
+
137
+ In principle, SGI can be used with any offline dataset but we demonstrate that it scales with the quality of its data. Near the lower bound of
138
+
139
+ Exploratory Pretraining + Finetuning
140
+ Offline-data Pretraining + Finetuning
141
+
142
+ <table><tr><td>Method</td><td>Mdn</td><td>Mn</td><td>&gt;H</td><td>&gt;0</td><td>Data</td></tr><tr><td>VISR</td><td>0.095</td><td>1.281</td><td>7</td><td>21</td><td>250M</td></tr><tr><td>APT</td><td>0.475</td><td>0.6661</td><td>7</td><td>26</td><td>250M</td></tr><tr><td>CPT@0²</td><td>0.809</td><td>4.945</td><td>12</td><td>25</td><td>4000M</td></tr><tr><td>ATC-R3</td><td>0.191</td><td>0.472</td><td>4</td><td>26</td><td>6M</td></tr><tr><td>ATC-E3</td><td>0.237</td><td>0.462</td><td>3</td><td>26</td><td>6M</td></tr><tr><td>SGI-R</td><td>0.326</td><td>0.888</td><td>5</td><td>26</td><td>6M</td></tr><tr><td>SGI-E</td><td>0.456</td><td>0.838</td><td>6</td><td>26</td><td>6M</td></tr></table>
143
+
144
+ <table><tr><td>Method</td><td>Mdn</td><td>Mn</td><td>&gt;H</td><td>&gt;0</td><td>Data</td></tr><tr><td>ATC-W3</td><td>0.219</td><td>0.587</td><td>4</td><td>26</td><td>3M</td></tr><tr><td>ATC-M3</td><td>0.204</td><td>0.780</td><td>5</td><td>26</td><td>3M</td></tr><tr><td>BC-M@0</td><td>0.139</td><td>0.227</td><td>0</td><td>23</td><td>3M</td></tr><tr><td>BC-M</td><td>0.548</td><td>0.858</td><td>8</td><td>26</td><td>3M</td></tr><tr><td>SGI-W</td><td>0.589</td><td>1.144</td><td>8</td><td>26</td><td>5M</td></tr><tr><td>SGI-M/S</td><td>0.423</td><td>0.914</td><td>8</td><td>26</td><td>3M</td></tr><tr><td>SGI-M</td><td>0.679</td><td>1.149</td><td>9</td><td>26</td><td>3M</td></tr><tr><td>SGI-M/L</td><td>0.753</td><td>1.598</td><td>9</td><td>26</td><td>6M</td></tr></table>
145
+
146
+ 1 APT claims 0.6955, but we calculate 0.666 from their reported per-game scores. 2 CPT@0 does not do any finetuning. 3 Our implementation (see Appendix C.6)
147
+
148
+ ![](images/880457355100b865551c4346d813b088d056f5e068249c95374852ded3b310e6.jpg)
149
+ Figure 2: SGI finetuning performance vs. pretraining data score for all combinations of game and dataset. Data score is estimated as clipped return per episode, trend calculated via kernel regression. Values whitened per-game for clarity.
150
+
151
+ ![](images/5d11f7bbc44724d2c7302f581de5aa3f110d4171a02455ceaec8beeb6e17d66f.jpg)
152
+ Figure 3: Finetuning performance of SGI for different CNN sizes and amounts of pretrained data from the Mixed dataset. We plot IQM HNS with confidence intervals (see Appendix B).
153
+
154
+ ![](images/2d2a53b5f87c93dd61e6a468bbd667840e46ed6ff510a6a3e4b857e7d8809ae7.jpg)
155
+ Figure 4: Average cosine similarity between representations over pretraining, averaged across the 26 Atari 100k games. 1 indicates representations are identical, 0 perfect dissimilarity.
156
+
157
+ data quality where all actions are selected randomly, SGI-R still provides some benefit over an otherwise-identical randomly-initialized agent (SGI-None) on 16 out of 26 games, with a similar median but $57 \%$ higher mean HNS. With better data from an exploratory policy, SGI-E improves on 16/26 games, gets $33 \%$ higher median HNS, and surpasses APT (Liu & Abbeel, 2021) which used 40 times more pretraining data. With similarly weak data but possibly more task-specific transitions, SGI-W gets $72 \%$ higher median HNS compared to SGI-None and with realistic data from a mixture of policies, SGI-M improves to $98 \%$ .
158
+
159
+ Importantly, the pattern we observe is very different from what would be expected for imitation learning. In particular, SGI-W’s strong performance shows that expert data is not required. To characterize this, we plot the average clipped reward 5 experienced per episode for each of our pretraining datasets in Figure 2. Normalizing across tasks, we find a strong positive correlation between task reward engagement $( p < 0 . 0 0 0 1 )$ and finetuning performance. Moreover, we find diminishing returns to further task engagement.
160
+
161
+ # 5.2 Pretraining unlocks the value of larger networks
162
+
163
+ The three-layer network introduced by Mnih et al. (2015) has become a fixture of deep reinforcement learning, and has been employed by previous works examining pretraining in this field (e.g. Liu & Abbeel, 2021; Stooke et al., 2021). However, we find that representational pretraining with this network (SGI-M/S) provides only minor benefits compared to training from scratch. In contrast, larger networks struggle without pretraining but shine when pretrained as shown in Figure 3.
164
+
165
+ This finding is consistent with recent work in unsupervised representation learning for classification, which has observed that unsupervised pretraining benefits disproportionately from larger networks (Chen et al., 2020a). In particular, our results suggest that model size should increase in parallel with amount of pretraining data, matching recent work on scaling in language modeling (Kaplan et al., 2020; Hernandez et al., 2021). SGI thus provides a simple way to use unlabeled data to extend the benefits of large networks, already well-known in the large-data regime (e.g., Schrittwieser et al., 2021; Espeholt et al., 2018), to data-efficient RL.
166
+
167
+ # 5.3 Combining SGI’s objectives improves performance
168
+
169
+ We test all possible combinations of our three SSL objectives, denoted by combinations of the letters S, G and I to indicate which objectives they employ. Results in Table 3 show that performance monotonically increases as more objectives are used, with inverse dynamics modeling combined with either of the other objectives performing respectably well. This illustrates the importance of using multiple objectives to obtain representational coverage of the MDP.
170
+
171
+ We note that including inverse modeling appears to be critical, and hypothesize that this is related to representational collapse. To measure this, we plot the average cosine similarity between representations $y _ { t }$ of different states for several pretraining methods in Figure 4, using our ResNet encoder on the Mixed dataset. We observe that S, G and $\mathbf { s } { + } \mathbf { G }$ all show some degree representational collapse, while configurations that include inverse dynamics modeling avoid representational collapse, as does ATC, whose contrastive loss implicitly optimizes for representational diversity (Wang & Isola, 2020). Intriguingly, we observe that increased representational diversity does not necessarily improve performance. For example, SGI outperforms ATC, $\mathbf { G } { + } \mathbf { I }$ and
172
+
173
+ Table 3: HNS on Atari 100K for pretraining ablations of SGI.
174
+
175
+ <table><tr><td>Pretraining</td><td>Mdn</td><td>Mean</td><td>&gt;H</td></tr><tr><td>None</td><td>0.343</td><td>0.565</td><td>3</td></tr><tr><td>S</td><td>0.009</td><td>-0.054</td><td>0</td></tr><tr><td>G</td><td>0.060</td><td>0.181</td><td>1</td></tr><tr><td>I</td><td>0.411</td><td>0.943</td><td>7</td></tr><tr><td>S+G</td><td>0.029</td><td>0.098</td><td>0</td></tr><tr><td>G+I</td><td>0.512</td><td>1.004</td><td>9</td></tr><tr><td>S+I</td><td>0.629</td><td>0.978</td><td>8</td></tr><tr><td>SGI-M</td><td>0.679</td><td>1.149</td><td>9</td></tr></table>
176
+
177
+ I in finetuning but has less diverse pretraining representations. We also observe that adding SPR (S) consistently pulls representations towards collapse (compare $\mathbf { S } { + } \mathbf { I }$ and I, $\mathbf { s } { + } \mathbf { G }$ and G, and SGI and $\mathbf { G } { + } \mathbf { I } )$ ; how this relates to performance is a question for future work.
178
+
179
+ # 5.4 Naively finetuning ruins pretrained representations
180
+
181
+ We find that properly finetuning pretrained representations is critical, as results in Table 4 show. Although allowing pretrained weights to change freely during finetuning is better than initializing from scratch (Naive vs No Pretrain), freezing the pretrained encoder (Frozen) leads to better performance than either. SGI’s approach of reducing finetuning learning rates for pretrained parameters leads to superior performance (Reduced LRs, equivalent to SGI-M).
182
+
183
+ Table 4: HNS on Atari 100K for finetuning schemes for SGI.
184
+
185
+ <table><tr><td>Method</td><td>Mdn</td><td>Mean</td><td>&gt;H</td></tr><tr><td>No pretrain</td><td>0.343</td><td>0.565</td><td>3</td></tr><tr><td>Naive</td><td>0.429</td><td>0.845</td><td>8</td></tr><tr><td>Frozen</td><td>0.499</td><td>0.971</td><td>8</td></tr><tr><td>Reduced LRs</td><td>0.679</td><td>1.149</td><td>9</td></tr></table>
186
+
187
+ We thus hypothesize that representations learned by SGI are being disrupted by gradients early in finetuning, in a phenomenon analogous to catastrophic forgetting (Zenke et al., 2017; Hadsell et al., 2020). As representations may not generalize between different value functions across training (Dabney et al., 2021), allowing the encoder to strongly adapt early in training could make it worse at modeling later value functions, compared to the neutral initialization from SGI. We also note that there is a long history in computer vision of employing specialized finetuning hyperparameters (Li et al., 2020; Chu et al., 2016) when transferring tasks.
188
+
189
+ # 5.5 Not all SSL objectives are beneficial during finetuning
190
+
191
+ Although SGI uses S during finetuning, we experiment with a variant that optimizes only the standard DQN objective, roughly equivalent to using $\mathrm { D r Q }$ (Kostrikov et al., 2021) with DQN hyperparameters set to match SGI. We find that finetuning with S has a large impact with or without pretraining (compare None and S Only entries in Table 5.). Although, SGI without S manages to achieve roughly the same mean human-normalized score as SGI with S, removing S harms performance on performance on 19 out of 26 games and reduces median normalized score by roughly $33 \%$ . We also find no benefit to using all of SGI’s constituent objectives during finetuning (All Losses in Table 5) compared to using S alone, although the gap between them is not statistically significant for metrics other than median (see Figure 5d).
192
+
193
+ Table 5: HNS on Atari 100K for finetuning ablations of SGI.
194
+
195
+ <table><tr><td>Finetune SSL</td><td>Mdn</td><td>Mean</td><td>&gt;H</td></tr><tr><td>Without SGI pretraining</td><td></td><td></td><td></td></tr><tr><td>None</td><td>0.161</td><td>0.315</td><td>23</td></tr><tr><td>S Only</td><td>0.343</td><td>0.565</td><td></td></tr><tr><td>With SGI pretraining</td><td></td><td></td><td></td></tr><tr><td>None</td><td>0.452</td><td>1.114</td><td>8</td></tr><tr><td>SGI</td><td>0.397</td><td>1.011</td><td>8</td></tr><tr><td>S Only</td><td>0.679</td><td>1.149</td><td>9</td></tr></table>
196
+
197
+ # 6 Conclusion
198
+
199
+ We present SGI, a fully self-supervised (reward-free) approach to representation learning for reinforcement learning, which uses a combination of pretraining objectives to encourage the agent to learn multiple aspects of environment dynamics. We demonstrate that SGI enables significant improvements on the Atari $1 0 0 \mathrm { k }$ data-efficiency benchmark, especially in comparison to unsupervised exploration approaches which require orders of magnitude more pretraining data. Investigating the various components of SGI, we find that it scales robustly with higher-quality pretraining data and larger models, that all three of the self-supervised objectives contribute to the success of this approach, and that careful reduction of fine-tuning learning rates is critical to optimal performance.
200
+
201
+ # 7 Acknowledgements
202
+
203
+ We would like to thank Mila and Compute Canada for computational resources. We would like to thank Rishabh Agarwal for useful discussions. Aaron Courville would like to acknowledge financial support from Microsoft Research and Hitachi. We would also like to thank Wancong (Kevin) Zhang for his helpful comments to the codebase on GitHub.
204
+
205
+ # References
206
+
207
+ Agarwal, R., Schuurmans, D., and Norouzi, M. An optimistic perspective on offline reinforcement learning. In ICML, 2020. 5
208
+ Agarwal, R., Schwarzer, M., Castro, P. S., Courville, A., and Bellemare, M. G. Deep reinforcement learning at the edge of the statistical precipice. NeurIPS, 2021. 5, 15, 19
209
+ Anand, A., Racah, E., Ozair, S., Bengio, Y., Côté, M.-A., and Hjelm, R. D. Unsupervised state representation learning in atari. In NeurIPS, 2019. 4, 5
210
+ Andrychowicz, M., Wolski, F., Ray, A., Schneider, J., Fong, R., Welinder, P., McGrew, B., Tobin, J., Abbeel, O. P., and Zaremba, W. Hindsight experience replay. In Advances in neural information processing systems, pp. 5048–5058, 2017. 3
211
+ Ba, J. L., Kiros, J. R., and Hinton, G. E. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. 18
212
+ Bachman, P., Hjelm, R. D., and Buchwalter, W. Learning representations by maximizing mutual information across views. In NeurIPS, 2019. 4
213
+ Bellemare, M. G., Dabney, W., and Munos, R. A distributional perspective on reinforcement learning. ICML, 2017. 15
214
+ Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. 1
215
+ Burda, Y., Edwards, H., Pathak, D., Storkey, A., Darrell, T., and Efros, A. A. Large-scale study of curiosity-driven learning, 2018. 4, 5
216
+ Campos, V., Sprechmann, P., Hansen, S. S., Barreto, A., Blundell, C., Vitvitskyi, A., Kapturowski, S., and Badia, A. P. Coverage as a principle for discovering transferable behavior in reinforcement learning, 2021. URL https://openreview.net/forum?id $\equiv$ INhwJdJtxn6. 1, 4, 5, 6, 7
217
+ Castro, P. S., Moitra, S., Gelada, C., Kumar, S., and Bellemare, M. G. Dopamine: A Research Framework for Deep Reinforcement Learning. 2018. URL http://arxiv.org/abs/1812.061 10. 6
218
+ Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual representations. ICML, 2020a. 1, 4, 8
219
+ Chen, T., Kornblith, S., Swersky, K., Norouzi, M., and Hinton, G. Big self-supervised models are strong semi-supervised learners. In NeurIPS, 2020b. 4
220
+ Chu, B., Madhavan, V., Beijbom, O., Hoffman, J., and Darrell, T. Best Practices for Fine-Tuning Visual Classifiers to New Domains, pp. 435–442. 11 2016. ISBN 978-3-319-49408-1. doi: 10.1007/978-3-319-49409-8_34. 9
221
+ Dabney, W., Barreto, A., Rowland, M., Dadashi, R., Quan, J., Bellemare, M. G., and Silver, D. The value-improvement path: Towards better representations for reinforcement learning. 2021. 3, 9
222
+ Degris, T. and Modayil, J. Scaling-up knowledge for a cognizant robot. In AAAI Spring Symposium on Designing Intelligent Robots: Reintegrating AI., 2012. 2
223
+ Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. In ACL, 2019. 1
224
+ Dubey, R., Agrawal, P., Pathak, D., Griffiths, T., and Efros, A. Investigating human priors for playing video games. In International Conference on Machine Learning, 2018. 1
225
+ Dulac-Arnold, G., Levine, N., Mankowitz, D. J., Li, J., Paduraru, C., Gowal, S., and Hester, T. An empirical investigation of the challenges of real-world reinforcement learning. 2020. 5
226
+ Espeholt, L., Soyer, H., Munos, R., Simonyan, K., Mnih, V., Ward, T., Doron, Y., Firoiu, V., Harley, T., Dunning, I., Legg, S., and Kavukcuoglu, K. IMPALA: scalable distributed deeprl with importance weighted actor-learner architectures. CoRR, abs/1802.01561, 2018. URL http://arxiv.org/abs/1802.01561. 6, 8, 18
227
+ Eysenbach, B., Gupta, A., Ibarz, J., and Levine, S. Diversity is all you need: Learning skills without a reward function. In International Conference on Learning Representations, 2018. 4
228
+ Gelada, C., Kumar, S., Buckman, J., Nachum, O., and Bellemare, M. G. Deepmdp: Learning continuous latent space models for representation learning. ICML, 2019. 2, 4
229
+ Grill, J.-B., Strub, F., Altché, F., Tallec, C., Richemond, P. H., Buchatskaya, E., Doersch, C., Pires, B. A., Guo, Z. D., Azar, M. G., et al. Bootstrap your own latent: A new approach to self-supervised learning. In NeurIPS, 2020. 1, 4
230
+ Guo, D., Pires, B. A., Piot, B., Grill, J.-b., Altché, F., Munos, R., and Azar, M. G. Bootstrap latent-predictive representations for multitask reinforcement learning. In ICML, 2020. 4
231
+ Guo, Z. D., Azar, M. G., Piot, B., Pires, B. A., and Munos, R. Neural predictive belief representations. ICML, 2018. 2
232
+ Hadsell, R., Rao, D., Rusu, A. A., and Pascanu, R. Embracing change: Continual learning in deep neural networks. Trends in Cognitive Sciences, 2020. doi: https://doi.org/10.1016/j.tics.2020.09.0 04. URL http://www.sciencedirect.com/science/article/pii/S1364661320302199. 9
233
+ Hansen, S., Dabney, W., Barreto, A., Warde-Farley, D., de Wiele, T. V., and Mnih, V. Fast task inference with variational intrinsic successor features. In ICLR, 2020. 1, 2, 4, 5, 6, 7
234
+ Harris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournapeau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., Kern, R., Picus, M., Hoyer, S., van Kerkwijk, M. H., Brett, M., Haldane, A., del R’ıo, J. F., Wiebe, M., Peterson, P., G’erard-Marchant, P., Sheppard, K., Reddy, T., Weckesser, W., Abbasi, H., Gohlke, C., and Oliphant, T. E. Array programming with NumPy. Nature, 585(7825):357–362, September 2020. doi: 10.1038/s41586-020-2649-2. URL https://doi.org/10.1038/s41586-020-2649-2. 15
235
+ He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In CVPR, 2016. 18
236
+ He, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. Momentum contrast for unsupervised visual representation learning. In CVPR, 2020. 4
237
+ Hénaff, O. J., Srinivas, A., De Fauw, J., Razavi, A., Doersch, C., Eslami, S., and Oord, A. v. d. Dataefficient image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019. 1, 4
238
+ Hernandez, D., Kaplan, J., Henighan, T., and McCandlish, S. Scaling laws for transfer, 2021. 8
239
+ Hessel, M., Modayil, J., van Hasselt, H., Schaul, T., Ostrovski, G., Dabney, W., Horgan, D., Piot, B., Azar, M. G., and Silver, D. Rainbow: Combining improvements in deep reinforcement learning. In AAAI, 2018. 3, 15
240
+ Hessel, M., Danihelka, I., Viola, F., Guez, A., Schmitt, S., Sifre, L., Weber, T., Silver, D., and van Hasselt, H. Muesli: Combining improvements in policy optimization. arXiv preprint arXiv:2104.06159, 2021. 2
241
+ Hjelm, R. D., Fedorov, A., Lavoie-Marchildon, S., Grewal, K., Bachman, P., Trischler, A., and Bengio, Y. Learning deep representations by mutual information estimation and maximization. ICLR, 2019. 4
242
+ Ioffe, S. and Szegedy, C. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. 18
243
+ Kaiser, Ł., Babaeizadeh, M., Miłos, P., Osinski, B., Campbell, R. H., Czechowski, K., Erhan, D., ´ Finn, C., Kozakowski, P., Levine, S., et al. Model based reinforcement learning for atari. In ICLR, 2019. 4, 5, 6, 7, 21, 22, 23, 24
244
+ Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. 8
245
+ Kielak, K. P. Do recent advancements in model-based deep reinforcement learning really improve data efficiency?, 2020. URL https://openreview.net/forum?id=Bke9u1HFwB. 4
246
+ Kostrikov, I., Yarats, D., and Fergus, R. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. In ICLR, 2021. 4, 5, 7, 9, 18
247
+ Lake, B. M., Ullman, T. D., Tenenbaum, J. B., and Gershman, S. J. Building machines that learn and think like people. Behavioral and brain sciences, 40, 2017. 1
248
+ Lesort, T., Díaz-Rodríguez, N., Goudou, J.-F., and Filliat, D. State representation learning for control: An overview. Neural Networks, 108, 2018. 3, 4
249
+ Li, H., Chaudhari, P., Yang, H., Lam, M., Ravichandran, A., Bhotika, R., and Soatto, S. Rethinking the hyperparameters for fine-tuning. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\ c =$ B1g8VkHFPH. 9
250
+ Liu, H. and Abbeel, P. Unsupervised active pre-training for reinforcement learning, 2021. URL https://openreview.net/forum?id=cvNYovr16SB. 1, 2, 4, 5, 6, 7, 8, 21
251
+ Mazoure, B., Combes, R. T. d., Doan, T., Bachman, P., and Hjelm, R. D. Deep reinforcement and infomax learning. In NeurIPS, 2020. 4
252
+ Mnih, V., Kavukcuoglu, K., Silver, D., Rusu, A. A., Veness, J., Bellemare, M. G., Graves, A., Riedmiller, M., Fidjeland, A. K., Ostrovski, G., et al. Human-level control through deep reinforcement learning. Nature, 518(7540), 2015. 5, 6, 8, 15, 18
253
+ Ng, A. Y., Harada, D., and Russell, S. J. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, 1999. 18
254
+ Oord, A. v. d., Li, Y., and Vinyals, O. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 4
255
+ Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. Pytorch: An imperative style, high-performance deep learning library. In NeurIPS, 2019. 15
256
+ Pathak, D., Agrawal, P., Efros, A. A., and Darrell, T. Curiosity-driven exploration by self-supervised prediction. In ICML. PMLR, 2017. 4 Perez, E., Strub, F., de Vries, H., Dumoulin, V., and Courville, A. C. Film: Visual reasoning with a general conditioning layer. In AAAI, 2018. 18 Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., and Chen, L.-C. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4510–4520, 2018. 18 Schrittwieser, J., Antonoglou, I., Hubert, T., Simonyan, K., Sifre, L., Schmitt, S., Guez, A., Lockhart, E., Hassabis, D., Graepel, T., et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 2021. 8 Schwarzer, M., Anand, A., Goel, R., Hjelm, R. D., Courville, A., and Bachman, P. Data-efficient reinforcement learning with self-predictive representations. In ICLR, 2021. 2, 3, 4, 5, 6, 7, 15, 18,
257
+ 21, 22 Sekar, R., Rybkin, O., Daniilidis, K., Abbeel, P., Hafner, D., and Pathak, D. Planning to explore via self-supervised world models. In ICML, 2020. 4 Sharma, A., Gu, S., Levine, S., Kumar, V., and Hausman, K. Dynamics-aware unsupervised discovery of skills. In International Conference on Learning Representations, 2019. 4 Sohn, K., Berthelot, D., Li, C.-L., Zhang, Z., Carlini, N., Cubuk, E. D., Kurakin, A., Zhang, H., and Raffel, C. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. arXiv preprint arXiv:2001.07685, 2020. 4 Stooke, A. and Abbeel, P. rlpyt: A research code base for deep reinforcement learning in pytorch. arXiv preprint arXiv:1909.01500, 2019. 15 Stooke, A., Lee, K., Abbeel, P., and Laskin, M. Decoupling representation learning from reinforcement learning, 2021. 1, 2, 4, 5, 6, 7, 8, 19, 24 Sutton, R. S. and Barto, A. G. Reinforcement Learning: An Introduction. The MIT Press, second edition, 2018. URL http://incompleteideas.net/book/the-book-2nd.html. 15 Tan, M. and Le, Q. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pp. 6105–6114, 2019. 18 Tarvainen, A. and Valpola, H. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NeurIPS, 2017. 4 Tsividis, P., Pouncy, T., Xu, J. L., Tenenbaum, J. B., and Gershman, S. J. Human learning in atari. In AAAI Spring Symposia, 2017. 1 Van Hasselt, H., Guez, A., and Silver, D. Deep reinforcement learning with double q-learning. In AAAI, 2016. 15 van Hasselt, H. P., Hessel, M., and Aslanides, J. When to use parametric models in reinforcement learning? In NeurIPS, 2019. 4, 7 Wang, T. and Isola, P. Understanding contrastive representation learning through alignment and uniformity on the hypersphere, 2020. 9 Wang, Z., Schaul, T., Hessel, M., Hasselt, H., Lanctot, M., and Freitas, N. Dueling network architectures for deep reinforcement learning. In ICML, 2016. 15 Yang, M. and Nachum, O. Representation matters: Offline pretraining for sequential decision making. arXiv preprint arXiv:2102.05815, 2021. 5 Yarats, D., Fergus, R., Lazaric, A., and Pinto, L. Reinforcement learning with prototypical representations. arXiv preprint arXiv:2102.11271, 2021. 4 Zenke, F., Poole, B., and Ganguli, S. Continual learning through synaptic intelligence. In ICML,
258
+ 2017. 9
259
+ Zhan, A., Zhao, P., Pinto, L., Abbeel, P., and Laskin, M. A framework for efficient robotic manipulation, 2020. 5
260
+ Zhang, C., Vinyals, O., Munos, R., and Bengio, S. A study on overfitting in deep reinforcement learning. arXiv preprint arXiv:1804.06893, 2018. 1
parse/train/XpSAvlvnMa/XpSAvlvnMa_content_list.json ADDED
@@ -0,0 +1,1201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Pretraining Representations for Data-Efficient Reinforcement Learning ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 220,
8
+ 122,
9
+ 779,
10
+ 172
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Max Schwarzer∗1,2, Nitarshan Rajkumar∗1,2, Michael Noukhovitch1,2, Ankesh Anand1,2 Laurent Charlin1,3,5, Devon Hjelm1,4, Philip Bachman4, Aaron Courville1,2,5 ",
17
+ "bbox": [
18
+ 187,
19
+ 224,
20
+ 810,
21
+ 258
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "1Mila, 2Université de Montréal, 3HEC Montréal, 4Microsoft Research, 5CIFAR ",
28
+ "bbox": [
29
+ 238,
30
+ 263,
31
+ 759,
32
+ 279
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Abstract ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 462,
42
+ 314,
43
+ 535,
44
+ 330
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "Data efficiency is a key challenge for deep reinforcement learning. We address this problem by using unlabeled data to pretrain an encoder which is then finetuned on a small amount of task-specific data. To encourage learning representations which capture diverse aspects of the underlying MDP, we employ a combination of latent dynamics modelling and unsupervised goal-conditioned RL. When limited to $1 0 0 \\mathrm { k }$ steps of interaction on Atari games (equivalent to two hours of human experience), our approach significantly surpasses prior work combining offline representation pretraining with task-specific finetuning, and compares favourably with other pretraining methods that require orders of magnitude more data. Our approach shows particular promise when combined with larger models as well as more diverse, task-aligned observational data – approaching human-level performance and data-efficiency on Atari in our best setting. We provide code associated with this work at https://github.com/mila-iqia/SGI. ",
51
+ "bbox": [
52
+ 233,
53
+ 347,
54
+ 764,
55
+ 526
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "1 Introduction ",
62
+ "text_level": 1,
63
+ "bbox": [
64
+ 174,
65
+ 553,
66
+ 310,
67
+ 570
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Deep reinforcement learning (RL) methods often focus on training networks tabula rasa from random initializations without using any prior knowledge about the environment. In contrast, humans rely a great deal on visual and dynamics priors about the world to perform decision making efficiently (Dubey et al., 2018; Lake et al., 2017). Thus, it is not surprising that RL algorithms which learn tabula rasa suffer from severe overfitting (Zhang et al., 2018) and poor sample efficiency compared to humans (Tsividis et al., 2017). ",
74
+ "bbox": [
75
+ 174,
76
+ 585,
77
+ 823,
78
+ 667
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "Self-supervised learning (SSL) provides a promising approach to learning useful priors from past data or experiences. SSL methods leverage unlabelled data to learn strong representations, which can be used to bootstrap learning on downstream tasks. Pretraining with self-supervised learning has been shown to be quite successful in vision (Hénaff et al., 2019; Grill et al., 2020; Chen et al., 2020a) and language (Devlin et al., 2019; Brown et al., 2020) settings. ",
85
+ "bbox": [
86
+ 174,
87
+ 674,
88
+ 825,
89
+ 744
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "Pretraining can also be used in an RL context to learn priors over representations or dynamics. One approach to pretraining for RL is to train agents to explore their environment in an unsupervised fashion, forcing them to learn useful skills and representations (Hansen et al., 2020; Liu & Abbeel, 2021; Campos et al., 2021). Unfortunately, current unsupervised exploration methods require months or years of real-time experience, which may be impractical for real-world systems with limits and costs to interaction — agents cannot be run faster than real-time, may require significant human oversight for safety, and can be expensive to run in parallel. It is thus important to develop pretraining methods that work with practical quantities of data, and ideally that can be applied offline to fixed datasets collected from prior experiments or expert demonstrations (as in Stooke et al., 2021). ",
96
+ "bbox": [
97
+ 174,
98
+ 750,
99
+ 825,
100
+ 876
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "image",
106
+ "img_path": "images/248876d76f1003db8ceef9252b1ab672ded898149e4b7ef393e829cc8d40e013.jpg",
107
+ "image_caption": [
108
+ "Figure 1: A schematic diagram showing our two stage pretrain-then-finetune method. All unsupervised training losses and task-specific RL use the shared torso on the left. "
109
+ ],
110
+ "image_footnote": [],
111
+ "bbox": [
112
+ 187,
113
+ 104,
114
+ 816,
115
+ 334
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "To this end, we propose to use a combination of self-supervised objectives for representation learning on offline data, requiring orders of magnitude less pretraining data than existing methods, while approaching human-level data-efficiency when finetuned on downstream tasks. We summarize our work below: ",
122
+ "bbox": [
123
+ 174,
124
+ 386,
125
+ 825,
126
+ 440
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "RL-aligned representation learning objectives: We propose to pretrain representations using a combination of latent dynamics modeling, unsupervised goal-conditioned reinforcement learning, and inverse dynamics modeling – with the intuition that a collection of such objectives can capture more information about the dynamical and temporal aspects of the environment of interest than any single objective. We refer to our method as SGI (SPR, Goal-conditioned RL and Inverse modeling). ",
133
+ "bbox": [
134
+ 174,
135
+ 450,
136
+ 825,
137
+ 520
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "Significant advances for data-efficiency on Atari: SGI’s combination of objectives performs better than any in isolation and significantly improves performance over previous representation pretraining baselines such as ATC (Stooke et al., 2021). Our results are competitive with explorationbased approaches such as APT or VISR (Liu & Abbeel, 2021; Hansen et al., 2020), which require two to three orders of magnitude more pretraining data and the ability to interact with the environment during training, while SGI can learn with a small offline dataset of exploration data. ",
144
+ "bbox": [
145
+ 174,
146
+ 530,
147
+ 825,
148
+ 614
149
+ ],
150
+ "page_idx": 1
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "Scaling with data quality and model size: SGI’s performance also scales with data quality and quantity, increasing as data comes from better-performing or more-exploratory policies. Additionally, we find that SGI’s performance scales robustly with model size; while larger models are unstable or bring limited benefits in standard RL, SGI pretraining allows their finetuning performance to significantly exceed that of smaller networks. ",
155
+ "bbox": [
156
+ 174,
157
+ 622,
158
+ 825,
159
+ 693
160
+ ],
161
+ "page_idx": 1
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "We assume familiarity with RL in the following sections (with a brief overview in Appendix A). ",
166
+ "bbox": [
167
+ 173,
168
+ 699,
169
+ 800,
170
+ 713
171
+ ],
172
+ "page_idx": 1
173
+ },
174
+ {
175
+ "type": "text",
176
+ "text": "2 Representation Learning Objectives ",
177
+ "text_level": 1,
178
+ "bbox": [
179
+ 174,
180
+ 733,
181
+ 506,
182
+ 751
183
+ ],
184
+ "page_idx": 1
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "A wide range of SSL objectives have been proposed for RL which leverage various aspects of the structure available in agent interactions. For example, the temporal dynamics of an environment can be exploited to create a forward prediction task (e.g., Gelada et al., 2019; Guo et al., 2018; Stooke et al., 2021; Schwarzer et al., 2021) in which an agent is trained to predict its immediate future observations, perhaps conditioned on a sequence of actions to perform. ",
189
+ "bbox": [
190
+ 174,
191
+ 766,
192
+ 825,
193
+ 835
194
+ ],
195
+ "page_idx": 1
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "Structure in RL goes far beyond forward dynamics, however. We propose to combine multiple representation learning objectives, covering different agent-centric and temporal aspects of the MDP. Based on the intuition that knowledge of an environment is best represented in multiple ways (Hessel et al., 2021; Degris & Modayil, 2012), we expect this to outperform monolithic representation learning methods such as temporal contrastive learning (e.g., Stooke et al., 2021). In deciding which tasks to use, we consider questions an adequate representation should be able to answer about its environment, including: ",
200
+ "bbox": [
201
+ 174,
202
+ 842,
203
+ 825,
204
+ 911
205
+ ],
206
+ "page_idx": 1
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "",
211
+ "bbox": [
212
+ 171,
213
+ 92,
214
+ 823,
215
+ 119
216
+ ],
217
+ "page_idx": 2
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "• If I take action $a$ in state $s$ , what state $s ^ { \\prime }$ am I likely to see next? • If I transitioned from state $s$ to state $s ^ { \\prime }$ , what action $a$ did I take? • What action $a$ would I take in state $s$ so that I reach another state $s ^ { \\prime }$ as soon as possible ",
222
+ "bbox": [
223
+ 209,
224
+ 126,
225
+ 810,
226
+ 167
227
+ ],
228
+ "page_idx": 2
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "Note that none of these questions are tied to task reward, allowing them to be answered in a fullyunsupervised fashion. Additionally, these are questions about the environment, and not any specific policy, allowing them to be used in offline pretraining with arbitrary behavioral policies. ",
233
+ "bbox": [
234
+ 176,
235
+ 174,
236
+ 823,
237
+ 215
238
+ ],
239
+ "page_idx": 2
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "In general, the first question may be answered by forward dynamics modeling, which as mentioned above is well-established in RL. The second question corresponds to inverse dynamics modeling, which has also been commonly used in the past (Lesort et al., 2018). The third question corresponds to self-supervised goal-conditioned reinforcement learning which has the advantage of being structurally similar to the downstream target task, as both require learning to control the environment. ",
244
+ "bbox": [
245
+ 174,
246
+ 222,
247
+ 825,
248
+ 292
249
+ ],
250
+ "page_idx": 2
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "To facilitate their joint use, we formulate these objectives so that they operate in the latent representation space provided by a shared encoder. We provide an overview of these components in Figure 1 and describe them in greater detail below; we also provide detailed pseudocode in Appendix D. ",
255
+ "bbox": [
256
+ 174,
257
+ 297,
258
+ 825,
259
+ 340
260
+ ],
261
+ "page_idx": 2
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "2.1 Self-Predictive Representations ",
266
+ "text_level": 1,
267
+ "bbox": [
268
+ 176,
269
+ 356,
270
+ 429,
271
+ 371
272
+ ],
273
+ "page_idx": 2
274
+ },
275
+ {
276
+ "type": "text",
277
+ "text": "SPR (Schwarzer et al., 2021) is a representation learning algorithm developed for data-efficient reinforcement learning. SPR learns a latent-space transition model, directly predicting representations of future states without reconstruction or negative samples. As in its base algorithm, Rainbow (Hessel et al., 2018), SPR learns a convolutional encoder, denoted as $f _ { o }$ , which produces representations of states as $z _ { t } = f _ { o } ( s _ { t } )$ . SPR then uses a dynamics model $h$ to recursively estimate the representations of future states, as $\\hat { z } _ { t + k + 1 } = h ( \\hat { z } _ { t + k } , a _ { t + k } )$ , beginning from $\\hat { z _ { t } } \\ \\triangleq z _ { t }$ . These representations are projected to a lower-dimensional space by a projection function $p _ { o }$ to produce $\\hat { y } _ { t + k } \\triangleq p _ { o } ( \\hat { z } _ { t + k } )$ . ",
278
+ "bbox": [
279
+ 173,
280
+ 380,
281
+ 825,
282
+ 483
283
+ ],
284
+ "page_idx": 2
285
+ },
286
+ {
287
+ "type": "text",
288
+ "text": "Simultaneously, SPR uses a target encoder $f _ { m }$ to produce target representations $\\tilde { z } _ { t + k } \\triangleq f _ { m } ( s _ { t + k } )$ , which are further projected by a target projection function $p _ { m }$ to produce $\\tilde { y } _ { t + k } \\triangleq p _ { m } ( \\tilde { z } _ { t + k } )$ . SPR then maximizes the cosine similarity between these predictions and targets, using a learned linear prediction function $q$ to translate from $\\hat { y }$ to $\\tilde { y }$ : ",
289
+ "bbox": [
290
+ 174,
291
+ 491,
292
+ 825,
293
+ 549
294
+ ],
295
+ "page_idx": 2
296
+ },
297
+ {
298
+ "type": "equation",
299
+ "img_path": "images/43b5d3222bf2123193870e34e7bdbbfae03a65571da4c447298dddd0d56c9795.jpg",
300
+ "text": "$$\n\\mathcal { L } _ { \\theta } ^ { \\mathrm { S P R } } ( s _ { t : t + K } , a _ { t : t + K } ) = - \\sum _ { k = 1 } ^ { K } \\frac { q ( \\hat { y } _ { t + k } ) \\cdot \\tilde { y } _ { t + k } } { | | q ( \\hat { y } _ { t + k } ) | | _ { 2 } \\cdot | | \\tilde { y } _ { t + k } | | _ { 2 } } .\n$$",
301
+ "text_format": "latex",
302
+ "bbox": [
303
+ 318,
304
+ 553,
305
+ 679,
306
+ 595
307
+ ],
308
+ "page_idx": 2
309
+ },
310
+ {
311
+ "type": "text",
312
+ "text": "The parameters of these target modules $\\theta _ { m }$ are defined as an exponential moving average of the parameters $\\theta _ { o }$ of $f _ { o }$ and $p _ { o } \\colon \\theta _ { m } = \\tau \\theta _ { m } + ( 1 - \\tau ) \\theta _ { o }$ . ",
313
+ "bbox": [
314
+ 174,
315
+ 599,
316
+ 826,
317
+ 628
318
+ ],
319
+ "page_idx": 2
320
+ },
321
+ {
322
+ "type": "text",
323
+ "text": "2.2 Goal-Conditioned Reinforcement Learning ",
324
+ "text_level": 1,
325
+ "bbox": [
326
+ 174,
327
+ 642,
328
+ 514,
329
+ 659
330
+ ],
331
+ "page_idx": 2
332
+ },
333
+ {
334
+ "type": "text",
335
+ "text": "Inspired by works such as Dabney et al. (2021) that show that modeling many different value functions is a useful representation learning objective, we propose to augment SPR with an unsupervised goalconditioned reinforcement learning objective. We define goals $g$ to be normalized vectors of the same size as the output of the agent’s convolutional encoder (3,136- or 4,704-dimensional vectors, for the architectures we consider). We use these goals to annotate transitions with synthetic rewards, and train a modified version of Rainbow (Hessel et al., 2018) to estimate $Q ( s _ { t } , a , g )$ , the expected return from taking action $a$ in state $s _ { t }$ to reach goal $g$ if optimal actions are taken in subsequent states. ",
336
+ "bbox": [
337
+ 173,
338
+ 667,
339
+ 825,
340
+ 767
341
+ ],
342
+ "page_idx": 2
343
+ },
344
+ {
345
+ "type": "text",
346
+ "text": "We select goals using a scheme inspired by hindsight experience replay (Andrychowicz et al., 2017), seeking to generate goal vectors that are both semantically meaningful and highly diverse. As in hindsight experience replay, we begin by sampling a state from another trajectory or the future of the current trajectory. However, we take the additional step of applying stochastic noise to encourage goals to lie somewhat off of the current representation manifold. We provide details in Appendix C.2. ",
347
+ "bbox": [
348
+ 174,
349
+ 772,
350
+ 825,
351
+ 842
352
+ ],
353
+ "page_idx": 2
354
+ },
355
+ {
356
+ "type": "text",
357
+ "text": "2.3 Inverse Dynamics Modeling ",
358
+ "text_level": 1,
359
+ "bbox": [
360
+ 176,
361
+ 857,
362
+ 406,
363
+ 872
364
+ ],
365
+ "page_idx": 2
366
+ },
367
+ {
368
+ "type": "text",
369
+ "text": "We propose to use an inverse dynamics modeling task (Lesort et al., 2018), in which the model is trained to predict $a _ { t }$ from $s _ { t }$ and $s _ { t + 1 }$ . Because this is a classification task (in discrete control) or regression task (continuous control), it is naturally not prone to representational collapse, which may complement and stabilize our other objectives. We directly integrate inverse modeling into the rollout structure of SPR, modeling $p ( a _ { t + k } | \\hat { y } _ { t + k } , \\tilde { y } _ { t + k + 1 } )$ for each $\\bar { k ^ { \\prime } } \\in \\left( 0 , \\ldots , K { - } 1 \\right)$ , using a two-layer MLP trained by cross-entropy. ",
370
+ "bbox": [
371
+ 176,
372
+ 882,
373
+ 821,
374
+ 911
375
+ ],
376
+ "page_idx": 2
377
+ },
378
+ {
379
+ "type": "text",
380
+ "text": "",
381
+ "bbox": [
382
+ 174,
383
+ 92,
384
+ 825,
385
+ 147
386
+ ],
387
+ "page_idx": 3
388
+ },
389
+ {
390
+ "type": "text",
391
+ "text": "3 Related Work ",
392
+ "text_level": 1,
393
+ "bbox": [
394
+ 174,
395
+ 166,
396
+ 321,
397
+ 183
398
+ ],
399
+ "page_idx": 3
400
+ },
401
+ {
402
+ "type": "text",
403
+ "text": "Data-Efficiency In order to address data efficiency in RL, Kaiser et al. (2019) introduced the Atari $1 0 0 \\mathrm { k }$ benchmark, in which agents are limited to 100,000 steps of environment interaction, and proposed SimPLe, a model-based algorithm that substantially outperformed previous model-free methods. However, van Hasselt et al. (2019) and Kielak (2020) found that simply modifying the hyperparameters of existing model-free algorithms allowed them to exceed SimPLe’s performance. Later, DrQ (Kostrikov et al., 2021) found that adding mild image augmentation to model-free methods dramatically enhanced their sample efficiency, while SPR (Schwarzer et al., 2021) combined data augmentation with an auxiliary self-supervised learning objective. SGI employs SPR as one of its objectives in offline pretraining, leading to significant improvements in data-efficiency. ",
404
+ "bbox": [
405
+ 173,
406
+ 196,
407
+ 825,
408
+ 321
409
+ ],
410
+ "page_idx": 3
411
+ },
412
+ {
413
+ "type": "text",
414
+ "text": "Exploratory pretraining A number of recent works have sought to improve reinforcement learning via the addition of an unsupervised pretraining stage prior to finetuning on the target task. One common approach has been to allow the agent a period of fully-unsupervised interaction with the environment, during which the agent is trained to maximize a surrogate exploration-based task such as the diversity of the states it encounters, as in APT (Liu & Abbeel, 2021) or ProtoRL (Yarats et al., 2021), or to learn a set of skills associated with different paths through the environment, as in DIAYN (Eysenbach et al., 2018), VISR (Hansen et al., 2020), and DADS (Sharma et al., 2019). Others have proposed to use self-supervised objectives to generate intrinsic rewards encouraging agents to visit new states; e.g. Pathak et al. (2017) and Burda et al. (2018) use the loss of an inverse dynamics model like that used in SGI, while Sekar et al. (2020) uses the disagreement between an ensemble of latent-space dynamics models. Finally, Campos et al. (2021) report strong results based on massive-scale unsupervised pretraining. ",
415
+ "bbox": [
416
+ 174,
417
+ 337,
418
+ 825,
419
+ 502
420
+ ],
421
+ "page_idx": 3
422
+ },
423
+ {
424
+ "type": "text",
425
+ "text": "Many of these methods are used to pretrain agents that are later adapted to specific reinforcement learning tasks. However, SGI differs in that it can be used offline and is agnostic to how data is collected. As such, if no pre-existing offline data is available, one of the methods above can be used to generate a dataset for SGI; we use Burda et al. (2018) for this in Section 4.2. ",
426
+ "bbox": [
427
+ 174,
428
+ 510,
429
+ 825,
430
+ 565
431
+ ],
432
+ "page_idx": 3
433
+ },
434
+ {
435
+ "type": "text",
436
+ "text": "Visual Representation Learning Computer vision has seen a series of dramatic advances in selfsupervised representation learning, including contrastive methods (Oord et al., 2018; Hjelm et al., 2019; Bachman et al., 2019; He et al., 2020; Chen et al., 2020a) as well as purely predictive ones (Grill et al., 2020). Variants of these approaches have also been shown to improve performance when coupled with a small quantity of labeled data, in a semi-supervised setting (Chen et al., 2020b; Hénaff et al., 2019), and several self-supervised methods have been designed specifically for this case (for example, Sohn et al., 2020; Tarvainen & Valpola, 2017). ",
437
+ "bbox": [
438
+ 174,
439
+ 579,
440
+ 825,
441
+ 678
442
+ ],
443
+ "page_idx": 3
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "These advances have spurred similar growth in methods aimed specifically at improving performance in RL. We refer the reader to Lesort et al. (2018) for a review of earlier methods, including inverse dynamics modeling which is used in SGI. Recent research has focused on leveraging latent-space dynamics modeling as an auxiliary task. Gelada et al. (2019) propose a simple next-step prediction task, coupled with reward prediction, but found it is prone to latent space collapse and requires an auxiliary reconstruction loss for experiments on Atari. Guo et al. (2020) use a pair of networks for both forward and backward prediction, and show improved performance in extremely large-data multi-task settings. Mazoure et al. (2020) use a temporal contrastive objective for representation learning, and show improvement in continual RL settings. Concurrently, SPR (Schwarzer et al., 2021) proposed a multi-step latent prediction task with similarities to BYOL (Grill et al., 2020). ",
448
+ "bbox": [
449
+ 174,
450
+ 683,
451
+ 825,
452
+ 821
453
+ ],
454
+ "page_idx": 3
455
+ },
456
+ {
457
+ "type": "text",
458
+ "text": "Two works similar to ours, Anand et al. (2019) and Stooke et al. (2021), propose reward-free temporalcontrastive methods to pretrain representations. Anand et al. (2019) show that representations from encoders trained with ST-DIM contain a great deal of information about environment states, but they do not examine whether or not representations learned via their method are, in fact, useful for reinforcement learning. However, Stooke et al. (2021) employ a similar algorithm and find only relatively minor improvements in performance compared to standard baselines in the large-data regime; our controlled comparisons show that SGI’s representations are far better for data-efficiency. Concurrent to our work, FERM (Zhan et al., 2020) propose contrastive pretraining from human demonstrations in a robotics setting. As FERM is quite similar to ATC, we are optimistic that our improvements over ATC in Atari 100k would translate to FERM’s setting. Finally, Yang & Nachum (2021) propose a family of algorithms for learning representations for DRL from state observations; we believe that these might be promising in DRL from pixels, but they have not yet been adapted to that setting. ",
459
+ "bbox": [
460
+ 174,
461
+ 828,
462
+ 823,
463
+ 911
464
+ ],
465
+ "page_idx": 3
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "",
470
+ "bbox": [
471
+ 174,
472
+ 92,
473
+ 825,
474
+ 189
475
+ ],
476
+ "page_idx": 4
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "4 Experimental Details ",
481
+ "text_level": 1,
482
+ "bbox": [
483
+ 174,
484
+ 208,
485
+ 382,
486
+ 226
487
+ ],
488
+ "page_idx": 4
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "In our experiments, We seek to address two main challenges for the deployment of RL agents in the real world (Dulac-Arnold et al., 2020): (1) training the RL agent with a limited budget of interactions in the real environment, and (2) leveraging existing interaction data of arbitrary quality. ",
493
+ "bbox": [
494
+ 176,
495
+ 239,
496
+ 823,
497
+ 281
498
+ ],
499
+ "page_idx": 4
500
+ },
501
+ {
502
+ "type": "text",
503
+ "text": "4.1 Environment and Evaluation ",
504
+ "text_level": 1,
505
+ "bbox": [
506
+ 176,
507
+ 299,
508
+ 413,
509
+ 314
510
+ ],
511
+ "page_idx": 4
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "To address the first challenge, we focus our experimentation on the Atari $1 0 0 \\mathrm { k }$ benchmark introduced by Kaiser et al. (2019), in which agents are allowed only 100k steps of interaction with their environment.2 This is roughly equivalent to the two hours human testers were given to learn these games by Mnih et al. (2015), providing a baseline of human sample-efficiency. ",
516
+ "bbox": [
517
+ 174,
518
+ 324,
519
+ 825,
520
+ 381
521
+ ],
522
+ "page_idx": 4
523
+ },
524
+ {
525
+ "type": "text",
526
+ "text": "Atari is also an ideal setting due to its complex observational spaces and diverse tasks, with 26 different games included in the Atari $1 0 0 \\mathrm { k }$ benchmark. These factors have led to Atari’s extensive use for representation learning and exploratory pretraining (Anand et al., 2019; Stooke et al., 2021; Campos et al., 2021), and specifically Atari $1 0 0 \\mathrm { k }$ for data-efficient RL (e.g., Kaiser et al., 2019; Kostrikov et al., 2021; Schwarzer et al., 2021), including finetuning after exploratory pretraining (e.g., Hansen et al., 2020; Liu & Abbeel, 2021), providing strong baselines to compare to. ",
527
+ "bbox": [
528
+ 174,
529
+ 386,
530
+ 825,
531
+ 469
532
+ ],
533
+ "page_idx": 4
534
+ },
535
+ {
536
+ "type": "text",
537
+ "text": "Our evaluation metric for an agent on a game is human-normalized score (HNS), defined as $\\frac { a g e n t \\_ s c o r e - r a n d o m \\_ s c o r e } { h u m a n \\_ s c o r e - r a n d o m \\_ s c o r e }$ . We calculate this per game by averaging scores over 100 evaluation trajectories at the end of training, and across 10 random seeds for training. We report both mean (Mn) and median (Mdn) HNS over the 26 Atari-100K games, as well as on how many games a method achieves super-human performance $\\mathrm { ( > H ) }$ and greater than random performance $( > 0 )$ . Following the guidelines of Agarwal et al. (2021) we also report interquartile mean HNS (IQM) and quantify uncertainty via bootstrapping in Appendix B. ",
538
+ "bbox": [
539
+ 174,
540
+ 476,
541
+ 825,
542
+ 577
543
+ ],
544
+ "page_idx": 4
545
+ },
546
+ {
547
+ "type": "text",
548
+ "text": "4.2 Pretraining Data ",
549
+ "text_level": 1,
550
+ "bbox": [
551
+ 174,
552
+ 593,
553
+ 331,
554
+ 608
555
+ ],
556
+ "page_idx": 4
557
+ },
558
+ {
559
+ "type": "text",
560
+ "text": "The second challenge pertains to pretraining data. Although some prior work on offline representational pretraining has focused on expert-quality data (Stooke et al., 2021), we expect real-world pretraining data to be of greatly varying quality. We thus construct four different pretraining datasets to approximate different data quality scenarios. ",
561
+ "bbox": [
562
+ 174,
563
+ 619,
564
+ 825,
565
+ 674
566
+ ],
567
+ "page_idx": 4
568
+ },
569
+ {
570
+ "type": "text",
571
+ "text": "• (R)andom To assess performance near the lower limit of data quality, we use a random policy to gather a dataset of 6M transitions for each game. To encourage the agent to venture further from the starting state, we execute each action for a random number of steps sampled from a Geometric $\\left( { \\frac { 1 } { 3 } } \\right)$ distribution. • $\\mathbf { ( E ) }$ xploratory To emulate slightly better data that covers a larger range of the state space, we use an exploratory policy. Specifically, we employ the IDF (inverse dynamics) variant of the algorithm proposed by Burda et al. (2018). We log the first 6M steps from an agent trained in each game. This algorithm achieves better-than-random performance on only $70 \\%$ of tasks, setting it far below the performance of more modern unsupervised exploration methods. ",
572
+ "bbox": [
573
+ 181,
574
+ 688,
575
+ 825,
576
+ 818
577
+ ],
578
+ "page_idx": 4
579
+ },
580
+ {
581
+ "type": "text",
582
+ "text": "To create higher-quality datasets, we follow Stooke et al. (2021) and use experience gathered during the training of standard DQN agents (Mnih et al., 2015). We opt to use the publicly-available DQN Replay dataset (Agarwal et al., 2020), which contains data from training for 50M steps (across all 57 games, with five different random seeds). Although we might prefer to use data from recent unsupervised exploration methods such as APT (Liu & Abbeel, 2021), VISR (Hansen et al., 2020), or CPT (Campos et al., 2021), none of these works provide code or datasets, making this impractical. We address using data collected from on-task agents with a behavioural cloning baseline in Section 5, with surprising findings relative to prior work. ",
583
+ "bbox": [
584
+ 176,
585
+ 830,
586
+ 823,
587
+ 886
588
+ ],
589
+ "page_idx": 4
590
+ },
591
+ {
592
+ "type": "text",
593
+ "text": "",
594
+ "bbox": [
595
+ 174,
596
+ 92,
597
+ 826,
598
+ 147
599
+ ],
600
+ "page_idx": 5
601
+ },
602
+ {
603
+ "type": "text",
604
+ "text": "• (W)eak We first generate a weak dataset by selecting the first 1M steps for each of the 5 available runs in the DQN Replay dataset. This data is generated with an $\\epsilon$ -greedy policy with high, gradually decaying $\\epsilon$ , leading to substantial action diversity and many suboptimal exploratory actions. Although the behavioral policies used to generate this agent are not especially competent (see Table 1), they have above-random performance on almost all games, suggesting that that this dataset includes more task-relevant transitions. \n(M)ixed Finally, for a realistic best-case scenario, we create a dataset of both medium and lowquality data. To simulate a real-world collection of data from different policies, we concatenate multiple checkpoints evenly spread throughout training of a DQN. We believe this is also a reasonable approximation for data from a modern unsupervised exploration method such as CPT (Campos et al., 2021); as shown in Table 1, the agent for this dataset has performance in between CPT and VISR, with median closer to CPT and mean closer to VISR. This data is also lower quality than the expert data originally used in the method most similar to ours, ATC (Stooke et al., 2021). 3 We create a dataset of 3M steps and a larger dataset of 6M steps; all M experiments use the 3M step dataset unless otherwise noted. ",
605
+ "bbox": [
606
+ 181,
607
+ 161,
608
+ 826,
609
+ 373
610
+ ],
611
+ "page_idx": 5
612
+ },
613
+ {
614
+ "type": "text",
615
+ "text": "We compare the agents used for our datasets to those for unsupervised exploration pretraining baselines in Table 1. We estimate the performance of the Weak and Mixed agents as the average of the corresponding logged evaluations in the Dopamine (Castro et al., 2018) baselines. Even our largest dataset is quite small compared to the amounts of data gathered by unsupervised exploration methods (see the “Data” column in Table 1); this is intentional, as we believe that unsupervised interactional data may be expensive in real world applications. We show the performance of the non-random data collection policies in Table 2 (note that a fullyrandom policy has a score of 0 by definition). ",
616
+ "bbox": [
617
+ 174,
618
+ 388,
619
+ 452,
620
+ 637
621
+ ],
622
+ "page_idx": 5
623
+ },
624
+ {
625
+ "type": "table",
626
+ "img_path": "images/2bd4152a9f19f51b00c633524dc20c52eb248cc7a63798c78f591b89f8b5da54.jpg",
627
+ "table_caption": [
628
+ "Table 1: Performance of agents used in pretraining data collection compared to external baselines on 26 Atari games (Kaiser et al., 2019) "
629
+ ],
630
+ "table_footnote": [
631
+ "1 Calculated from ICLR 2021 OpenReview submission; unreported in arXiv version. 2 Upper-bound estimate from averaging evaluation performance of corresponding agents in Dopamine. "
632
+ ],
633
+ "table_body": "<table><tr><td>Method</td><td>Mdn Mean</td><td>&gt;H</td><td>&gt;0</td><td>Data</td></tr><tr><td colspan=\"5\">Exploratory Pretraining Baselines 5</td></tr><tr><td>VISR@0</td><td>0.056</td><td>0.817</td><td>19</td><td>250M</td></tr><tr><td>APT@01</td><td>0.038</td><td>0.476 2 12</td><td>18</td><td>250M</td></tr><tr><td>CPT@0</td><td>0.809</td><td>4.945</td><td>25</td><td>4B</td></tr><tr><td colspan=\"5\">Offline Datasets</td></tr><tr><td>Exploratory</td><td>0.039</td><td>0.042</td><td>0 18</td><td>6M</td></tr><tr><td>Weak2</td><td>0.028</td><td>0.056</td><td>0 23</td><td>5M</td></tr><tr><td>Mixed2</td><td>0.618</td><td>1.266</td><td>10 26</td><td>3M</td></tr></table>",
634
+ "bbox": [
635
+ 467,
636
+ 436,
637
+ 825,
638
+ 599
639
+ ],
640
+ "page_idx": 5
641
+ },
642
+ {
643
+ "type": "text",
644
+ "text": "4.3 Training Details ",
645
+ "text_level": 1,
646
+ "bbox": [
647
+ 174,
648
+ 656,
649
+ 325,
650
+ 671
651
+ ],
652
+ "page_idx": 5
653
+ },
654
+ {
655
+ "type": "text",
656
+ "text": "We optimize our three representation learning objectives jointly during unsupervised pretraining, summing their losses. During finetuning, we optimize only the reinforcement learning and forward dynamics losses, following Schwarzer et al. (2021) (see Section 5.5), and lower the learning rates for the pretrained encoder and dynamics model by two orders of magnitude (see Section 5.4). ",
657
+ "bbox": [
658
+ 174,
659
+ 683,
660
+ 825,
661
+ 738
662
+ ],
663
+ "page_idx": 5
664
+ },
665
+ {
666
+ "type": "text",
667
+ "text": "We consider the standard three-layer convolutional encoder introduced by Mnih et al. (2015), a ResNet inspired by Espeholt et al. (2018), as well as an enlarged ResNet of the same design. In other respects, our implementation matches that of SPR and is based on its publicly-released code. Full implementation and hyperparameter details are provided in Appendix C. We refer to agents by the model architecture and pretraining dataset type used: SGI-R is pretrained on Random, SGI-E on Exploratory, SGI-W on Weak, and SGI-M on Mixed. To investigate scaling, we vary the size of the encoder used in SGI-M: the standard Mnih et al. (2015) encoder is SGI-M/S (for small), our standard ResNet is simply SGI-M and using a larger ResNet is SGI-M/L (for large)4. For SGI-M/L we also use the 6M step dataset described earlier. All ablations are conducted in comparison to SGI-M unless otherwise noted. Finally, agents without pretraining are denoted SGI-None; SGI-None/S would be roughly equivalent to SPR (Schwarzer et al., 2021). ",
668
+ "bbox": [
669
+ 174,
670
+ 744,
671
+ 825,
672
+ 868
673
+ ],
674
+ "page_idx": 5
675
+ },
676
+ {
677
+ "type": "text",
678
+ "text": "",
679
+ "bbox": [
680
+ 173,
681
+ 90,
682
+ 823,
683
+ 119
684
+ ],
685
+ "page_idx": 6
686
+ },
687
+ {
688
+ "type": "text",
689
+ "text": "For baselines, we compare to no-pretraining Atari 100k methods (Kaiser et al., 2019; van Hasselt et al., 2019; Kostrikov et al., 2021; Schwarzer et al., 2021). For our models trained on Random and Exploratory data we compare against previous pretraining-via-exploration approaches applied to Atari 100k (Liu & Abbeel, 2021; Hansen et al., 2020; Campos et al., 2021). In the higher quality data regime, we compare to recent work on data-agnostic unsupervised pretraining, ATC (Stooke et al., ",
690
+ "bbox": [
691
+ 173,
692
+ 126,
693
+ 825,
694
+ 195
695
+ ],
696
+ "page_idx": 6
697
+ },
698
+ {
699
+ "type": "text",
700
+ "text": "2021), as well as behavioural cloning (BC). ",
701
+ "bbox": [
702
+ 176,
703
+ 195,
704
+ 459,
705
+ 209
706
+ ],
707
+ "page_idx": 6
708
+ },
709
+ {
710
+ "type": "text",
711
+ "text": "5 Results and Discussion ",
712
+ "text_level": 1,
713
+ "bbox": [
714
+ 174,
715
+ 228,
716
+ 395,
717
+ 244
718
+ ],
719
+ "page_idx": 6
720
+ },
721
+ {
722
+ "type": "text",
723
+ "text": "We find that SGI performs competitively on the Atari-100K benchmark; presenting aggregate results in Table 2, and full per-game data in Appendix E. Our best setting, SGI-M/L, achieves a median HNS of 0.753, approaching humanlevel sample-efficiency and outperforming all comparable methods except the recently proposed CPT (Campos et al., 2021). With less data and a smaller model, SGI-M achieves a median HNS of 0.679, significantly outperforming the prior method ATC on the same data (ATC-M). Meanwhile, SGI-E achieves a median HNS of 0.456, matching or exceeding other exploratory methods such as APT (Liu & Abbeel, 2021) and VISR (Hansen et al., 2020), as well as ATC-E. ",
724
+ "bbox": [
725
+ 174,
726
+ 260,
727
+ 485,
728
+ 467
729
+ ],
730
+ "page_idx": 6
731
+ },
732
+ {
733
+ "type": "text",
734
+ "text": "Pretraining data efficiency SGI achieves strong performance with only limited pretraining data; our largest dataset contains 6M transitions, or roughly 4.5 days of experience. This compares favourably to recent works on unsupervised exploration such as APT or CPT, which require far larger amounts of data and environment interaction (250M steps or 193 days for APT, 4B steps or 8.45 years for CPT). We expect SGI would perform even better if used in these large-data settingss, as we find that it scales robustly with data (see Section 5.2). ",
735
+ "bbox": [
736
+ 174,
737
+ 482,
738
+ 485,
739
+ 647
740
+ ],
741
+ "page_idx": 6
742
+ },
743
+ {
744
+ "type": "table",
745
+ "img_path": "images/ea11bbe6633cbee02c2d3b588f5e84f44d86ba6737f68217e62f37f3f868be77.jpg",
746
+ "table_caption": [
747
+ "Table 2: HNS on Atari100k for SGI and baselines. "
748
+ ],
749
+ "table_footnote": [],
750
+ "table_body": "<table><tr><td>Method</td><td>Mdn</td><td>Mn</td><td>&gt;H</td><td>&gt;0</td><td>Data</td></tr><tr><td colspan=\"6\">No Pretraining (Finetuning Only)</td></tr><tr><td>SimPLe</td><td>0.144</td><td>0.443</td><td>2</td><td>26</td><td>0</td></tr><tr><td>DER</td><td>0.161</td><td>0.285</td><td></td><td>26</td><td>0</td></tr><tr><td>DrQ</td><td>0.268</td><td>0.357</td><td></td><td>24</td><td>0</td></tr><tr><td>SPR</td><td>0.415</td><td>0.704</td><td>227</td><td>26</td><td>0</td></tr><tr><td>SGI-None</td><td>0.343</td><td>0.565</td><td>3</td><td>26</td><td>0</td></tr></table>",
751
+ "bbox": [
752
+ 501,
753
+ 218,
754
+ 820,
755
+ 324
756
+ ],
757
+ "page_idx": 6
758
+ },
759
+ {
760
+ "type": "text",
761
+ "text": "Behavioural cloning is a strong baseline Although ATC pretrains with expert data, they did not investigate behavioral cloning as a baseline pretraining objective. We do so on our Mixed dataset, the only one to be generated by policies with significantly above-random performance. Behavioral cloning without finetuning $\\mathbf { \\Gamma } ( \\mathbf { B C - M @ 0 } )$ performs poorly, perhaps due to the varying behavioural quality in the dataset. But when finetuned, BC-M yields very respectable performance, surpassing ATC-M but not SGIM. All fine-tuning settings for BC-M match SGIM. ",
762
+ "bbox": [
763
+ 174,
764
+ 662,
765
+ 485,
766
+ 840
767
+ ],
768
+ "page_idx": 6
769
+ },
770
+ {
771
+ "type": "text",
772
+ "text": "5.1 Data quality matters ",
773
+ "text_level": 1,
774
+ "bbox": [
775
+ 174,
776
+ 858,
777
+ 356,
778
+ 872
779
+ ],
780
+ "page_idx": 6
781
+ },
782
+ {
783
+ "type": "text",
784
+ "text": "In principle, SGI can be used with any offline dataset but we demonstrate that it scales with the quality of its data. Near the lower bound of ",
785
+ "bbox": [
786
+ 174,
787
+ 883,
788
+ 483,
789
+ 911
790
+ ],
791
+ "page_idx": 6
792
+ },
793
+ {
794
+ "type": "table",
795
+ "img_path": "images/3b682821bc79f17ad1556ea281d2d65816182efafeba5fd37bafb1979810c4fb.jpg",
796
+ "table_caption": [
797
+ "Exploratory Pretraining + Finetuning ",
798
+ "Offline-data Pretraining + Finetuning "
799
+ ],
800
+ "table_footnote": [],
801
+ "table_body": "<table><tr><td>Method</td><td>Mdn</td><td>Mn</td><td>&gt;H</td><td>&gt;0</td><td>Data</td></tr><tr><td>VISR</td><td>0.095</td><td>1.281</td><td>7</td><td>21</td><td>250M</td></tr><tr><td>APT</td><td>0.475</td><td>0.6661</td><td>7</td><td>26</td><td>250M</td></tr><tr><td>CPT@0²</td><td>0.809</td><td>4.945</td><td>12</td><td>25</td><td>4000M</td></tr><tr><td>ATC-R3</td><td>0.191</td><td>0.472</td><td>4</td><td>26</td><td>6M</td></tr><tr><td>ATC-E3</td><td>0.237</td><td>0.462</td><td>3</td><td>26</td><td>6M</td></tr><tr><td>SGI-R</td><td>0.326</td><td>0.888</td><td>5</td><td>26</td><td>6M</td></tr><tr><td>SGI-E</td><td>0.456</td><td>0.838</td><td>6</td><td>26</td><td>6M</td></tr></table>",
802
+ "bbox": [
803
+ 501,
804
+ 340,
805
+ 820,
806
+ 469
807
+ ],
808
+ "page_idx": 6
809
+ },
810
+ {
811
+ "type": "table",
812
+ "img_path": "images/8e0ce81977b5ffde72ccb18509606f5a6f3a47c914fdc6c540f68850156cae46.jpg",
813
+ "table_caption": [],
814
+ "table_footnote": [
815
+ "1 APT claims 0.6955, but we calculate 0.666 from their reported per-game scores. 2 CPT@0 does not do any finetuning. 3 Our implementation (see Appendix C.6) "
816
+ ],
817
+ "table_body": "<table><tr><td>Method</td><td>Mdn</td><td>Mn</td><td>&gt;H</td><td>&gt;0</td><td>Data</td></tr><tr><td>ATC-W3</td><td>0.219</td><td>0.587</td><td>4</td><td>26</td><td>3M</td></tr><tr><td>ATC-M3</td><td>0.204</td><td>0.780</td><td>5</td><td>26</td><td>3M</td></tr><tr><td>BC-M@0</td><td>0.139</td><td>0.227</td><td>0</td><td>23</td><td>3M</td></tr><tr><td>BC-M</td><td>0.548</td><td>0.858</td><td>8</td><td>26</td><td>3M</td></tr><tr><td>SGI-W</td><td>0.589</td><td>1.144</td><td>8</td><td>26</td><td>5M</td></tr><tr><td>SGI-M/S</td><td>0.423</td><td>0.914</td><td>8</td><td>26</td><td>3M</td></tr><tr><td>SGI-M</td><td>0.679</td><td>1.149</td><td>9</td><td>26</td><td>3M</td></tr><tr><td>SGI-M/L</td><td>0.753</td><td>1.598</td><td>9</td><td>26</td><td>6M</td></tr></table>",
818
+ "bbox": [
819
+ 501,
820
+ 484,
821
+ 818,
822
+ 613
823
+ ],
824
+ "page_idx": 6
825
+ },
826
+ {
827
+ "type": "image",
828
+ "img_path": "images/880457355100b865551c4346d813b088d056f5e068249c95374852ded3b310e6.jpg",
829
+ "image_caption": [
830
+ "Figure 2: SGI finetuning performance vs. pretraining data score for all combinations of game and dataset. Data score is estimated as clipped return per episode, trend calculated via kernel regression. Values whitened per-game for clarity. "
831
+ ],
832
+ "image_footnote": [],
833
+ "bbox": [
834
+ 503,
835
+ 670,
836
+ 815,
837
+ 828
838
+ ],
839
+ "page_idx": 6
840
+ },
841
+ {
842
+ "type": "image",
843
+ "img_path": "images/5d11f7bbc44724d2c7302f581de5aa3f110d4171a02455ceaec8beeb6e17d66f.jpg",
844
+ "image_caption": [
845
+ "Figure 3: Finetuning performance of SGI for different CNN sizes and amounts of pretrained data from the Mixed dataset. We plot IQM HNS with confidence intervals (see Appendix B). "
846
+ ],
847
+ "image_footnote": [],
848
+ "bbox": [
849
+ 179,
850
+ 93,
851
+ 480,
852
+ 250
853
+ ],
854
+ "page_idx": 7
855
+ },
856
+ {
857
+ "type": "image",
858
+ "img_path": "images/2d2a53b5f87c93dd61e6a468bbd667840e46ed6ff510a6a3e4b857e7d8809ae7.jpg",
859
+ "image_caption": [
860
+ "Figure 4: Average cosine similarity between representations over pretraining, averaged across the 26 Atari 100k games. 1 indicates representations are identical, 0 perfect dissimilarity. "
861
+ ],
862
+ "image_footnote": [],
863
+ "bbox": [
864
+ 504,
865
+ 93,
866
+ 812,
867
+ 250
868
+ ],
869
+ "page_idx": 7
870
+ },
871
+ {
872
+ "type": "text",
873
+ "text": "",
874
+ "bbox": [
875
+ 176,
876
+ 332,
877
+ 485,
878
+ 344
879
+ ],
880
+ "page_idx": 7
881
+ },
882
+ {
883
+ "type": "text",
884
+ "text": "data quality where all actions are selected randomly, SGI-R still provides some benefit over an otherwise-identical randomly-initialized agent (SGI-None) on 16 out of 26 games, with a similar median but $57 \\%$ higher mean HNS. With better data from an exploratory policy, SGI-E improves on 16/26 games, gets $33 \\%$ higher median HNS, and surpasses APT (Liu & Abbeel, 2021) which used 40 times more pretraining data. With similarly weak data but possibly more task-specific transitions, SGI-W gets $72 \\%$ higher median HNS compared to SGI-None and with realistic data from a mixture of policies, SGI-M improves to $98 \\%$ . ",
885
+ "bbox": [
886
+ 174,
887
+ 342,
888
+ 825,
889
+ 440
890
+ ],
891
+ "page_idx": 7
892
+ },
893
+ {
894
+ "type": "text",
895
+ "text": "Importantly, the pattern we observe is very different from what would be expected for imitation learning. In particular, SGI-W’s strong performance shows that expert data is not required. To characterize this, we plot the average clipped reward 5 experienced per episode for each of our pretraining datasets in Figure 2. Normalizing across tasks, we find a strong positive correlation between task reward engagement $( p < 0 . 0 0 0 1 )$ and finetuning performance. Moreover, we find diminishing returns to further task engagement. ",
896
+ "bbox": [
897
+ 174,
898
+ 448,
899
+ 825,
900
+ 531
901
+ ],
902
+ "page_idx": 7
903
+ },
904
+ {
905
+ "type": "text",
906
+ "text": "5.2 Pretraining unlocks the value of larger networks ",
907
+ "text_level": 1,
908
+ "bbox": [
909
+ 178,
910
+ 554,
911
+ 547,
912
+ 569
913
+ ],
914
+ "page_idx": 7
915
+ },
916
+ {
917
+ "type": "text",
918
+ "text": "The three-layer network introduced by Mnih et al. (2015) has become a fixture of deep reinforcement learning, and has been employed by previous works examining pretraining in this field (e.g. Liu & Abbeel, 2021; Stooke et al., 2021). However, we find that representational pretraining with this network (SGI-M/S) provides only minor benefits compared to training from scratch. In contrast, larger networks struggle without pretraining but shine when pretrained as shown in Figure 3. ",
919
+ "bbox": [
920
+ 174,
921
+ 582,
922
+ 825,
923
+ 651
924
+ ],
925
+ "page_idx": 7
926
+ },
927
+ {
928
+ "type": "text",
929
+ "text": "This finding is consistent with recent work in unsupervised representation learning for classification, which has observed that unsupervised pretraining benefits disproportionately from larger networks (Chen et al., 2020a). In particular, our results suggest that model size should increase in parallel with amount of pretraining data, matching recent work on scaling in language modeling (Kaplan et al., 2020; Hernandez et al., 2021). SGI thus provides a simple way to use unlabeled data to extend the benefits of large networks, already well-known in the large-data regime (e.g., Schrittwieser et al., 2021; Espeholt et al., 2018), to data-efficient RL. ",
930
+ "bbox": [
931
+ 174,
932
+ 657,
933
+ 825,
934
+ 755
935
+ ],
936
+ "page_idx": 7
937
+ },
938
+ {
939
+ "type": "text",
940
+ "text": "5.3 Combining SGI’s objectives improves performance ",
941
+ "text_level": 1,
942
+ "bbox": [
943
+ 174,
944
+ 777,
945
+ 566,
946
+ 792
947
+ ],
948
+ "page_idx": 7
949
+ },
950
+ {
951
+ "type": "text",
952
+ "text": "We test all possible combinations of our three SSL objectives, denoted by combinations of the letters S, G and I to indicate which objectives they employ. Results in Table 3 show that performance monotonically increases as more objectives are used, with inverse dynamics modeling combined with either of the other objectives performing respectably well. This illustrates the importance of using multiple objectives to obtain representational coverage of the MDP. ",
953
+ "bbox": [
954
+ 174,
955
+ 805,
956
+ 825,
957
+ 875
958
+ ],
959
+ "page_idx": 7
960
+ },
961
+ {
962
+ "type": "text",
963
+ "text": "We note that including inverse modeling appears to be critical, and hypothesize that this is related to representational collapse. To measure this, we plot the average cosine similarity between representations $y _ { t }$ of different states for several pretraining methods in Figure 4, using our ResNet encoder on the Mixed dataset. We observe that S, G and $\\mathbf { s } { + } \\mathbf { G }$ all show some degree representational collapse, while configurations that include inverse dynamics modeling avoid representational collapse, as does ATC, whose contrastive loss implicitly optimizes for representational diversity (Wang & Isola, 2020). Intriguingly, we observe that increased representational diversity does not necessarily improve performance. For example, SGI outperforms ATC, $\\mathbf { G } { + } \\mathbf { I }$ and ",
964
+ "bbox": [
965
+ 174,
966
+ 92,
967
+ 531,
968
+ 284
969
+ ],
970
+ "page_idx": 8
971
+ },
972
+ {
973
+ "type": "table",
974
+ "img_path": "images/203f21dc32c74e698d6e49aba1e36c86205ba7d2360a8ae2e2541d46d2de8e30.jpg",
975
+ "table_caption": [
976
+ "Table 3: HNS on Atari 100K for pretraining ablations of SGI. "
977
+ ],
978
+ "table_footnote": [],
979
+ "table_body": "<table><tr><td>Pretraining</td><td>Mdn</td><td>Mean</td><td>&gt;H</td></tr><tr><td>None</td><td>0.343</td><td>0.565</td><td>3</td></tr><tr><td>S</td><td>0.009</td><td>-0.054</td><td>0</td></tr><tr><td>G</td><td>0.060</td><td>0.181</td><td>1</td></tr><tr><td>I</td><td>0.411</td><td>0.943</td><td>7</td></tr><tr><td>S+G</td><td>0.029</td><td>0.098</td><td>0</td></tr><tr><td>G+I</td><td>0.512</td><td>1.004</td><td>9</td></tr><tr><td>S+I</td><td>0.629</td><td>0.978</td><td>8</td></tr><tr><td>SGI-M</td><td>0.679</td><td>1.149</td><td>9</td></tr></table>",
980
+ "bbox": [
981
+ 545,
982
+ 125,
983
+ 805,
984
+ 273
985
+ ],
986
+ "page_idx": 8
987
+ },
988
+ {
989
+ "type": "text",
990
+ "text": "I in finetuning but has less diverse pretraining representations. We also observe that adding SPR (S) consistently pulls representations towards collapse (compare $\\mathbf { S } { + } \\mathbf { I }$ and I, $\\mathbf { s } { + } \\mathbf { G }$ and G, and SGI and $\\mathbf { G } { + } \\mathbf { I } )$ ; how this relates to performance is a question for future work. ",
991
+ "bbox": [
992
+ 174,
993
+ 285,
994
+ 826,
995
+ 327
996
+ ],
997
+ "page_idx": 8
998
+ },
999
+ {
1000
+ "type": "text",
1001
+ "text": "5.4 Naively finetuning ruins pretrained representations ",
1002
+ "text_level": 1,
1003
+ "bbox": [
1004
+ 173,
1005
+ 366,
1006
+ 566,
1007
+ 381
1008
+ ],
1009
+ "page_idx": 8
1010
+ },
1011
+ {
1012
+ "type": "text",
1013
+ "text": "We find that properly finetuning pretrained representations is critical, as results in Table 4 show. Although allowing pretrained weights to change freely during finetuning is better than initializing from scratch (Naive vs No Pretrain), freezing the pretrained encoder (Frozen) leads to better performance than either. SGI’s approach of reducing finetuning learning rates for pretrained parameters leads to superior performance (Reduced LRs, equivalent to SGI-M). ",
1014
+ "bbox": [
1015
+ 174,
1016
+ 401,
1017
+ 537,
1018
+ 525
1019
+ ],
1020
+ "page_idx": 8
1021
+ },
1022
+ {
1023
+ "type": "table",
1024
+ "img_path": "images/40c47048789f5b798bcbc42b866882de7e5a80ce83e995630e4e80d4c5a181e6.jpg",
1025
+ "table_caption": [
1026
+ "Table 4: HNS on Atari 100K for finetuning schemes for SGI. "
1027
+ ],
1028
+ "table_footnote": [],
1029
+ "table_body": "<table><tr><td>Method</td><td>Mdn</td><td>Mean</td><td>&gt;H</td></tr><tr><td>No pretrain</td><td>0.343</td><td>0.565</td><td>3</td></tr><tr><td>Naive</td><td>0.429</td><td>0.845</td><td>8</td></tr><tr><td>Frozen</td><td>0.499</td><td>0.971</td><td>8</td></tr><tr><td>Reduced LRs</td><td>0.679</td><td>1.149</td><td>9</td></tr></table>",
1030
+ "bbox": [
1031
+ 552,
1032
+ 435,
1033
+ 821,
1034
+ 521
1035
+ ],
1036
+ "page_idx": 8
1037
+ },
1038
+ {
1039
+ "type": "text",
1040
+ "text": "We thus hypothesize that representations learned by SGI are being disrupted by gradients early in finetuning, in a phenomenon analogous to catastrophic forgetting (Zenke et al., 2017; Hadsell et al., 2020). As representations may not generalize between different value functions across training (Dabney et al., 2021), allowing the encoder to strongly adapt early in training could make it worse at modeling later value functions, compared to the neutral initialization from SGI. We also note that there is a long history in computer vision of employing specialized finetuning hyperparameters (Li et al., 2020; Chu et al., 2016) when transferring tasks. ",
1041
+ "bbox": [
1042
+ 173,
1043
+ 531,
1044
+ 825,
1045
+ 628
1046
+ ],
1047
+ "page_idx": 8
1048
+ },
1049
+ {
1050
+ "type": "text",
1051
+ "text": "5.5 Not all SSL objectives are beneficial during finetuning ",
1052
+ "text_level": 1,
1053
+ "bbox": [
1054
+ 173,
1055
+ 669,
1056
+ 588,
1057
+ 684
1058
+ ],
1059
+ "page_idx": 8
1060
+ },
1061
+ {
1062
+ "type": "text",
1063
+ "text": "Although SGI uses S during finetuning, we experiment with a variant that optimizes only the standard DQN objective, roughly equivalent to using $\\mathrm { D r Q }$ (Kostrikov et al., 2021) with DQN hyperparameters set to match SGI. We find that finetuning with S has a large impact with or without pretraining (compare None and S Only entries in Table 5.). Although, SGI without S manages to achieve roughly the same mean human-normalized score as SGI with S, removing S harms performance on performance on 19 out of 26 games and reduces median normalized score by roughly $33 \\%$ . We also find no benefit to using all of SGI’s constituent objectives during finetuning (All Losses in Table 5) compared to using S alone, although the gap between them is not statistically significant for metrics other than median (see Figure 5d). ",
1064
+ "bbox": [
1065
+ 174,
1066
+ 704,
1067
+ 539,
1068
+ 911
1069
+ ],
1070
+ "page_idx": 8
1071
+ },
1072
+ {
1073
+ "type": "table",
1074
+ "img_path": "images/3a9f978c0b41be7ea48fc2c5bd53f41db78f1980f6a380ea445e1809f70688ec.jpg",
1075
+ "table_caption": [
1076
+ "Table 5: HNS on Atari 100K for finetuning ablations of SGI. "
1077
+ ],
1078
+ "table_footnote": [],
1079
+ "table_body": "<table><tr><td>Finetune SSL</td><td>Mdn</td><td>Mean</td><td>&gt;H</td></tr><tr><td>Without SGI pretraining</td><td></td><td></td><td></td></tr><tr><td>None</td><td>0.161</td><td>0.315</td><td>23</td></tr><tr><td>S Only</td><td>0.343</td><td>0.565</td><td></td></tr><tr><td>With SGI pretraining</td><td></td><td></td><td></td></tr><tr><td>None</td><td>0.452</td><td>1.114</td><td>8</td></tr><tr><td>SGI</td><td>0.397</td><td>1.011</td><td>8</td></tr><tr><td>S Only</td><td>0.679</td><td>1.149</td><td>9</td></tr></table>",
1080
+ "bbox": [
1081
+ 555,
1082
+ 738,
1083
+ 825,
1084
+ 885
1085
+ ],
1086
+ "page_idx": 8
1087
+ },
1088
+ {
1089
+ "type": "text",
1090
+ "text": "6 Conclusion ",
1091
+ "text_level": 1,
1092
+ "bbox": [
1093
+ 174,
1094
+ 89,
1095
+ 299,
1096
+ 106
1097
+ ],
1098
+ "page_idx": 9
1099
+ },
1100
+ {
1101
+ "type": "text",
1102
+ "text": "We present SGI, a fully self-supervised (reward-free) approach to representation learning for reinforcement learning, which uses a combination of pretraining objectives to encourage the agent to learn multiple aspects of environment dynamics. We demonstrate that SGI enables significant improvements on the Atari $1 0 0 \\mathrm { k }$ data-efficiency benchmark, especially in comparison to unsupervised exploration approaches which require orders of magnitude more pretraining data. Investigating the various components of SGI, we find that it scales robustly with higher-quality pretraining data and larger models, that all three of the self-supervised objectives contribute to the success of this approach, and that careful reduction of fine-tuning learning rates is critical to optimal performance. ",
1103
+ "bbox": [
1104
+ 174,
1105
+ 121,
1106
+ 825,
1107
+ 231
1108
+ ],
1109
+ "page_idx": 9
1110
+ },
1111
+ {
1112
+ "type": "text",
1113
+ "text": "7 Acknowledgements ",
1114
+ "text_level": 1,
1115
+ "bbox": [
1116
+ 176,
1117
+ 250,
1118
+ 367,
1119
+ 267
1120
+ ],
1121
+ "page_idx": 9
1122
+ },
1123
+ {
1124
+ "type": "text",
1125
+ "text": "We would like to thank Mila and Compute Canada for computational resources. We would like to thank Rishabh Agarwal for useful discussions. Aaron Courville would like to acknowledge financial support from Microsoft Research and Hitachi. We would also like to thank Wancong (Kevin) Zhang for his helpful comments to the codebase on GitHub. ",
1126
+ "bbox": [
1127
+ 174,
1128
+ 281,
1129
+ 825,
1130
+ 337
1131
+ ],
1132
+ "page_idx": 9
1133
+ },
1134
+ {
1135
+ "type": "text",
1136
+ "text": "References ",
1137
+ "text_level": 1,
1138
+ "bbox": [
1139
+ 174,
1140
+ 357,
1141
+ 266,
1142
+ 373
1143
+ ],
1144
+ "page_idx": 9
1145
+ },
1146
+ {
1147
+ "type": "text",
1148
+ "text": "Agarwal, R., Schuurmans, D., and Norouzi, M. An optimistic perspective on offline reinforcement learning. In ICML, 2020. 5 \nAgarwal, R., Schwarzer, M., Castro, P. S., Courville, A., and Bellemare, M. G. Deep reinforcement learning at the edge of the statistical precipice. NeurIPS, 2021. 5, 15, 19 \nAnand, A., Racah, E., Ozair, S., Bengio, Y., Côté, M.-A., and Hjelm, R. D. Unsupervised state representation learning in atari. In NeurIPS, 2019. 4, 5 \nAndrychowicz, M., Wolski, F., Ray, A., Schneider, J., Fong, R., Welinder, P., McGrew, B., Tobin, J., Abbeel, O. P., and Zaremba, W. Hindsight experience replay. In Advances in neural information processing systems, pp. 5048–5058, 2017. 3 \nBa, J. L., Kiros, J. R., and Hinton, G. E. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. 18 \nBachman, P., Hjelm, R. D., and Buchwalter, W. Learning representations by maximizing mutual information across views. In NeurIPS, 2019. 4 \nBellemare, M. G., Dabney, W., and Munos, R. A distributional perspective on reinforcement learning. ICML, 2017. 15 \nBrown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. 1 \nBurda, Y., Edwards, H., Pathak, D., Storkey, A., Darrell, T., and Efros, A. A. Large-scale study of curiosity-driven learning, 2018. 4, 5 \nCampos, V., Sprechmann, P., Hansen, S. S., Barreto, A., Blundell, C., Vitvitskyi, A., Kapturowski, S., and Badia, A. P. Coverage as a principle for discovering transferable behavior in reinforcement learning, 2021. URL https://openreview.net/forum?id $\\equiv$ INhwJdJtxn6. 1, 4, 5, 6, 7 \nCastro, P. S., Moitra, S., Gelada, C., Kumar, S., and Bellemare, M. G. Dopamine: A Research Framework for Deep Reinforcement Learning. 2018. URL http://arxiv.org/abs/1812.061 10. 6 \nChen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual representations. ICML, 2020a. 1, 4, 8 \nChen, T., Kornblith, S., Swersky, K., Norouzi, M., and Hinton, G. Big self-supervised models are strong semi-supervised learners. In NeurIPS, 2020b. 4 \nChu, B., Madhavan, V., Beijbom, O., Hoffman, J., and Darrell, T. Best Practices for Fine-Tuning Visual Classifiers to New Domains, pp. 435–442. 11 2016. ISBN 978-3-319-49408-1. doi: 10.1007/978-3-319-49409-8_34. 9 \nDabney, W., Barreto, A., Rowland, M., Dadashi, R., Quan, J., Bellemare, M. G., and Silver, D. The value-improvement path: Towards better representations for reinforcement learning. 2021. 3, 9 \nDegris, T. and Modayil, J. Scaling-up knowledge for a cognizant robot. In AAAI Spring Symposium on Designing Intelligent Robots: Reintegrating AI., 2012. 2 \nDevlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. In ACL, 2019. 1 \nDubey, R., Agrawal, P., Pathak, D., Griffiths, T., and Efros, A. Investigating human priors for playing video games. In International Conference on Machine Learning, 2018. 1 \nDulac-Arnold, G., Levine, N., Mankowitz, D. J., Li, J., Paduraru, C., Gowal, S., and Hester, T. An empirical investigation of the challenges of real-world reinforcement learning. 2020. 5 \nEspeholt, L., Soyer, H., Munos, R., Simonyan, K., Mnih, V., Ward, T., Doron, Y., Firoiu, V., Harley, T., Dunning, I., Legg, S., and Kavukcuoglu, K. IMPALA: scalable distributed deeprl with importance weighted actor-learner architectures. CoRR, abs/1802.01561, 2018. URL http://arxiv.org/abs/1802.01561. 6, 8, 18 \nEysenbach, B., Gupta, A., Ibarz, J., and Levine, S. Diversity is all you need: Learning skills without a reward function. In International Conference on Learning Representations, 2018. 4 \nGelada, C., Kumar, S., Buckman, J., Nachum, O., and Bellemare, M. G. Deepmdp: Learning continuous latent space models for representation learning. ICML, 2019. 2, 4 \nGrill, J.-B., Strub, F., Altché, F., Tallec, C., Richemond, P. H., Buchatskaya, E., Doersch, C., Pires, B. A., Guo, Z. D., Azar, M. G., et al. Bootstrap your own latent: A new approach to self-supervised learning. In NeurIPS, 2020. 1, 4 \nGuo, D., Pires, B. A., Piot, B., Grill, J.-b., Altché, F., Munos, R., and Azar, M. G. Bootstrap latent-predictive representations for multitask reinforcement learning. In ICML, 2020. 4 \nGuo, Z. D., Azar, M. G., Piot, B., Pires, B. A., and Munos, R. Neural predictive belief representations. ICML, 2018. 2 \nHadsell, R., Rao, D., Rusu, A. A., and Pascanu, R. Embracing change: Continual learning in deep neural networks. Trends in Cognitive Sciences, 2020. doi: https://doi.org/10.1016/j.tics.2020.09.0 04. URL http://www.sciencedirect.com/science/article/pii/S1364661320302199. 9 \nHansen, S., Dabney, W., Barreto, A., Warde-Farley, D., de Wiele, T. V., and Mnih, V. Fast task inference with variational intrinsic successor features. In ICLR, 2020. 1, 2, 4, 5, 6, 7 \nHarris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournapeau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., Kern, R., Picus, M., Hoyer, S., van Kerkwijk, M. H., Brett, M., Haldane, A., del R’ıo, J. F., Wiebe, M., Peterson, P., G’erard-Marchant, P., Sheppard, K., Reddy, T., Weckesser, W., Abbasi, H., Gohlke, C., and Oliphant, T. E. Array programming with NumPy. Nature, 585(7825):357–362, September 2020. doi: 10.1038/s41586-020-2649-2. URL https://doi.org/10.1038/s41586-020-2649-2. 15 \nHe, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In CVPR, 2016. 18 \nHe, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. Momentum contrast for unsupervised visual representation learning. In CVPR, 2020. 4 \nHénaff, O. J., Srinivas, A., De Fauw, J., Razavi, A., Doersch, C., Eslami, S., and Oord, A. v. d. Dataefficient image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019. 1, 4 \nHernandez, D., Kaplan, J., Henighan, T., and McCandlish, S. Scaling laws for transfer, 2021. 8 \nHessel, M., Modayil, J., van Hasselt, H., Schaul, T., Ostrovski, G., Dabney, W., Horgan, D., Piot, B., Azar, M. G., and Silver, D. Rainbow: Combining improvements in deep reinforcement learning. In AAAI, 2018. 3, 15 \nHessel, M., Danihelka, I., Viola, F., Guez, A., Schmitt, S., Sifre, L., Weber, T., Silver, D., and van Hasselt, H. Muesli: Combining improvements in policy optimization. arXiv preprint arXiv:2104.06159, 2021. 2 \nHjelm, R. D., Fedorov, A., Lavoie-Marchildon, S., Grewal, K., Bachman, P., Trischler, A., and Bengio, Y. Learning deep representations by mutual information estimation and maximization. ICLR, 2019. 4 \nIoffe, S. and Szegedy, C. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. 18 \nKaiser, Ł., Babaeizadeh, M., Miłos, P., Osinski, B., Campbell, R. H., Czechowski, K., Erhan, D., ´ Finn, C., Kozakowski, P., Levine, S., et al. Model based reinforcement learning for atari. In ICLR, 2019. 4, 5, 6, 7, 21, 22, 23, 24 \nKaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. 8 \nKielak, K. P. Do recent advancements in model-based deep reinforcement learning really improve data efficiency?, 2020. URL https://openreview.net/forum?id=Bke9u1HFwB. 4 \nKostrikov, I., Yarats, D., and Fergus, R. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. In ICLR, 2021. 4, 5, 7, 9, 18 \nLake, B. M., Ullman, T. D., Tenenbaum, J. B., and Gershman, S. J. Building machines that learn and think like people. Behavioral and brain sciences, 40, 2017. 1 \nLesort, T., Díaz-Rodríguez, N., Goudou, J.-F., and Filliat, D. State representation learning for control: An overview. Neural Networks, 108, 2018. 3, 4 \nLi, H., Chaudhari, P., Yang, H., Lam, M., Ravichandran, A., Bhotika, R., and Soatto, S. Rethinking the hyperparameters for fine-tuning. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\\ c =$ B1g8VkHFPH. 9 \nLiu, H. and Abbeel, P. Unsupervised active pre-training for reinforcement learning, 2021. URL https://openreview.net/forum?id=cvNYovr16SB. 1, 2, 4, 5, 6, 7, 8, 21 \nMazoure, B., Combes, R. T. d., Doan, T., Bachman, P., and Hjelm, R. D. Deep reinforcement and infomax learning. In NeurIPS, 2020. 4 \nMnih, V., Kavukcuoglu, K., Silver, D., Rusu, A. A., Veness, J., Bellemare, M. G., Graves, A., Riedmiller, M., Fidjeland, A. K., Ostrovski, G., et al. Human-level control through deep reinforcement learning. Nature, 518(7540), 2015. 5, 6, 8, 15, 18 \nNg, A. Y., Harada, D., and Russell, S. J. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, 1999. 18 \nOord, A. v. d., Li, Y., and Vinyals, O. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 4 \nPaszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. Pytorch: An imperative style, high-performance deep learning library. In NeurIPS, 2019. 15 \nPathak, D., Agrawal, P., Efros, A. A., and Darrell, T. Curiosity-driven exploration by self-supervised prediction. In ICML. PMLR, 2017. 4 Perez, E., Strub, F., de Vries, H., Dumoulin, V., and Courville, A. C. Film: Visual reasoning with a general conditioning layer. In AAAI, 2018. 18 Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., and Chen, L.-C. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4510–4520, 2018. 18 Schrittwieser, J., Antonoglou, I., Hubert, T., Simonyan, K., Sifre, L., Schmitt, S., Guez, A., Lockhart, E., Hassabis, D., Graepel, T., et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 2021. 8 Schwarzer, M., Anand, A., Goel, R., Hjelm, R. D., Courville, A., and Bachman, P. Data-efficient reinforcement learning with self-predictive representations. In ICLR, 2021. 2, 3, 4, 5, 6, 7, 15, 18, \n21, 22 Sekar, R., Rybkin, O., Daniilidis, K., Abbeel, P., Hafner, D., and Pathak, D. Planning to explore via self-supervised world models. In ICML, 2020. 4 Sharma, A., Gu, S., Levine, S., Kumar, V., and Hausman, K. Dynamics-aware unsupervised discovery of skills. In International Conference on Learning Representations, 2019. 4 Sohn, K., Berthelot, D., Li, C.-L., Zhang, Z., Carlini, N., Cubuk, E. D., Kurakin, A., Zhang, H., and Raffel, C. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. arXiv preprint arXiv:2001.07685, 2020. 4 Stooke, A. and Abbeel, P. rlpyt: A research code base for deep reinforcement learning in pytorch. arXiv preprint arXiv:1909.01500, 2019. 15 Stooke, A., Lee, K., Abbeel, P., and Laskin, M. Decoupling representation learning from reinforcement learning, 2021. 1, 2, 4, 5, 6, 7, 8, 19, 24 Sutton, R. S. and Barto, A. G. Reinforcement Learning: An Introduction. The MIT Press, second edition, 2018. URL http://incompleteideas.net/book/the-book-2nd.html. 15 Tan, M. and Le, Q. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pp. 6105–6114, 2019. 18 Tarvainen, A. and Valpola, H. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NeurIPS, 2017. 4 Tsividis, P., Pouncy, T., Xu, J. L., Tenenbaum, J. B., and Gershman, S. J. Human learning in atari. In AAAI Spring Symposia, 2017. 1 Van Hasselt, H., Guez, A., and Silver, D. Deep reinforcement learning with double q-learning. In AAAI, 2016. 15 van Hasselt, H. P., Hessel, M., and Aslanides, J. When to use parametric models in reinforcement learning? In NeurIPS, 2019. 4, 7 Wang, T. and Isola, P. Understanding contrastive representation learning through alignment and uniformity on the hypersphere, 2020. 9 Wang, Z., Schaul, T., Hessel, M., Hasselt, H., Lanctot, M., and Freitas, N. Dueling network architectures for deep reinforcement learning. In ICML, 2016. 15 Yang, M. and Nachum, O. Representation matters: Offline pretraining for sequential decision making. arXiv preprint arXiv:2102.05815, 2021. 5 Yarats, D., Fergus, R., Lazaric, A., and Pinto, L. Reinforcement learning with prototypical representations. arXiv preprint arXiv:2102.11271, 2021. 4 Zenke, F., Poole, B., and Ganguli, S. Continual learning through synaptic intelligence. In ICML, \n2017. 9 \nZhan, A., Zhao, P., Pinto, L., Abbeel, P., and Laskin, M. A framework for efficient robotic manipulation, 2020. 5 \nZhang, C., Vinyals, O., Munos, R., and Bengio, S. A study on overfitting in deep reinforcement learning. arXiv preprint arXiv:1804.06893, 2018. 1 ",
1149
+ "bbox": [
1150
+ 171,
1151
+ 378,
1152
+ 828,
1153
+ 917
1154
+ ],
1155
+ "page_idx": 9
1156
+ },
1157
+ {
1158
+ "type": "text",
1159
+ "text": "",
1160
+ "bbox": [
1161
+ 169,
1162
+ 47,
1163
+ 828,
1164
+ 920
1165
+ ],
1166
+ "page_idx": 10
1167
+ },
1168
+ {
1169
+ "type": "text",
1170
+ "text": "",
1171
+ "bbox": [
1172
+ 169,
1173
+ 53,
1174
+ 828,
1175
+ 921
1176
+ ],
1177
+ "page_idx": 11
1178
+ },
1179
+ {
1180
+ "type": "text",
1181
+ "text": "",
1182
+ "bbox": [
1183
+ 169,
1184
+ 68,
1185
+ 828,
1186
+ 916
1187
+ ],
1188
+ "page_idx": 12
1189
+ },
1190
+ {
1191
+ "type": "text",
1192
+ "text": "",
1193
+ "bbox": [
1194
+ 173,
1195
+ 90,
1196
+ 826,
1197
+ 159
1198
+ ],
1199
+ "page_idx": 13
1200
+ }
1201
+ ]
parse/train/XpSAvlvnMa/XpSAvlvnMa_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/XpSAvlvnMa/XpSAvlvnMa_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/bNdohBx9sPa/bNdohBx9sPa.md ADDED
File without changes
parse/train/bNdohBx9sPa/bNdohBx9sPa_content_list.json ADDED
@@ -0,0 +1 @@
 
 
1
+ []
parse/train/bNdohBx9sPa/bNdohBx9sPa_layout.pdf ADDED
Binary file (17.2 kB). View file
 
parse/train/bNdohBx9sPa/bNdohBx9sPa_middle.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "pdf_info": [
3
+ {
4
+ "preproc_blocks": [],
5
+ "page_idx": 0,
6
+ "page_size": [
7
+ 595,
8
+ 841
9
+ ],
10
+ "discarded_blocks": [],
11
+ "para_blocks": []
12
+ }
13
+ ],
14
+ "_backend": "pipeline",
15
+ "_version_name": "2.2.2"
16
+ }
parse/train/bNdohBx9sPa/bNdohBx9sPa_model.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "layout_dets": [
4
+ {
5
+ "category_id": 2,
6
+ "poly": [
7
+ 839,
8
+ 1929,
9
+ 857,
10
+ 1929,
11
+ 857,
12
+ 1955,
13
+ 839,
14
+ 1955
15
+ ],
16
+ "score": 0.772
17
+ },
18
+ {
19
+ "category_id": 2,
20
+ "poly": [
21
+ 749,
22
+ 546,
23
+ 948,
24
+ 546,
25
+ 948,
26
+ 584,
27
+ 749,
28
+ 584
29
+ ],
30
+ "score": 0.593
31
+ },
32
+ {
33
+ "category_id": 1,
34
+ "poly": [
35
+ 749,
36
+ 546,
37
+ 948,
38
+ 546,
39
+ 948,
40
+ 584,
41
+ 749,
42
+ 584
43
+ ],
44
+ "score": 0.301
45
+ },
46
+ {
47
+ "category_id": 15,
48
+ "poly": [
49
+ 838.0,
50
+ 1928.0,
51
+ 861.0,
52
+ 1928.0,
53
+ 861.0,
54
+ 1964.0,
55
+ 838.0,
56
+ 1964.0
57
+ ],
58
+ "score": 0.999,
59
+ "text": "1"
60
+ },
61
+ {
62
+ "category_id": 15,
63
+ "poly": [
64
+ 747.0,
65
+ 545.0,
66
+ 948.0,
67
+ 545.0,
68
+ 948.0,
69
+ 587.0,
70
+ 747.0,
71
+ 587.0
72
+ ],
73
+ "score": 0.973,
74
+ "text": "June 21, 2021"
75
+ },
76
+ {
77
+ "category_id": 15,
78
+ "poly": [
79
+ 747.0,
80
+ 545.0,
81
+ 948.0,
82
+ 545.0,
83
+ 948.0,
84
+ 587.0,
85
+ 747.0,
86
+ 587.0
87
+ ],
88
+ "score": 0.973,
89
+ "text": "June 21, 2021"
90
+ }
91
+ ],
92
+ "page_info": {
93
+ "page_no": 0,
94
+ "width": 1654,
95
+ "height": 2339
96
+ }
97
+ }
98
+ ]
parse/train/bNdohBx9sPa/bNdohBx9sPa_origin.pdf ADDED
Binary file (17.2 kB). View file
 
parse/train/bNdohBx9sPa/bNdohBx9sPa_span.pdf ADDED
Binary file (17.2 kB). View file