ZHANGYUXUAN-zR commited on
Commit
2233ac0
·
verified ·
1 Parent(s): 065126e

Add files using upload-large-folder tool

Browse files
parse/train/BkdpaH9ll/BkdpaH9ll.md ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BOOSTING IMAGE CAPTIONING WITH ATTRIBUTES
2
+
3
+ Ting Yao, Yingwei Pan, Yehao Li, Zhaofan Qiu, Tao Mei Microsoft Research Asia {tiyao, v-yipan, v-yehl, v-zhqiu, tmei}@microsoft.com
4
+
5
+ # ABSTRACT
6
+
7
+ Automatically describing an image with a natural language has been an emerging challenge in both fields of computer vision and natural language processing. In this paper, we present Long Short-Term Memory with Attributes (LSTM-A) - a novel architecture that integrates attributes into the successful Convolutional Neural Networks (CNNs) plus Recurrent Neural Networks (RNNs) image captioning framework, by training them in an end-to-end manner. To incorporate attributes, we construct variants of architectures by feeding image representations and attributes into RNNs in different ways to explore the mutual but also fuzzy relationship between them. Extensive experiments are conducted on COCO image captioning dataset and our framework achieves superior results when compared to state-of-the-art deep models. Most remarkably, we obtain METEOR/CIDEr-D of $2 5 . 2 \% / 9 8 . 6 \%$ on testing data of widely used and publicly available splits in (Karpathy & Fei-Fei, 2015) when extracting image representations by GoogleNet and achieve to date top-1 performance on COCO captioning Leaderboard.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Accelerated by tremendous increase in Internet bandwidth and proliferation of sensor-rich mobile devices, image data has been generated, published and spread explosively, becoming an indispensable part of today’s big data. This has encouraged the development of advanced techniques for a broad range of image understanding applications. A fundamental issue that underlies the success of these technological advances is the recognition (Szegedy et al., 2015; Simonyan & Zisserman, 2015; He et al., 2016). Recently, researchers have strived to automatically describe the content of an image with a complete and natural sentence, which has a great potential impact for instance on robotic vision or helping visually impaired people. Nevertheless, this problem is very challenging, as description generation model should capture not only the objects or scenes presented in the image, but also be capable of expressing how the objects/scenes relate to each other in a nature sentence.
12
+
13
+ The main inspiration of recent attempts on this problem (Donahue et al., 2015; Vinyals et al., 2015; Xu et al., 2015; You et al., 2016) are from the advances by using RNNs in machine translation (Sutskever et al., 2014), which is to translate a text from one language (e.g., English) to another (e.g., Chinese). The basic idea is to perform a sequence to sequence learning for translation, where an encoder RNN reads the input sequential sentence, one word at a time till the end of the sentence and then a decoder RNN is exploited to generate the sentence in target language, one word at each time step. Following this philosophy, it is natural to employ a CNN instead of the encoder RNN for image captioning, which is regarded as an image encoder to produce image representations.
14
+
15
+ While encouraging performances are reported, these CNN plus RNN image captioning methods translate directly from image representations to language, without explicitly taking more high-level semantic information from images into account. Furthermore, attributes are properties observed in images with rich semantic cues and have been proved to be effective in visual recognition (Parikh & Grauman, 2011). A valid question is how to incorporate high-level image attributes into CNN plus RNN image captioning architecture as complementary knowledge in addition to image representations. We investigate particularly in this paper the architectures by exploiting the mutual relationship between image representations and attributes for enhancing image description generation. Specifically, to better demonstrate the impact of simultaneously utilizing the two kinds of representations, we devise variants of architectures by feeding them into RNN in different placements and moments, e.g., leveraging only attributes, inserting image representations first and then attributes or vice versa, and inputting image representations/attributes once or at each time step.
16
+
17
+ The main contribution of this work is the proposal of attribute augmented architectures by integrating the attributes into CNN plus RNN image captioning framework, which is a problem not yet fully understood in the literature. By leveraging more knowledge for building richer representations and description models, our work takes a further step forward to enhance image captioning and could have a direct impact of indicating a new direction of vision and language research. More importantly, the utilization of attributes also has a great potential to be an elegant solution of generating openvocabulary sentences, making image captioning system really practical.
18
+
19
+ # 2 RELATED WORK
20
+
21
+ The research on image captioning has proceeded along three different dimensions: template-based methods (Kulkarni et al., 2013; Yang et al., 2011; Mitchell et al., 2012), search-based approaches (Farhadi et al., 2010; Ordonez et al., 2011; Devlin et al., 2015), and language-based models (Donahue et al., 2015; Kiros et al., 2014; Mao et al., 2014; Vinyals et al., 2015; Xu et al., 2015; Wu et al., 2016; You et al., 2016).
22
+
23
+ The first direction, template-based methods, predefine the template for sentence generation which follows some specific rules of language grammar and split sentence into several parts (e.g., subject, verb, and object). With such sentence fragments, many works align each part with image content and then generate the sentence for the image. Obviously, most of them highly depend on the templates of sentence and always generate sentence with syntactical structure. For example, Kulkarni et al. employ Conditional Random Field (CRF) model to predict labeling based on the detected objects, attributes, and prepositions, and then generate sentence with a template by filling in slots with the most likely labeling (Kulkarni et al., 2013). Similar in spirit, Yang et al. utilize Hidden Markov Model (HMM) to select the best objects, scenes, verbs, and prepositions with the highest log-likelihood ratio for template-based sentence generation in (Yang et al., 2011). Furthermore, the traditional simple template is extended to syntactic trees in (Mitchell et al., 2012) which also starts from detecting attributes from image as description anchors and then connecting ordered objects with a syntactically well-formed tree, followed by adding necessary descriptive information.
24
+
25
+ Search-based approaches “generate” sentence for an image by selecting the most semantically similar sentences from sentence pool or directly copying sentences from other visually similar images. This direction indeed can achieve human-level descriptions as all sentences are from existing humangenerated sentences. The need to collect human-generated sentences, however, makes the sentence pool hard to be scaled up. Moreover, the approaches in this dimension cannot generate novel descriptions. For instance, in (Farhadi et al., 2010), an intermediate meaning space based on the triplet of object, action, and scene is proposed to measure the similarity between image and sentence, where the top sentences are regarded as the generated sentences for the target image. Ordonez et al. (Ordonez et al., 2011) search images in a large captioned photo collection by using the combination of object, stuff, people, and scene information and transfer the associated sentences to the query image. Recently, a simple $k$ -nearest neighbor retrieval model is utilized in (Devlin et al., 2015) and the best or consensus caption is selected from the returned candidate captions, which even performs as well as several state-of-the-art language-based models.
26
+
27
+ Different from template-based and search-based models, language-based models aim to learn the probability distribution in the common space of visual content and textual sentence to generate novel sentences with more flexible syntactical structures. In this direction, recent works explore such probability distribution mainly using neural networks for image captioning. For instance, in (Vinyals et al., 2015), Vinyals et al. propose an end-to-end neural networks architecture by utilizing LSTM to generate sentence for an image, which is further incorporated with attention mechanism in (Xu et al., 2015) to automatically focus on salient objects when generating corresponding words. More recently, in (Wu et al., 2016), high-level concepts/attributes are shown to obtain clear improvements on image captioning when injected into existing state-of-the-art RNN-based model and such visual attributes are further utilized as semantic attention in (You et al., 2016) to enhance image captioning.
28
+
29
+ In short, our work in this paper belongs to the language-based models. Different from most of the aforementioned language-based models which mainly focus on sentence generation by solely depending on image representations (Donahue et al., 2015; Kiros et al., 2014; Mao et al., 2014; Vinyals et al., 2015; Xu et al., 2015) or high-level attributes (Wu et al., 2016), our work contributes by studying not only jointly exploiting image representations and attributes for image captioning, but also how the architecture can be better devised by exploring mutual relationship in between. It is also worth noting that (You et al., 2016) also additionally involve attributes for image captioning. Ours is fundamentally different in the way that (You et al., 2016) is as a result of utilizing attributes to model semantic attention to the locally previous words, as opposed to holistically employing attributes as a kind of complementary representations in this work.
30
+
31
+ # 3 BOOSTING IMAGE CAPTIONING WITH ATTRIBUTES
32
+
33
+ In this paper, we devise our CNN plus RNN architectures to generate descriptions for images under the umbrella of additionally incorporating the detected high-level attributes. Specifically, we begin this section by presenting the problem formulation and followed by five variants of our image captioning frameworks with attributes.
34
+
35
+ # 3.1 PROBLEM FORMULATION
36
+
37
+ Suppose we have an image $I$ to be described by a textual sentence $s$ , where $\boldsymbol { S } = \{ w _ { 1 } , w _ { 2 } , . . . , w _ { N _ { s } } \}$ consisting of $N _ { s }$ words. Let $\mathbf { I } \in \mathbb { R } ^ { D _ { v } }$ and $\dot { \mathbf { w } } _ { t } \in \mathbb { R } ^ { D _ { s } }$ denote the $D _ { v }$ -dimensional image representations of the image $I$ and the $D _ { s }$ -dimensional textual features of the $t { \cdot }$ -th word in sentence $s$ , respectively. Furthermore, we have feature vector $\mathbf { A } \in \mathbb { R } ^ { D _ { a } }$ to represent the probability distribution over the high-level attributes for image $I$ . Specifically, we train the attribute detectors by using the weakly-supervised approach of Multiple Instance Learning (MIL) in (Fang et al., 2015) on image captioning benchmarks. For an attribute $w _ { a }$ , one image $I$ is regarded as a positive bag of regions (instances) if $w _ { a }$ exists in image $I$ ’s ground-truth sentences, and negative bag otherwise. By inputting all the bags into a noisy-OR MIL model, the probability of the bag $b _ { I }$ which contains attribute $w _ { a }$ is measured on the probabilities of all the regions in the bag as
38
+
39
+ $$
40
+ \mathrm { P r } _ { I } ^ { w _ { a } } = 1 - \prod _ { r _ { i } \in b _ { I } } ( 1 - p _ { i } ^ { w _ { a } } ) ,
41
+ $$
42
+
43
+ where $p _ { i } ^ { w _ { a } }$ is the probability of the attribute $w _ { a }$ predicted by region $r _ { i }$ and can be calculated through a sigmoid layer after the last convolutional layer in the fully convolutional network. In particular, the dimension of convolutional activations from the last convolutional layer is $x \times x \times h$ and $h$ represents the representation dimension of each region, resulting in $x \times x$ response map which preserves the spatial dependency of the image. Then, a cross entropy loss is calculated based on the probabilities of all the attributes at the top of the whole architecture to optimize MIL model. With the learnt MIL model on image captioning dataset, we treat the final image-level response probabilities of all the attributes as A.
44
+
45
+ Inspired by the recent successes of probabilistic sequence models leveraged in statistical machine translation (Bahdanau et al., 2015; Sutskever et al., 2014), we aim to formulate our image captioning models in an end-to-end fashion based on RNNs which encode the given image and/or its detected attributes into a fixed dimensional vector and then decode it to the target output sentence. Hence, the sentence generation problem we explore here can be formulated by minimizing the following energy loss function as
46
+
47
+ $$
48
+ E ( \mathbf { I } , \mathbf { A } , { \mathcal { S } } ) = - \log \operatorname* { P r } { ( { \mathcal { S } } | \mathbf { I } , \mathbf { A } ) } ,
49
+ $$
50
+
51
+ which is the negative log probability of the correct textual sentence given the image representations and detected attributes.
52
+
53
+ Since the model produces one word in the sentence at each time step, it is natural to apply chain rule to model the joint probability over the sequential words. Thus, the log probability of the sentence is given by the sum of the $\log$ probabilities over the word and can be expressed as
54
+
55
+ $$
56
+ \log \mathrm { P r } \left( \boldsymbol { S } | \mathbf { I } , \mathbf { A } \right) = \sum _ { t = 1 } ^ { N _ { s } } \log \mathrm { P r } \left( \mathbf { w } _ { t } | \mathbf { I } , \mathbf { A } , \mathbf { w } _ { 0 } , \ldots , \mathbf { w } _ { t - 1 } \right) .
57
+ $$
58
+
59
+ By minimizing this loss, the contextual relationship among the words in the sentence can be guaranteed given the image and its detected attributes.
60
+
61
+ ![](images/dc031104b16f9ee568836f3fac6ac9906ea9af1fd3163142c7eef6b54e411b57.jpg)
62
+ Figure 1: Five variants of our LSTM-A framework (better viewed in color).
63
+
64
+ We formulate this task as a variable-length sequence to sequence problem and model the parametric distribution $\operatorname* { P r } \left( \mathbf { w } _ { t } | \mathbf { I } , \mathbf { A } , \mathbf { w } _ { 0 } , \ldots , \mathbf { w } _ { t - 1 } \right)$ in Eq.(3) with Long Short-Term Memory (LSTM), which is a widely used type of RNN. The vector formulas for a LSTM layer forward pass are summarized as below. For time step $t$ , $\mathbf { x } ^ { t }$ and $\mathbf { h } ^ { t }$ are the input and output vector respectively, $\mathbf { T }$ are input weights matrices, $\mathbf { R }$ are recurrent weight matrices and b are bias vectors. Sigmoid $\sigma$ and hyperbolic tangent $\phi$ are element-wise non-linear activation functions. The dot product of two vectors is denoted with $\odot$ . Given inputs $\mathbf { x } ^ { t }$ , $\mathbf { h } ^ { t - 1 }$ and $\mathbf { c } ^ { t - 1 }$ , the LSTM unit updates for time step $t$ are:
65
+
66
+ $$
67
+ \begin{array} { r l } & { \mathbf { g } ^ { t } = \phi ( \mathbf { T } _ { g } \mathbf { x } ^ { t } + \mathbf { R } _ { g } \mathbf { h } ^ { t - 1 } + \mathbf { b } _ { g } ) , \mathbf { i } ^ { t } = \sigma \big ( \mathbf { T } _ { i } \mathbf { x } ^ { t } + \mathbf { R } _ { i } \mathbf { h } ^ { t - 1 } + \mathbf { b } _ { i } \big ) , } \\ & { \mathbf { f } ^ { t } = \sigma \big ( \mathbf { T } _ { f } \mathbf { x } ^ { t } + \mathbf { R } _ { f } \mathbf { h } ^ { t - 1 } + \mathbf { b } _ { f } \big ) , \mathbf { c } ^ { t } = \mathbf { g } ^ { t } \odot \mathbf { i } ^ { t } + \mathbf { c } ^ { t - 1 } \odot \mathbf { f } ^ { t } , } \\ & { \mathbf { o } ^ { t } = \sigma \big ( \mathbf { T } _ { o } \mathbf { x } ^ { t } + \mathbf { R } _ { o } \mathbf { h } ^ { t - 1 } + \mathbf { b } _ { o } \big ) , \mathbf { h } ^ { t } = \phi ( \mathbf { c } ^ { t } ) \odot \mathbf { o } ^ { t } , } \end{array}
68
+ $$
69
+
70
+ where $\mathbf { g } ^ { t } , \mathbf { i } ^ { t } , \mathbf { f } ^ { t } , \mathbf { c } ^ { t } , \mathbf { o } ^ { t }$ , and $\mathbf { h } ^ { t }$ are cell input, input gate, forget gate, cell state, output gate, and cell output of the LSTM, respectively.
71
+
72
+ # 3.2 LONG SHORT-TERM MEMORY WITH ATTRIBUTES
73
+
74
+ Unlike the existing image captioning models in (Donahue et al., 2015; Vinyals et al., 2015) which solely encode image representations for sentence generation, our proposed Long Short-Term Memory with Attributes (LSTM-A) model additionally integrates the detected high-level attributes into LSTM. We devise five variants of LSTM-A for involvement of two design purposes. The first purpose is about where to feed attributes into LSTM and three architectures, i.e., LSTM- $\mathbf { A } _ { 1 }$ (leveraging only attributes), LSTM- $\mathbf { \cdot A } _ { 2 }$ (inserting image representations first) and LSTM- $\mathbf { A } _ { 3 }$ (feeding attributes first), are derived from this view. The second is about when to input attributes or image representations into LSTM and we design LSTM- ${ \bf A } _ { 4 }$ (inputting image representations at each time step) and LSTM- ${ \bf A } _ { 5 }$ (inputting attributes at each time step) for this purpose. An overview of LSTM-A architectures is depicted in Figure 1.
75
+
76
+ # 3.2.1 LSTM- ${ \bf A } _ { 1 }$ (LEVERAGING ONLY ATTRIBUTES)
77
+
78
+ Given the detected attributes, one natural way is to directly inject the attributes as representations at the initial time to inform the LSTM about the high-level attributes. This kind of architecture with only attributes input is named as LSTM- $\mathbf { \delta A } _ { 1 }$ . It is also worth noting that the attributes-based model in (Wu et al., 2016) is similar to LSTM- $\mathbf { A } _ { 1 }$ and can be regarded as one special case of our LSTM-A. Given the attribute representations A and the corresponding sentence $\mathbf { W } \equiv [ \mathbf { w } _ { 0 } , \mathbf { w } _ { 1 } , . . . , \mathbf { w } _ { N _ { s } } ]$ , the LSTM updating procedure in LSTM- $\mathbf { A } _ { 1 }$ is as
79
+
80
+ $$
81
+ \begin{array} { c } { { \mathbf { x } ^ { - 1 } = { \mathbf { T } } _ { a } { \mathbf { A } } , } } \\ { { \mathbf { x } ^ { t } = { \mathbf { T } } _ { s } { \mathbf { w } } _ { t } , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} \mathrm { a n d } \mathbf { h } ^ { t } = f \left( { \mathbf { x } } ^ { t } \right) , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} , } } \end{array}
82
+ $$
83
+
84
+ where $D _ { e }$ is the dimensionality of LSTM input, $\mathbf { T } _ { a } \in \mathbb { R } ^ { D _ { e } \times D _ { a } }$ and $\mathbf { T } _ { s } \in \mathbb { R } ^ { D _ { e } \times D _ { s } }$ is the transformation matrix for attribute representations and textual features of word, respectively, and $f$ is the updating function within LSTM unit. Please note that for the input sentence $\mathbf { W } \equiv \left[ \mathbf { w } _ { 0 } , \ldots , \mathbf { w } _ { N _ { s } } \right]$ , we take $\mathbf { w } _ { 0 }$ as the start sign word to inform the beginning of sentence and ${ \bf w } _ { N _ { s } }$ as the end sign word which indicates the end of sentence. Both of the special sign words are included in our vocabulary. Most specifically, at the initial time step, the attribute representations are transformed as the input to LSTM, and then in the next steps, word embedding $\mathbf { x } ^ { t }$ will be input into the LSTM along with the previous step’s hidden state $\mathbf { h } ^ { t - 1 }$ . In each time step (except the initial step), we use the LSTM cell output $\mathbf { h } ^ { t }$ to predict the next word. Here a softmax layer is applied after the LSTM layer to produce a probability distribution over all the $D _ { s }$ words in the vocabulary as $\operatorname* { P r } _ { t + 1 } \left( w _ { t + 1 } \right) = \frac { \mathrm { e x p } \biggl \{ \mathbf { T } _ { h } ^ { \left( w _ { t + 1 } \right) } \mathbf { h } ^ { t } \biggr \} } { \underset { w \in \mathcal { W } } { \sum } \mathrm { e x p } \biggl \{ \mathbf { T } _ { h } ^ { \left( w \right) } \mathbf { h } ^ { t } \biggr \} }$ , where $\mathcal { W }$ is the word vocabulary space and $\mathbf { T } _ { h } ^ { \left( w \right) }$ is the parameter matrix in softmax layer.
85
+
86
+ # 3.2.2 LSTM- $\mathbf { A } _ { 2 }$ (INSERTING IMAGE REPRESENTATIONS FIRST)
87
+
88
+ To further leverage both image representations and high-level attributes in the encoding stage of our LSTM-A, we design the second architecture LSTM- $\mathbf { A } _ { 2 }$ by treating both of them as atoms in the input sequence to LSTM. Specifically, at the initial step, the image representations I are firstly transformed into LSTM to inform the LSTM about the image content, followed by the attribute representations A which are encoded into LSTM at the next time step to inform the high-level attributes. Then, LSTM decodes each output word based on previous word $\mathbf { x } ^ { t }$ and previous step’s hidden state $\mathbf { h } ^ { t - 1 }$ , which is similar to the decoding stage in LSTM- $\mathbf { \delta A } _ { 1 }$ . The LSTM updating procedure in LSTM- $\mathbf { \cdot A } _ { 2 }$ is designed as
89
+
90
+ $$
91
+ \begin{array} { r } { \begin{array} { c c } { \mathbf { x } ^ { - 2 } = \mathbf { T } _ { v } \mathbf { I } \mathrm { ~ a n d ~ } \mathbf { x } ^ { - 1 } = \mathbf { T } _ { a } \mathbf { A } , } \\ { \mathbf { x } ^ { t } = \mathbf { T } _ { s } \mathbf { w } _ { t } , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} } \end{array} } \end{array}
92
+ $$
93
+
94
+ where $\mathbf { T } _ { v } \in \mathbb { R } ^ { D _ { e } \times D _ { v } }$ is the transformation matrix for image representations.
95
+
96
+ # 3.2.3 LSTM- $\mathbf { A } _ { 3 }$ (FEEDING ATTRIBUTES FIRST)
97
+
98
+ The third design LSTM- $\mathbf { A } _ { 3 }$ is similar to LSTM- $\mathbf { \cdot A } _ { 2 }$ as both designs utilize image representations and high-level attributes to form the input sequence to LSTM in the encoding stage, except that the orders of encoding are different. In LSTM- $\mathbf { \delta A _ { 3 } }$ , the attribute representations are firstly encoded into LSTM and then the image representations are transformed into LSTM at the second time step. The whole LSTM updating procedure in LSTM- $\mathbf { \delta A _ { 3 } }$ is as
99
+
100
+ $$
101
+ \begin{array} { r } { \begin{array} { c c } { \mathbf { x } ^ { - 2 } = \mathbf { T } _ { a } \mathbf { A } } & { \mathrm { a n d } \mathbf { x } ^ { - 1 } = \mathbf { T } _ { v } \mathbf { I } , } \\ { \mathbf { x } ^ { t } = \mathbf { T } _ { s } \mathbf { w } _ { t } , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} } & { \mathrm { a n d } \mathbf { h } ^ { t } = f \left( \mathbf { x } ^ { t } \right) , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} . } \end{array} } \end{array}
102
+ $$
103
+
104
+ # 3.2.4 LSTM- ${ \bf A } _ { 4 }$ (INPUTTING IMAGE REPRESENTATIONS AT EACH TIME STEP)
105
+
106
+ Different from the former three designed architectures which mainly inject high-level attributes and image representations at the encoding stage of LSTM, we next modify the decoding stage in our LSTM-A by additionally incorporating image representations or high-level attributes. More specifically, in LSTM- ${ \bf \cdot A } _ { 4 }$ , the attribute representations are injected once at the initial step to inform the LSTM about the high-level attributes, and then image representations are fed at each time step as an extra input to LSTM to emphasize the image content frequently among memory cells in LSTM. Hence, the LSTM updating procedure in LSTM- ${ \bf A } _ { 4 }$ is:
107
+
108
+ $$
109
+ \begin{array} { c } { { \mathbf { x } } ^ { - 1 } = { \mathbf { T } } _ { a } { \mathbf { A } } , } \\ { { \mathbf { x } } ^ { t } = { \mathbf { T } } _ { s } { \mathbf { w } } _ { t } + { \mathbf { T } } _ { v } { \mathbf { I } } , t \in \lbrace 0 , \ldots , N _ { s } - 1 \rbrace \quad \mathrm { a n d } \quad { \mathbf { h } } ^ { t } = f \left( { \mathbf { x } } ^ { t } \right) , t \in \lbrace 0 , \ldots , N _ { s } - 1 \rbrace . } \end{array}
110
+ $$
111
+
112
+ # 3.2.5 LSTM- $\mathrm { { A } _ { 5 } }$ (INPUTTING ATTRIBUTES AT EACH TIME STEP)
113
+
114
+ The last design LSTM- ${ \bf A } _ { 5 }$ is similar to LSTM- ${ \bf \cdot A } _ { 4 }$ except that it firstly encodes image representations and then feeds attribute representations as an additional input to LSTM at each step in decoding stage to emphasize the high-level attributes frequently. Accordingly, the LSTM updating procedure in LSTM- $\mathrm { { A } _ { 5 } }$ is as
115
+
116
+ $$
117
+ \begin{array} { c } { { \mathbf { x } ^ { - 1 } = { \mathbf { T } } _ { v } { \mathbf { I } } , } } \\ { { \mathbf { x } ^ { t } = { \mathbf { T } } _ { s } { \mathbf { w } } _ { t } + { \mathbf { T } } _ { a } { \mathbf { A } } , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} \mathrm { a n d } \mathbf { h } ^ { t } = f \left( { \mathbf { x } } ^ { t } \right) , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} . } } \end{array}
118
+ $$
119
+
120
+ # 4 EXPERIMENTS
121
+
122
+ We conducted our experiments on COCO captioning dataset (COCO) (Lin et al., 2014) and evaluated our approaches for image captioning.
123
+
124
+ # 4.1 DATASET
125
+
126
+ The dataset, COCO, is the most popular benchmark for image captioning, which contains 82,783 training images and 40,504 validation images. There are 5 human-annotated descriptions per image. As the annotations of the official testing set are not publicly available, we follow the widely used settings in prior works (You et al., 2016; Zhou et al., 2016) and take 82,783 images for training, 5,000 for validation and 5,000 for testing.
127
+
128
+ # 4.2 EXPERIMENTAL SETTINGS
129
+
130
+ Data Preprocessing. Following (Karpathy & Fei-Fei, 2015), we convert all the descriptions in training set to lower case and discard rare words which occur less than 5 times, resulting in the final vocabulary with 8,791 unique words in COCO dataset.
131
+
132
+ Features and Parameter Settings. Each word in the sentence is represented as “one-hot” vector (binary index vector in a vocabulary). For image representations, we take the output of 1,024-way $p o o l 5 / 7 \times 7 . s 1$ layer from GoogleNet (Szegedy et al., 2015) pre-trained on Imagenet ILSVRC12 dataset (Russakovsky et al., 2015). For attribute representations, we select 1,000 most common words on COCO as the high-level attributes and train the attribute detectors with MIL model (Fang et al., 2015) purely on the training data of COCO, resulting in the final 1,000-way vector of probabilities of attributes. The dimension of the input and hidden layers in LSTM are both set to 1,024.
133
+
134
+ Implementation Details. We mainly implement our image captioning models based on Caffe (Jia et al., 2014), which is one of widely adopted deep learning frameworks. Specifically, with an initial learning rate 0.01 and mini-batch size set 1,024, the objective value can decrease to $2 5 \%$ of the initial loss and reach a reasonable result after 50,000 iterations (about 123 epochs).
135
+
136
+ Testing Strategies. For sentence generation in testing stage, there are two common strategies. One is to choose the word with maximum probability at each time step and set it as LSTM input for next time step until the end sign word is emitted or the maximum length of sentence is reached. The other strategy is beam search which selects the top- $k$ best sentences at each time step and considers them as the candidates to generate new top- $k$ best sentences at the next time step. We adopt the second strategy and the beam size $k$ is empirically set to 3.
137
+
138
+ Moreover, to avoid model-level overfitting, we utilize ensembling strategy to fuse the prediction results of 5 identical models as previous works (Vinyals et al., 2015; You et al., 2016). Please note that all the 5 identical models are trained with different initializations separately.
139
+
140
+ Evaluation Metrics. For the evaluation of our proposed models, we adopt five metrics: BLEU $@ N$ (Papineni et al., 2002), METEOR (Banerjee & Lavie, 2005), ROUGE-L (Lin, 2004), CIDEr-D (Vedantam et al., 2015) and SPICE (Anderson et al., 2016). All the metrics are computed by using the codes1 released by COCO Evaluation Server (Chen et al., 2015).
141
+
142
+ # 4.3 COMPARED APPROACHES
143
+
144
+ To verify the merit of our LSTM-A models, we compared the following state-of-the-art methods.
145
+
146
+ (1) NIC & LSTM (Vinyals et al., 2015): NIC attempts to directly translate from image pixels to natural language with a single deep neural network. The image representations are only injected into LSTM at the initial time step. We directly extract the results reported in (You et al., 2016) and name this run as NIC. Furthermore, for fair comparison, we also include one run LSTM which is our implementation of NIC.
147
+
148
+ Table 1: Performance of our proposed models and other state-of-the-art methods on COCO, where $\mathbf { B } @ N$ , M, R, C and S are short for BLEU $@ N$ , METEOR, ROUGE-L, CIDEr-D and SPICE scores. All values are reported as percentage $( \% )$ .
149
+
150
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>B@1</td><td rowspan=1 colspan=1>B@2</td><td rowspan=1 colspan=2>B@3</td><td rowspan=1 colspan=2>B@4</td><td rowspan=1 colspan=2>M</td><td rowspan=1 colspan=1>R</td><td rowspan=1 colspan=1>C</td><td rowspan=1 colspan=1>S</td></tr><tr><td rowspan=4 colspan=1>NIC (Vinyals et al., 2015)LRCN (Donahue et al., 2015)HA (Xu et al., 2015)SA (Xu et al., 2015)ATT (You et al., 2016)SC (Zhou et al., 2016)</td><td rowspan=3 colspan=1>66.669.771.8</td><td rowspan=1 colspan=1>45.1</td><td rowspan=1 colspan=2>30.4</td><td rowspan=1 colspan=2>20.3</td><td rowspan=1 colspan=2>122.9</td><td rowspan=3 colspan=1>150.8-</td><td rowspan=4 colspan=1>183.7--195.9</td><td rowspan=4 colspan=1>-15.8-11-</td></tr><tr><td rowspan=2 colspan=1>51.950.4</td><td rowspan=1 colspan=2>38.0</td><td rowspan=2 colspan=2>27.825</td><td rowspan=1 colspan=2>22.9</td></tr><tr><td rowspan=1 colspan=2>35.7</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>23</td></tr><tr><td rowspan=1 colspan=1>70.770.972</td><td rowspan=1 colspan=1>49.253.754.6</td><td rowspan=1 colspan=2>34.440.240.4</td><td rowspan=1 colspan=2>24.330.429.8</td><td rowspan=1 colspan=2>23.924.324.5</td><td rowspan=1 colspan=1>---</td></tr><tr><td rowspan=6 colspan=1>LSTM (Vinyals et al., 2015)LSTM-A1LSTM-A2LSTM-A3LSTM-A4LSTM-A5</td><td rowspan=2 colspan=1>68.472.3</td><td rowspan=1 colspan=1>51.2</td><td rowspan=1 colspan=2>38</td><td rowspan=1 colspan=2>28.4</td><td rowspan=1 colspan=2>23.1</td><td rowspan=1 colspan=1>50.7</td><td rowspan=1 colspan=1>84.3</td><td rowspan=1 colspan=1>16</td></tr><tr><td rowspan=2 colspan=1>55.856.4</td><td rowspan=3 colspan=2>4242.742.6</td><td rowspan=3 colspan=2>31.732.232.1</td><td rowspan=1 colspan=2>24.9</td><td rowspan=3 colspan=1>53.353.553.7</td><td rowspan=3 colspan=1>9697.598.4</td><td rowspan=3 colspan=1>17.81818.2</td></tr><tr><td rowspan=1 colspan=1>72.8</td><td rowspan=1 colspan=2>25</td></tr><tr><td rowspan=1 colspan=1>73.1</td><td rowspan=1 colspan=1>56.4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>25.2</td></tr><tr><td rowspan=2 colspan=1>71.173</td><td rowspan=2 colspan=1>54.556.5</td><td rowspan=2 colspan=2>40.942.9</td><td rowspan=1 colspan=1>40.9</td><td rowspan=1 colspan=2>30.6</td><td rowspan=1 colspan=2>24</td><td rowspan=1 colspan=1>52.5</td><td rowspan=1 colspan=1>90.6</td><td rowspan=1 colspan=1>16.8</td></tr><tr><td rowspan=1 colspan=2>32.5</td><td rowspan=1 colspan=2>25.1</td><td rowspan=1 colspan=1>53.8</td><td rowspan=1 colspan=1>98.6</td><td rowspan=1 colspan=1>18.2</td></tr><tr><td rowspan=1 colspan=1>LSTM-A*</td><td rowspan=1 colspan=1>95.7</td><td rowspan=1 colspan=1>82.5</td><td rowspan=1 colspan=2>68.5</td><td rowspan=1 colspan=2>55.9</td><td rowspan=1 colspan=2>34.1</td><td rowspan=1 colspan=1>67.3</td><td rowspan=1 colspan=1>150.5</td><td rowspan=1 colspan=1>26.8</td></tr></table>
151
+
152
+ (2) LRCN (Donahue et al., 2015): LRCN inputs both image representations and previous word into LSTM at each time step for sentence generation.
153
+
154
+ (3) Hard-Attention (HA) & Soft-Attention (SA) (Xu et al., 2015): Spatial attention on convolutional features of an image is incorporated into the encoder-decoder framework through two kinds of mechanisms: 1) “hard” stochastic attention mechanism equivalently by reinforce learning and 2) “soft” deterministic attention mechanism with standard back-propagation.
155
+
156
+ (4) ATT (You et al., 2016): ATT utilizes attributes as semantic attention to combine image representations and attributes in RNN for image captioning.
157
+
158
+ (5) Sentence-Condition (SC) (Zhou et al., 2016): Sentence-condition is proposed most recently and exploits text-conditional semantic attention to generate semantic guidance for sentence generation by conditioning image features on current text content.
159
+
160
+ (6) MSR Captivator (Devlin et al., 2015): MSR Captivator employs both Multimodal Recurrent Neural Network (MRNN) and Maximum Entropy Language Model (MELM) (Fang et al., 2015) for sentence generation. Deep Multimodal Similarity Model (DMSM) (Fang et al., 2015) is further exploited for sentence re-ranking.
161
+
162
+ (7) CaptionBot (Tran et al., 2016): CaptionBot is a publicly image captioning system2 which is mainly built on vision models by using Deep residual networks (ResNets) (He et al., 2016) to detect visual concepts, MELM (Fang et al., 2015) language model for sentence generation and DMSM (Fang et al., 2015) for caption ranking. Entity recognition model for celebrities and landmarks is further incorporated to enrich captions and the confidence scoring model is finally utilized to select the output caption.
163
+
164
+ (8) LSTM-A: LSTM- $\mathbf { \delta A } _ { 1 }$ , LSTM- $\mathbf { A } _ { 2 }$ , LSTM- ${ \bf \delta A } _ { 3 }$ , LSTM- ${ \bf A } _ { 4 }$ , and LSTM- $\mathbf { A } _ { 5 }$ are five variants derived from our proposed LSTM-A framework. In addition, LSTM- $\mathbf { A } ^ { * }$ is an oracle run that inputs groundtruth attributes in the LSTM- $\mathbf { A } _ { 3 }$ architecture.
165
+
166
+ # 4.4 PERFORMANCE COMPARISON
167
+
168
+ Performance on COCO Table 1 shows the performances of different models on COCO image captioning dataset. It is worth noting that the performances of different approaches here are based on different image representations. Specifically, VGG architecture (Simonyan & Zisserman, 2015) is utilized as image feature extractor in the methods of Hard-Attention & Soft-Attention and SentenceCondition, while GoogleNet (Szegedy et al., 2015) is exploited in NIC, LRCN, ATT, LSTM and our LSTM-A. In view that the GoogleNet and VGG features are comparable, we compare directly with results. Overall, the results across eight evaluation metrics consistently indicate that our proposed LSTM-A exhibits better performance than all the state-of-the-art techniques including non-attention models (NIC, LSTM, LRCN) and attention-based methods (Hard-Attention, Soft-Attention, ATT, Sentence-Condition). In particular, the CIDEr-D can achieve $9 8 . 6 \%$ , which is to date the highest performance reported on COCO dataset when extracting image representations by GoogleNet. LSTM- $\mathbf { \delta A } _ { 1 }$ inputting only high-level attributes as representations makes the relative improvement over LSTM which feeds into image representations instead by $1 1 . 6 \%$ , $7 . 8 \%$ , $5 . 1 \%$ , $1 3 . 9 \%$ and $1 1 . 2 5 \%$ in BLEU $\textcircled { a } 4$ , METEOR, ROUGR-L, CIDEr-D and SPICE, respectively. The results basically indicate the advantage of exploiting high-level attributes than image representations for image captioning. Furthermore, by additionally incorporating attributes to LSTM model, LSTM- $\mathbf { A } _ { 2 }$ , $\mathrm { L S T M \mathrm { - } A _ { 3 } }$ and LSTM- $\mathrm { { A } _ { 5 } }$ lead to a performance boost, indicating that image representations and attributes are complementary and thus have mutual reinforcement for image captioning. Similar in spirit, LSTM- ${ \bf \cdot A } _ { 4 }$ improves LRCN by further taking attributes into account. There is a significant performance gap between ATT and LSTM- ${ \bf A } _ { 5 }$ . Though both runs involve the utilization of image representations and attributes, they are fundamentally different in the way that the performance of ATT is as a result of modulating the strength of attention on attributes to the previous words, and LSTM- ${ \bf \cdot A } _ { 5 }$ is by employing attributes as auxiliary knowledge to complement image representations. This somewhat reveals the weakness of semantic attention model, where the prediction errors will accumulate along the generated sequence.
169
+
170
+ Table 2: Leaderboard of the published state-of-the-art image captioning models on the online COCO testing server (http://mscoco.org/dataset/#captions-leaderboard), where $\mathbf { B } @ N$ , M, R, and C are short for BLEU $@ N$ , METEOR, ROUGE-L, and CIDEr-D scores. All values are reported as percentage $( \% )$ .
171
+
172
+ <table><tr><td rowspan=2 colspan=1>Model</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>@1</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>@2</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>@3</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>@4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>M</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>R</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>C</td></tr><tr><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td></tr><tr><td rowspan=1 colspan=1>MSM@MSRA(LSTM-A3)</td><td rowspan=1 colspan=1>75.1</td><td rowspan=1 colspan=1>92.6</td><td rowspan=1 colspan=1>58.8</td><td rowspan=1 colspan=1>85.1</td><td rowspan=1 colspan=1>44.9</td><td rowspan=1 colspan=1>75.1</td><td rowspan=1 colspan=1>34.3</td><td rowspan=1 colspan=1>64.6</td><td rowspan=1 colspan=1>26.6</td><td rowspan=1 colspan=1>36.1</td><td rowspan=1 colspan=1>55.2</td><td rowspan=1 colspan=1>70.9</td><td rowspan=1 colspan=1>104.9</td><td rowspan=1 colspan=1>105.3</td></tr><tr><td rowspan=1 colspan=1>ATT (You et al., 2016)</td><td rowspan=1 colspan=1>73.1</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>56.5</td><td rowspan=1 colspan=1>81.5</td><td rowspan=1 colspan=1>42.4</td><td rowspan=1 colspan=1>70.9</td><td rowspan=1 colspan=1>31.6</td><td rowspan=1 colspan=1>59.9</td><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>33.5</td><td rowspan=1 colspan=1>53.5</td><td rowspan=1 colspan=1>68.2</td><td rowspan=1 colspan=1>94.3</td><td rowspan=1 colspan=1>95.8</td></tr><tr><td rowspan=1 colspan=1>Google(Vinyals et al.,2015)</td><td rowspan=1 colspan=1>71.3</td><td rowspan=1 colspan=1>89.5</td><td rowspan=1 colspan=1>54.2</td><td rowspan=1 colspan=1>80.2</td><td rowspan=1 colspan=1>40.7</td><td rowspan=1 colspan=1>69.4</td><td rowspan=1 colspan=1>30.9</td><td rowspan=1 colspan=1>58.7</td><td rowspan=1 colspan=1>25.4</td><td rowspan=1 colspan=1>34.6</td><td rowspan=1 colspan=1>53</td><td rowspan=1 colspan=1>68.2</td><td rowspan=1 colspan=1>94.3</td><td rowspan=1 colspan=1>94.6</td></tr></table>
173
+
174
+ Table 3: The user study using two criteria: M1 - percentage of captions generated by different methods that are evaluated as better or equal to human caption and M2 - percentage of captions that pass the Turing Test.
175
+
176
+ <table><tr><td></td><td>Human</td><td>LSTM-A3</td><td>CaptionBot</td><td>LSTM</td><td>LRCN</td></tr><tr><td>M1</td><td>=</td><td>62.8</td><td>58.2</td><td>49.2</td><td>43.9</td></tr><tr><td>M2</td><td>90.1</td><td>72.2</td><td>66.3</td><td>57.3</td><td>55.9</td></tr></table>
177
+
178
+ Compared to LSTM- $\mathbf { \delta A } _ { 1 }$ , LSTM- $\mathbf { \cdot A } _ { 2 }$ which is augmented by integrating image representations performs better, but the performances are lower than LSTM- $\mathbf { \cdot A _ { 3 } }$ . The results indicate that LSTM- $\mathbf { A } _ { 3 }$ , in comparison, benefits from the mechanism of first feeding high-level attributes into LSTM instead of starting from inserting image representations in LSTM- $\mathbf { \cdot A } _ { 2 }$ . The chance that a good start point can be attained and lead to performance gain is better. LSTM- ${ \bf \cdot A } _ { 4 }$ feeding the image representations at each time step yields inferior performances to LSTM- $\mathbf { \cdot A _ { 3 } }$ , which only inputs image representations once. We speculate that this may because the noise in the image can be explicitly accumulated and thus the network overfits more easily. In contrast, the performances of LSTM- ${ \bf A } _ { 5 }$ which feeds attributes at each time step show the improvements on LSTM- $\mathbf { A } _ { 3 }$ . The results demonstrate that the high-level attributes are more accurate and easily translated into human understandable sentence. Among the five proposed LSTM-A architectures, LSTM- ${ \bf \cdot A } _ { 3 }$ achieves the best performances in terms of BLEU $@ 1$ and METEOR, while LSTM- $\mathbf { \cdot A } _ { 5 }$ performs the best in other six evaluation metrics. The performances of the oracle run LSTM- $\mathbf { A } ^ { * }$ could be regarded as the upper bound of employing attributes in our framework and lead to large performance gain against LSTM- $\mathbf { A } _ { 3 }$ . Such an upper bound enables us to obtain more insights on the factor accounting for the success of the current attribute augmented architecture and also provides guidance to future research in this direction. More specifically, the results, on one hand, indicate the advantage and great potential of leveraging attributes for boosting image captioning, and on the other, suggest that more efforts are further required towards mining and representing attributes more effectively.
179
+
180
+ Performance on COCO online testing server We also submitted our best run in terms of METEOR, i.e., LSTM- $\mathbf { A } _ { 3 }$ , to online COCO testing server and evaluated the performance on official testing set. Table 2 shows the performance Leaderboard on official testing image set with 5 reference captions (c5) and 40 reference captions (c40). Please note that here we utilize the outputs of 2,048-way pool5 layer from ResNet-152 as image representations and train the attribute detectors by ResNet-152 in our final submission. Only the latest top-3 performing methods which have been officially published are included in the table. Compared to the top performing methods, our proposed LSTM- ${ \bf \delta A } _ { 3 }$ achieves the best performance across all the evaluation metrics on both c5 and $\mathrm { c 4 0 }$ testing sets, and ranks the first on the Leaderboard.
181
+
182
+ ![](images/10029c54c6ff7d8c68b247dcfb30b19a55d32d6d6ac960d93654edeb851f616f.jpg)
183
+
184
+ ![](images/3142d03039b9add3e9f5494f4a0ff24f3534f8651562db66f2ca32405660417c.jpg)
185
+ Figure 2: Visualization of prediction changes w.r.t. the additional attribute inputs. The attributes are predicted by MIL method in (Fang et al., 2015) and the output sentences are generated by LSTM and LSTM- $\mathbf { A } _ { 3 }$ .
186
+ Figure 3: Sentence examples generated by our five LSTM-A architectures and one ground truth sentence.
187
+
188
+ # 4.5 HUMAN EVALUATION
189
+
190
+ To better understand how satisfactory are the sentences generated from different methods, we also conducted a human study to compare our LSTM- $\mathbf { \delta A _ { 3 } }$ against three approaches, i.e., CaptionBot, LRCN and LSTM. A total number of 12 evaluators (6 females and 6 males) from different education backgrounds, including computer science (4), business (2), linguistics (2) and engineering (4), are invited and a subset of 1,000 images is randomly selected from testing set for the subjective evaluation. The evaluation process is as follows. All the evaluators are organized into two groups. We show the first group all the four sentences generated by each approach plus the five human-annotated sentences and ask them the question: Do the systems produce captions resembling human-generated sentences? In contrast, we show the second group once only one sentence generated by different approach or human annotation and they are asked: Can you determine whether the given sentence has been generated by a system or by a human being? From evaluators’ responses, we calculate two metrics: 1) M1: percentage of captions that are evaluated as better or equal to human caption; 2) M2: percentage of captions that pass the Turing Test. Table 3 lists the result of the user study. Overall, our LSTM- $\mathbf { \cdot A _ { 3 } }$ is clearly the winner for all two criteria. In particular, the percentage achieves $6 2 . 8 \%$ and $7 2 . 2 \%$ in terms of M1 and M2, respectively, making the absolute improvement over the best competitor CaptionBot by $4 . 6 \%$ and $5 . 9 \%$ .
191
+
192
+ # 4.6 QUALITATIVE ANALYSIS
193
+
194
+ Visualization of prediction changes w.r.t. the additional attribute inputs. Figure 2 shows two image examples to illustrate the word prediction changes with respect to the additional attribute inputs. Take the first image as an example, the predicted subject is “a cake” in LSTM model. By additionally incorporating the detected attributes, e.g., “candles” and “birthday,” the output subject in the sentence by our LSTM- ${ \bf \delta A } _ { 3 }$ changes into “a birthday cake with candles,” demonstrating the advantage of the auxiliary attribute inputs.
195
+
196
+ ![](images/722ca6e0a12a39d4fecefda41bd7eb8ff05e5adc3f5eb43cdcd23090a7eee1ac.jpg)
197
+ Figure 4: Attributes and sentences generation results on COCO. The attributes are predicted by MIL method in (Fang et al., 2015) and the output sentences are generated by 1) LSTM, 2) CaptionBot2, 3) our LSTM-A3, and 4) Ground Truth: randomly selected three ground truth sentences.
198
+
199
+ Sentence generation comparison between five LSTM-A architectures. The examples of sentence generated by our five LSTM-A architectures are further illustrated in Figure 3. In general, the sentences generated by LSTM- $\mathbf { A } _ { 3 }$ and LSTM- ${ \bf \cdot A } _ { 5 }$ are very comparable and more accurate than those by LSTM- $\mathbf { A } _ { 1 }$ , LSTM- $\mathbf { A } _ { 2 }$ and LSTM- ${ \bf \cdot A } _ { 4 }$ . For instance, LSTM- $\mathbf { \cdot A _ { 3 } }$ and LSTM- ${ \bf A } _ { 5 }$ produce the sentence of “a bunch of stuffed animals hanging from a ceiling,” which describes the first image very precisely and finely.
200
+
201
+ Sentence generation comparison across different approaches. Figure 4 showcases a few sentence examples generated by different methods, the detected high-level attributes, and humanannotated ground truth sentences. From these exemplar results, it is easy to see that all of these automatic methods can generate somewhat relevant sentences, while our proposed LSTM- $\mathbf { \cdot A _ { 3 } }$ can predict more relevant keywords by jointly exploiting high-level attributes and image representations for image captioning. For example, compared to subject term “a group of people” and “a man” in the sentence generated by LSTM and CaptionBot respectively, “a man and a dog” in our LSTM- $\mathbf { A } _ { 3 }$ is more precise to describe the image content in the first image, since the keyword “dog” is one of the detected attributes and directly injected into LSTM to guide the sentence generation. Similarly, verb term “holding” which is also detected as one high-level attribute presents the fourth image more exactly. Moreover, our LSTM- ${ \bf \delta A } _ { 3 }$ can generate more descriptive sentence by enriching the semantics with high-level attributes. For instance, with the detected adjective “red,” the generated sentence “a red and white plane flying over a body of water” of the fifth image depicts the image content more comprehensive.
202
+
203
+ # 4.7 ANALYSIS OF THE BEAM SIZE $k$
204
+
205
+ In order to analyze the effect of the beam size $k$ in testing stage, we illustrate the performances of our two top performing architectures LSTM- $\mathbf { A } _ { 3 }$ and LSTM- $\mathbf { A } _ { 5 }$ with the beam size in the range of $\{ 1 , 2 , 3 , 4 , 5 \}$ in Figure 5. To make all performances fall into a comparable scale, all scores are normalized by the highest score of each evaluation metric. As shown in Figure 5, we can see that almost all performances in terms of each evaluation metric are like the “ $\wedge$ ” shapes when beam size $k$ varies from 1 to 5. Hence, we set the beam size $k$ as 3 in our experiments, which can achieve the best performance with a relatively small beam size.
206
+
207
+ ![](images/7efd57d7ac5e5fe05250042fdd0a2a212cdf1f602ff2981f2dc5ff17315d56f3.jpg)
208
+ Figure 5: The effect of beam size $k$ on (a) LSTM- $\mathbf { A } _ { 3 }$ and (b) LSTM- $\mathbf { \cdot A } _ { 5 }$ .
209
+
210
+ # 5 DISCUSSIONS AND CONCLUSIONS
211
+
212
+ We have presented Long Short-Term Memory with Attributes (LSTM-A) architectures which explores both image representations and high-level attributes for image captioning. Particularly, we study the problem of augmenting high-level attributes from images to complement image representations for enhancing sentence generation. To verify our claim, we have devised variants of architectures by modifying the placement and moment, where and when to feed into the two kinds of representations. Experiments conducted on COCO image captioning dataset validate our proposal and analysis. Performance improvements are clearly observed when comparing to other captioning techniques and more remarkably, the performance of our LSTM-A to date ranks the first on COCO image captioning Leaderboard.
213
+
214
+ Our future works are as follows. First, more attributes will be learnt from large-scale image benchmarks, e.g., YFCC-100M dataset, and integrated into image captioning. We will further analyze the impact of different number of attributes involved. Second, how to generate free-form and openvocabulary sentences with the learnt attributes is also expected.
215
+
216
+ # REFERENCES
217
+
218
+ Peter Anderson, Basura Fernando, Mark Johnson, and Stephen Gould. Spice: Semantic propositional image caption evaluation. In ECCV, 2016.
219
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
220
+ Satanjeev Banerjee and Alon Lavie. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In Proceedings of the ACL workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, 2005.
221
+ Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollar, and C Lawrence ´ Zitnick. Microsoft COCO captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015.
222
+ Jacob Devlin, Hao Cheng, Hao Fang, Saurabh Gupta, Li Deng, Xiaodong He, Geoffrey Zweig, and Margaret Mitchell. Language models for image captioning: The quirks and what works. In ACL, 2015.
223
+ Jeffrey Donahue, Lisa Anne Hendricks, Sergio Guadarrama, Marcus Rohrbach, Subhashini Venugopalan, Kate Saenko, and Trevor Darrell. Long-term recurrent convolutional networks for visual recognition and description. In CVPR, 2015.
224
+ Hao Fang, Saurabh Gupta, Forrest Iandola, Rupesh K Srivastava, Li Deng, Piotr Dollar, Jianfeng Gao, Xi- ´ aodong He, Margaret Mitchell, John C Platt, C. Lawrence Zitnick, and Geoffrey Zweig. From captions to visual concepts and back. In CVPR, 2015.
225
+ Ali Farhadi, Mohsen Hejrati, Mohammad Amin Sadeghi, Peter Young, Cyrus Rashtchian, Julia Hockenmaier, and David Forsyth. Every picture tells a story: Generating sentences from images. In ECCV, 2010.
226
+
227
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
228
+
229
+ Yangqing Jia, Evan Shelhamer, Jeff Donahue, Sergey Karayev, Jonathan Long, Ross Girshick, Sergio Guadarrama, and Trevor Darrell. Caffe: Convolutional architecture for fast feature embedding. In MM, 2014.
230
+
231
+ Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In CVPR, 2015.
232
+
233
+ Ryan Kiros, Ruslan Salakhutdinov, and Rich Zemel. Multimodal neural language models. In ICML, 2014.
234
+
235
+ Girish Kulkarni, Visruth Premraj, Vicente Ordonez, Sagnik Dhar, Siming Li, Yejin Choi, Alexander C Berg, and Tamara L Berg. Babytalk: Understanding and generating simple image descriptions. IEEE Trans. on PAMI, 2013.
236
+
237
+ Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In ACL Workshop, 2004.
238
+
239
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and ´ C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014.
240
+
241
+ Junhua Mao, Wei Xu, Yi Yang, Jiang Wang, and Alan L. Yuille. Explain images with multimodal recurrent neural networks. In NIPS Workshop on Deep Learning, 2014.
242
+
243
+ Margaret Mitchell, Xufeng Han, Jesse Dodge, Alyssa Mensch, Amit Goyal, Alex Berg, Kota Yamaguchi, Tamara Berg, Karl Stratos, and Hal Daume III. Midge: Generating image descriptions from computer vision ´ detections. In EACL, 2012.
244
+
245
+ Vicente Ordonez, Girish Kulkarni, and Tamara L Berg. Im2text: Describing images using 1 million captioned photographs. In NIPS, 2011.
246
+
247
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In ACL, 2002.
248
+
249
+ Devi Parikh and Kristen Grauman. Relative attributes. In ICCV, 2011.
250
+
251
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. IJCV, 2015.
252
+
253
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
254
+
255
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
256
+
257
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015.
258
+
259
+ Kenneth Tran, Xiaodong He, Lei Zhang, Jian Sun, Cornelia Carapcea, Chris Thrasher, Chris Buehler, and Chris Sienkiewicz. Rich image captioning in the wild. arXiv preprint arXiv:1603.09016, 2016.
260
+
261
+ Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In CVPR, 2015.
262
+
263
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In CVPR, 2015.
264
+
265
+ Qi Wu, Chunhua Shen, Lingqiao Liu, Anthony Dick, and Anton van den Hengel. What value do explicit high level concepts have in vision to language problems? In CVPR, 2016.
266
+
267
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, 2015.
268
+
269
+ Yezhou Yang, Ching Lik Teo, Hal Daume III, and Yiannis Aloimonos. Corpus-guided sentence generation of ´ natural images. In EMNLP, 2011.
270
+
271
+ Quanzeng You, Hailin Jin, Zhaowen Wang, Chen Fang, and Jiebo Luo. Image captioning with semantic attention. In CVPR, 2016.
272
+
273
+ Luowei Zhou, Chenliang Xu, Parker Koch, and Jason J Corso. Image caption generation with text-conditional semantic attention. arXiv preprint arXiv:1606.04621, 2016.
parse/train/BkdpaH9ll/BkdpaH9ll_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/BkdpaH9ll/BkdpaH9ll_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/BkgMbCVFvr/BkgMbCVFvr.md ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PRETRAINING BOOSTS OUT-OF-DOMAIN ROBUSTNESS FOR POSE ESTIMATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Deep neural networks are highly effective tools for human and animal pose estimation. However, robustness to out-of-domain data remains a challenge. Here, we probe the transfer and generalization ability for pose estimation with two architecture classes (MobileNetV2s and ResNets) pretrained on ImageNet. We generated a novel dataset of 30 horses that allowed for both within-domain and outof-domain (unseen horse) testing. We find that pretraining on ImageNet strongly improves out-of-domain performance. Moreover, we show that for both pretrained and networks trained from scratch, better ImageNet-performing architectures perform better for pose estimation, with a substantial improvement on out-of-domain data when pretrained. Collectively, our results demonstrate that transfer learning is particularly beneficial for out-of-domain robustness.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Pose estimation is an important tool for understanding behavior, as it belies analysis of movement kinematics, action recognition, and ethology (Mason & Lott, 1976; Heinroth & Heinroth, 1966; Ijspeert, 2014; Anderson & Perona, 2014). Pose estimation on humans has reached remarkable capabilities due to innovations in both algorithms (Insafutdinov et al., 2017; Cao et al., 2017; He et al., 2017; Alp Guler et al., 2018; Xiao et al., 2018; Kreiss et al., 2019; Sun et al., 2019) and large- ¨ scale datasets (Lin et al., 2014; Andriluka et al., 2014; 2018). However, it is a challenging problem due to small joints, occlusions, clothing, and changes in background and scene statistics. Thus, many networks suffer when applied to out-of-domain data, i.e. images that are sufficiently different from the training set. For instance, they fail on very articulated human movements like skiing, or other ‘rare poses’, if not in the training set (Rhodin et al., 2018; Dang et al., 2019). Moreover, animal pose estimation has additional challenges. Not all animals share the same keypoints, therefore a universal “animal pose detector” is not feasible. Even building animal-specific networks would require a lot of data, due to the large variability in body shapes, colors, and the number of species as well as breeds of a type of animal. Therefore, the question of how one can robustly learn from limited annotated datasets is of particular importance, and animal pose estimation datasets allow for generalization to be systematically tested (Novotny et al., 2017).
12
+
13
+ How can robustness be achieved? Transfer learning, or the transferability of pretrained features from one task to another, is a powerful approach that has been well studied in computer vision (Donahue et al., 2014; Yosinski et al., 2014; Kummerer et al., 2016; Huh et al., 2016; He et al., 2018). It ¨ has been shown to improve performance on some human pose estimation tasks (Mehta et al., 2016; Mueller et al., 2017; Xiao et al., 2018; Insafutdinov et al., 2017), yet is not universally used in the top-performing networks on the human 2D/3D pose estimation benchmarks (Doersch & Zisserman, 2019). For keypoint detection, He et al. recently showed that pretraining on ImageNet did not result in overall performance improvements if randomly initialized models were allowed to train for much longer than usual, therefore suggesting that (given enough task-data) the main benefit of transfer learning is shorter training time, rather than performance (He et al., 2018). However, it has not been tested whether pretraining on ImageNet offers advantages in robustness, for instance as measured by any performance advantage on out-of-domain data.
14
+
15
+ We address this by building a new pose estimation task of 8, 114 labeled video frames from 30 Thoroughbred horses. We focus on horses as their diversity readily allows us to assess out-of-domain generalization, i.e. the ability to generalize to the different, unseen horses in different contexts. We created a task, called Horse-10, that uses only 10 horses for the test/train splits, and uses the other 20 horses to test out-of-domain performance (Figure 1). The data will be made available at TBA.
16
+
17
+ ![](images/731b3da0ff1d973cbbd2dd09e04b1a4db5c69e291dc8e2f188eb729b8f3a4d9e.jpg)
18
+ Figure 1: Horse Dataset: Example frames for each young Thoroughbred horse in the dataset. In each video the horse walks from left to right. The videos vary in horse color, the appearance of sunlight and shadow, and relative horse size as well as background. This makes the data set ideal for tests in robustness and generalization. To illustrate the horse-10 task we arranged the horses according to one split: the ten leftmost horses were used for train/test within-domain, and the rest are the out-of-domain held out horses.
19
+
20
+ Here we report two key insights: (1) higher ImageNet performance leads to better generalization for both within domain and on out-of-domain data for pose estimation but with a stronger effect on out-of-domain data (see Figure 2B); (2) transfer learning improves robustness again most strongly for out-of-domain data, and yields up to 3 times more accurate results than training from scratch (see Figure 4D,E). Thus, while it has been previously shown that training from scratch can match performance on in-domain data for sufficiently large amount of training data and training times (He et al., 2018), we show it clearly cannot match performance of pretrained networks on out-of-domain data (see Figure 5). Collectively, this sheds a new light on the inductive biases of “better ImageNet architectures” for visual tasks to be particularly beneficial for robustness, even beyond within domain data accuracy, on out-of-domain datasets.
21
+
22
+ # 2 RESULTS
23
+
24
+ To test within and out-of-domain performance we created a new dataset of 30 different walking horses (Thoroughbreds that are led by different humans), resulting in a dataset of 8, 114 images with 22 labeled body parts each. Horses have various coat colors and the “in-the-wild” aspect of the collected data at various Thoroughbred yearling sales and farms added additional complexity. The sunlight variation between each video added to the complexity of the learning challenge, as well as the handlers often wearing horse-leg-colored clothing. Some horses were in direct sunlight while others had the light behind them, and others were walking into and out of shadows, which was particularly problematic with a dataset dominated by dark colored coats (Figure 1). Thus, this dataset is ideal for testing robustness and out-of-sample generalization.
25
+
26
+ # .1 IMAGENET ACCURACY PREDICTS ANIMAL POSE ESTIMATION ACCURAC
27
+
28
+ To probe the role of different ImageNet pretrained architectures, we compared four variants of MobileNetV2 with varying expansion ratios, as the width multiplier parameterizes ImageNet performance over a wide range (see Methods), and two variants of ResNets (50 and 101 layers deep). We utilized a ‘simple’ yet competitive pose estimation architecture (Insafutdinov et al., 2016; Mathis et al., 2018) embedded in DeepLabCut, a toolbox for data-set generation, training, and evaluation (see Methods). The architectures then consisted of either MobileNetV2s (Sandler et al., 2018) or ResNets (He et al., 2016), where a single deconvolution layer is connected to the final convolutional layer to predict poses via body-part specific scoremaps as well as location refinement maps (Insafutdinov et al., 2016; Mathis et al., 2018). We created 3 splits containing 10 random horses each, and then varied the amount of training data from these 10 horses (referred to as Horse-10, see Methods). As the horses could vary dramatically in size across frames, due to the “in-the-wild” variation in distance from the camera, we used a normalized pixel error; i.e. we normalized the raw pixel errors by the eye-to-nose distance and report the fraction within this distance (Figure 2A). In total, we found that all pretrained-ImageNet networks showed great performance on Horse-10 within domain (Figures 2B, 7).
29
+
30
+ ![](images/37dbe0a7484a17b0998b14c94a78330aff9713a534eb2eb2a061d91f3f65a14c.jpg)
31
+ Figure 2: Transfer Learning boosts performance, especially on out-of-domain data. A: Illustration of the normalized error metric. B: Normalized Error vs. Network performance as ranked by the Top $1 \%$ accuracy on ImageNet (order by increasing ImageNet performance: MobileNetV2- 0.35, MobileNetV2-0.5, MobileNetV2-0.75, MobileNetV2-1, ResNet-50, ResNet-101). The pose estimation performance is for $5 0 \%$ training set fraction. The faint lines indicate data for the three splits. LEFT: Test data is in red, train is blue. RIGHT: additionally, pink is out-of-domain data; dashed lines indicate networks trained from scratch. Better ImageNet networks perform better on Horse-10; this relationship is even stronger for out-of-domain data. C: Example frames with human annotated body parts vs. predicted body parts for MobileNetV2-0.35 and ResNet-50 architectures with ImageNet pretraining on out-of-domain horses. D: Normalized Error vs. Training Set Fraction of Horse-10. For reference, $5 \%$ training data is $\approx 1 6 0$ frames. Darker to light red shades are test results for pretrained networks on within-domain data. Shades of pink show the test on out-ofdomain data (order according to ImageNet performance: ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35). E: Same as C but for training from scratch. F: Same as D but for training from scratch. All lines are averages of 3 splits (see Methods).
32
+
33
+ ![](images/cdee02af92618fdfa301fa2dc6b55c19164b90da666c1f9fcdb8d8ed46d53cc3.jpg)
34
+ Figure 3: Fraction of correctly identified bodyparts improves with transfer learning A: Percent Correct Keypoint (PCK) vs. Training Set Fraction shows high performance for all pretrained networks on Horse-10. B: Same as A, but training from scratch. The performance drops strongly, especially for out-of-domain data C: Performance gain when using transfer learning. All lines are averages of 3 splits, individual splits are shown as faint lines.
35
+
36
+ To further assess the errors we computed the percent correct keypoints (PCK; defined as within $3 0 \%$ of the distance from nose-to-eye, see Methods) and found that performance was nearly $9 7 \%$ for ResNets (with at least $2 0 \%$ training data) and only fell to $\approx 9 3 \%$ on MobileNetV2-based models (Figure 8A). Even with very small datasets $( 5 \%$ , i.e. around 160 training images) performance was $8 0 \%$ to $8 5 \%$ on MobileNetV2 and ResNets, respectively (Figure 8A).
37
+
38
+ Next, we directly compare the ImageNet performance to their respective performance on this pose estimation task. We find Top- $. 1 \%$ accuracy on ImageNet, correlates with pose estimation error (linear fit: slope $- 0 . 3 3 \%$ , $R ^ { 2 } = 0 . 9 5$ , $p = 0 . 0 0 1$ ; Figures 2B). This linear relationship is consistent with a recently reported correlation of ImageNet accuracy and performance for various object recognition tasks (Kornblith et al., 2019).
39
+
40
+ # 2.2 USING PRETRAINED-IMAGENET NETWORKS SIGNIFICANTLY BOOSTS OUT-OF-DOMAIN PERFORMANCE
41
+
42
+ The larger challenge is posed by the out-of-domain horses, rather than on different frames for same horses as used for training. Thus, we evaluated the performance of the networks that had been trained for various fractions of the training data and found that both MobileNetV2s and ResNets were robust (Figures 2B-D).
43
+
44
+ Most strikingly, on out-of-domain horses, the relationship between ImageNet performance and performance on Horse-10 was even stronger. This can be quantified by comparing the linear regression slope for out-of-domain test data: $- 1 . 6 \%$ pose-estimation improvement per percentage point of ImageNet performance, $R ^ { 2 } = 0 . 9 5$ , $p = 0 . 0 0 0 8$ vs. within-domain test data $- 0 . 3 3 \%$ , $\mathbf { \dot { \mathit { R } } ^ { 2 } } = 0 . 9 5$ , $p = 0 . 0 0 1 0$ (Figures 2B-F). In other words, less powerful models (MobileNetV2s) seem to overfit more on the training data. We mused that this improved generalization could be a consequence of the
45
+
46
+ ![](images/8f33e51f7b9bd2de920f8f721f4d4c16429c4e28057f84bbe0e423fd377e3f25.jpg)
47
+ Figure 4: Up to a 3X gain with transfer learning on out-of-domain data. A: Transfer learning gain vs. architectures with $5 0 \%$ of the data used for training (comparing pretrained networks to from-scratch from Figure 2B). B: Same as in A, but for varying levels of input data (5 to $90 \%$ ), light to dark, respectively. All lines are averages of 3 splits.
48
+
49
+ ImageNet pretraining or the architectures themselves. Thus, we trained the different architectures only on the task itself.
50
+
51
+ # 2.3 TASK-BASED TRAINING FROM SCRATCH
52
+
53
+ To assess the impact of ImageNet pretraining we also trained all architectures from scratch. Thereby we could directly test if the increased slope for out-of-domain performance across networks was merely a result of more powerful network architectures.
54
+
55
+ When training from scratch directly on the task for the same amount of iterations (see Methods), we found that all networks performed well on within domain data, given enough training data. The ResNets once again showed an advantage over the MobileNetV2 variants. All the networks performed worse on within domain compared to pretrained-ImageNet networks, and strikingly $2 X$ worse on out-of-domain data (Figures 2E,F).
56
+
57
+ The PCK for all networks as a fraction of the training set size also reflected this decrease in performance compared to pretraining (Figures 8A-C). For example, while PCK with pretrained ResNet network was nearly $\bar { 9 } 7 \%$ (with $2 0 \%$ of the training data), without pretraining this falls to around $8 0 \%$ . Out-of-domain performance drops substantially (pretrained vs. randomized initial weights; comparing Figure 8B to Figure 8C).
58
+
59
+ Without pretraining we find that the Top- $. 1 \%$ accuracy on ImageNet ranking of models only weakly correlates with pose estimation error (linear fit: slope $- 0 . 2 6 \%$ , $R ^ { 2 } = 0 . 5 3$ , $p = 0 . 1 6 6$ ; Figures 2B and 9B). On out-of-domain horses the slope was similar (slope $- 0 . 2 1 \%$ , $\bar { R ^ { 2 } } = 0 . 5 4 , p = 0 . 0 9 8 )$ , unlike when training from pretrained checkpoints. Taken together, our results suggests that ImageNet pretraining significantly boosts generalization (vs. just being a feature of the architectures themselves).
60
+
61
+ Next we quantified the amount of performance gain across all networks (with vs. without pretraining). We found an up to $2 X$ gain in performance (increase in PCK) with transfer learning (Figure 3A-C). Remarkably, for both ResNets and MobileNetV2s, pretraining on ImageNet boosts within domain and out-of-domain reduction in pixel-errors (Figure 4A,B), with the largest gains on out-of-domain data - with $9 0 \%$ of the training data there was a gain of up to a $3 X$ (Figure 4B).
62
+
63
+ # 2.4 FROM SCRATCH NETWORKS CANNOT MATCH THE PERFORMANCE OF PRETRAINED-IMAGENET NETWORKS ON OUT-OF-DOMAIN DATA
64
+
65
+ He et al. (2018) recently showed that training ResNets directly on COCO data for object detection, instance segmentation and key point detection, catches-up with pretrained network accuracy when training for $6 X$ more iterations as typical training schedules. However, due to the nature of the task, they did not test this relationship on out-of-domain data. Given that we see the largest gains of transfer learning on out-of-domain data, we asked if the randomly initialized networks could also catch-up on that metric.
66
+
67
+ ![](images/ae95a8dc6012eef8cac60ff784ba8dab4c6b71c305e2420b63cca8bebb009bb2.jpg)
68
+ Figure 5: Training randomly initialized networks longer cannot rescue out-of-domain performance. A: Normalized error vs. training iterations for ResNet 50 using $5 \%$ of the training data. Training from scratch for 600, 000 iterations does not match the performance of pretrained condition after 100, 000 iterations. Out-of-domain testing does not approach pretrained levels of performance. Faint, dashed lines are backwards projecting from lowest from scratch performance to aid in visualization. B: Same as A but using $50 \%$ of the training data. Test errors when training from scratch closely match the transfer learning performance after many iterations. Crucially, out-of-domain testing does not approach performance for pretrained network.
69
+
70
+ For all the network analysis so far, we trained for 100, 000 iterations (as the loss had relatively flattened), therefore we trained $6 X$ longer to see if test/training errors would decrease. Indeed, consistent with He et al. 2018, we found that randomly initialized networks could closely match the performance of pretrained networks, given enough data and time (Figure 5A, B); for smaller datasets $( 5 \%$ training data), this was not the case (Figure 5A), again suggesting that pretrained-networks offer an advantage for small datasets, which is particularly important for applications in biology (Mathis et al., 2018).
71
+
72
+ Crucially, and most strikingly, for out-of-domain data this was not the case: the from-scratch trained networks never caught up (and indeed plateaued early; Figure 5A, B). Thus, transfer learning offers multiple advantages. Not only does pretraining networks on ImageNet allow for using smaller datasets and shorter training time, it also significantly improves robustness.
73
+
74
+ # 3 DISCUSSION
75
+
76
+ Here we report two key findings: (1) pretrained-ImageNet networks offer an advantage: shorter training times, less data requirements, and robustness on out-of-domain data, and (2) networks that have higher ImageNet performance lead to better generalization, especially on out-of-domain data. Recently, it was shown that for many object recognition datasets the transfer ability is improved when fine-tuning architectures with better ImageNet performance (Kornblith et al., 2019; Huh et al., 2016). In fact, Kornblith et al. (2019) find high correlation between between ImageNet and transfer accuracy for other recognition tasks $( r > 0 . 9 5 )$ ). In contrast to the exhaustive study by Kornblith et al., we only focused on two architecture types: ResNets (He et al., 2016) and MobileNetV2s (Sandler et al., 2018). However, we vary parameters of those networks to also span a broad range of ImageNet accuracies. Consistent with Kornblith et al, we find that ImageNet accuracy is weakly correlated with performance on pose estimation when trained from scratch $R ^ { 2 } = 0 . 5 \dot { 3 }$ ), and strongly when fine-tuning $R ^ { 2 } = 0 . 9 5 )$ . We also find that “better” ImageNet networks transfer better. Moreover, we show that transfer learning significantly improves performance on out-of-domain data.
77
+
78
+ ![](images/0c86f831246d9acabf504ef5ee319c5f340f85fe9ad114ffa2ede2ceaabc8e10.jpg)
79
+ Figure 6: Summary of Findings: We present a new horse dataset for testing within and out-ofdomain performance for pose estimation. We tested two classes of models, MobileNetV2s and ResNets, which span a wide range of performance on ImageNet. We find that networks that perform better on ImageNet are better for pose estimation. We also find that pretrained-ImageNet models strongly improve out-of-domain robustness.
80
+
81
+ # 3.1 TRANSFER LEARNING
82
+
83
+ We show that for both within and out-of-domain pose estimation tasks, transfer learning improves performance. Most notably, transfer learning boosts out-of-domain generalization, improving up to $3 X$ compared to networks without pretraining, and even when training for much longer, as suggested in He et al. (2018), this gap cannot be closed.
84
+
85
+ Another important insight is that for small amounts of data, pretrained networks offer a large advantage (Figures 4 & 5). Corroborating He et al. (2018) we find that given enough training data, training from scratch, with purely task-driven training can match the performance of of transfer learning; however, we also found that for out-of-domain data, pretraining helps significantly, boosting performance up to 3 times (Figure 4).
86
+
87
+ # 3.2 ON THE IMPORTANCE OF DATA
88
+
89
+ Looking forward, this suggests that collecting annotations of task data (instead of pretraining data) is more useful. We think that benchmarks with different contexts, like Horse-10, are important to improve pose estimation algorithms for biological applications (i.e. for small-scale lab-based experiments). A future goal will be to limit, or remove, training altogether. However, in order to create networks that generalize across laboratories and setups, transfer learning will be important for robustness. Yet, more work needs to be done to close the gap between within domain and outof-domain generalization.
90
+
91
+ What is the limit of transfer learning? Would ever larger data sets give better generalization? Interestingly, it appears to strongly depend on what task the network was pretrained on. Recent work by Mahajan et al. (2018) showed that pretraining for large-scale hashtag predictions on Instagram data (3.5 billion images) improves classification, while at the same time possibly harming localization performance for tasks like object detection, instance segmentation, and keypoint detection. This highlights the importance of the task, rather then the sheer size as a crucial factor. Further corroborating this insight, Li et al. showed that pretraining on large-scale object detection task can improve performance for tasks that require fine, spatial information like segmentation (Li et al., 2019). Thus, one interesting future direction to boost robustness could be to utilize networks pretrained on OpenImages, which contains bounding boxes for 15 million instances and close to 2 million images (Kuznetsova et al., 2018).
92
+
93
+ # 3.3 MOBILENETV2 FOR FAST POSE ESTIMATION
94
+
95
+ Here, we introduce using MobileNetV2 variants for animal pose estimation that can achieve high accuracy but with $2 . 5 X$ the speed as a ResNet backbone (Figure 10), making pretrained-MobileNetV2 an excellent option for real-time applications in the wild (on mobile-phones) and in the laboratory.
96
+
97
+ If an end-user utilizes small training sets, ResNets offer an advantage, yet MobileNetV2s are significantly faster (Figure 10) and performs reasonably well, within domain; i.e. to match the ResNet-101 performance with $1 0 \%$ of the training set one needs about $5 0 \%$ for the best MobileNetV2. Potentially, the few pixels lost in accuracy is worth the significant speed improvement (twice as fast) for high-throughput experiments and for real-time applications. MobileNetV2 can run batch inference of $( > 2 , 5 0 0 F P S )$ on a GPU. Using MobileNetV2 also has other advantages: one, MobileNetV2 has low memory demands, and even runs on mobile phones, as the name suggests; two: on CPUs one gets even more speed improvements (Figure 10).
98
+
99
+ What are the trade-offs? With more data for training the MobileNetV2 match the performance of ResNets trained with less labeling data (Figure 2B). However, the ResNets still perform best with matched amounts of data. Thus, to close this gap “Student-Teacher networks” could be used. For example, one could build a larger and more robust ResNet-101 network, then run inference to generate a larger dataset to train the MobileNetV2 variant for fast inference on within domain data.
100
+
101
+ # 4 CONCLUSIONS
102
+
103
+ We found a significant advantage of using pretrained networks for out-of-domain robustness. While there is still a gap to close, we believe this work demonstrates that transfer learning approaches are powerful to build robust architectures. We also demonstrate that ImageNet performance correlates with animal pose estimation accuracy on a challenging “in-the-wild” new horse dataset (Figure 6). Moreover, we aim to add a new variant of networks to the open-source DeepLabCut project, MobileNetV2s, that pave the way for fast and accurate pose estimation. Collectively, our work highlights that pretrained networks require less training data, and allow for faster training, and boost robustness, especially for out-of-domain data.
104
+
105
+ # 5 METHODS
106
+
107
+ # 5.1 HORSE DATASET
108
+
109
+ Here we developed a novel horse data set comprising 30 different horses captured for $4 - 1 0$ seconds with a GoPro camera (Resolution: $1 9 2 0 \times 1 0 8 0$ , Frame Rate: 60 FPS), which we call Horse-30. We used the DeepLabCut2.0 toolbox (Nath et al., 2019) for labeling. We downsampled the frames by a factor of $1 5 \%$ to speed-up the benchmarking process ( $2 8 8 \times 1 6 2$ pixels; one video was downsampled to $3 0 \%$ ).
110
+
111
+ Using previously established anatomical landmarks for equine biomechanical evaluation (Magnusson & Thafvellin, 1990; Anderson & McIlwraith, 2004), the following 22 body parts were labeled by an expert in Thoroughbred horses [BR] across 8, 114 frames: Nose, Eye, Nearknee, Nearfrontfetlock, Nearfrontfoot, Offknee, Offfrontfetlock, Offfrontfoot, Shoulder, Midshoulder, Elbow, Girth, Wither, Nearhindhock, Nearhindfetlock, Nearhindfoot, Hip, Stifle, Offhindhock, Offhindfetlock, Offhindfoot, Ischium.
112
+
113
+ We created 3 splits that contain 10 randomly selected training horses each (referred to as Horse-10). For each training set we took a subset of $5 \%$ $\approx 1 6 0$ frames), $1 0 \%$ $\approx 3 0 0$ frames), $2 0 \%$ $\approx 5 6 0$ frames), $5 0 \%$ $\approx 1 4 7 0$ frames), and $9 0 \%$ $\approx 2 5 8 0$ frames) of the frames for training, and then evaluated the performance on the training, test, and unseen (“out-of-domain”) horses (i.e. the other horses that are in Horse-30, but were not in the given split of Horse-10). As metric we used mean average Euclidean error, which is computed by comparing the inferred poses for each body parts against the human prediction as well as percent correct key-point (PCK) values; i.e. what fraction of machine-applied points fall within a specific range of human-labeled ground-truth labels; although we use a matching threshold of $3 0 \%$ of the head segment length (nose to eye for horse, which was computed by taking the median for all annotated images per horse) rather than $5 0 \%$ as for MPII pose (Andriluka et al., 2014).
114
+
115
+ # 5.2 NETWORK VARIANTS
116
+
117
+ For this study we utilized a recently introduced an animal pose estimation toolbox called DeepLabCut (Mathis et al., 2018; Mathis & Warren, 2018; Nath et al., 2019). The TensorFlow-based network architectures could be easily exchanged while keeping data loading, training, and evaluation consistent.
118
+
119
+ DeepLabCut (Mathis et al., 2018; Nath et al., 2019) is built on a subset of the deep feature detectors in DeeperCut (Insafutdinov et al., 2016). The feature detectors in DeepLabCut consist of residual networks (ResNets) (He et al., 2016) followed by deconvolutional layers to predict pose scoremaps and location refinement maps, which can then be used for predicting the pose while also proving a confidence score (Insafutdinov et al., 2016; Mathis et al., 2018). We utilize an output stride of 16 for the ResNets (achieved by atrous convolution) and then upsample the filter banks with deconvolutions by a factor of two to predict the heatmaps and location-refinement at 1/8th of the original image size scale. This gives a good balance of feature-map size and accuracy. However, the ratio can, of course, be changed and this affects speed, while still being relatively robust (Insafutdinov et al., 2016).
120
+
121
+ Here we also introduce a MobileNetV2 architecture that could be used within DeepLabCut (Sandler et al., 2018). MobileNetV2 utilizes depth-wise separable convolutions, inverted residual bottlenecks to significantly decrease the number of operations and memory needed while retaining high accuracy for ImageNet, object detection and image segmentation accuracy (Sandler et al., 2018). We configured the output-stride as 16 (by changing the (otherwise) last stride 2 convolution to stride 1). We utilized four variants of MobileNetV2 with different expansion ratios (0.35, 0.5, 0.75 and 1) as this ratio modulates the ImageNet accuracy from $6 0 . 3 \%$ to $7 1 . 8 \%$ , and pretrained models on ImageNet are available from TensorFlow (Abadi et al., 2016).
122
+
123
+ # 5.3 NETWORK TRAINING PARAMETERS
124
+
125
+ Most training parameters used here are consistent with the ones reported in DeepLabCut-2.0. (Nath et al., 2019). The training loss is defined as the cross entropy loss for the scoremaps and the location refinement error via a Huber loss with weight 0.05; it is minimized via stochastic gradient descent with batch size 1 (Insafutdinov et al., 2016; Mathis et al., 2018). We use the following training schedule: 0.005 for the first $1 0 k$ iterations then 0.02 onwards. For training from scratch, we had to start with a lower learning rate to avoid divergence of the loss and used $\bar { 1 } 0 ^ { - 6 }$ for the first 5, 000 steps, then $1 0 ^ { - 4 }$ for the next $2 0 k$ , followed by 0.02. We always trained for $1 0 0 k$ iterations, unless noted. When training up to $6 0 0 k$ iterations, we changed to 0.002 after $4 3 0 k$ iterations (as it is default for DeepLabCut).
126
+
127
+ # Speed Benchmarking
128
+
129
+ Using an example from the horse dataset we evaluated one video with 11, 178 frames at resolutions $5 1 2 \times 5 1 2$ , $2 5 6 \times 2 5 6$ and $1 2 8 \times 1 2 8$ . We used batch sizes: $[ 1 , 2 , 4 , 1 6 , 3 2 , 1 2 8 , 2 5 6 , 5 1 2 ]$ , and ran all models for all 3 (training set shuffles) trained with $5 0 \%$ of the data in a pseudo random order on an NVIDIA Titan RTX. For the benchmarking on a CPU we used shortened videos with merely 728 frames; the CPU was an Intel Xeon CPU E5-2603 v4 $@$ 1.70GHz with 6 cores. We also changed the inference code from its numpy implementation (Mathis & Warren, 2018) to TensorFlow, which brings a $2 - 1 0 \%$ gain in speed.
130
+
131
+ # REFERENCES
132
+
133
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: a system for largescale machine learning. In OSDI, volume 16, pp. 265–283, 2016.
134
+ Rıza Alp Guler, Natalia Neverova, and Iasonas Kokkinos. Densepose: Dense human pose estimation ¨ in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7297–7306, 2018.
135
+ D. J. Anderson and P. Perona. Toward a science of computational ethology. Neuron, 84(1):18–31, Oct 2014. URL https://doi.org/10.1016/j.neuron.2014.09.005.
136
+ TM Anderson and CW McIlwraith. Longitudinal development of equine conformation from weanling to age 3 years in the thoroughbred. Equine veterinary journal, 36(7):563–570, 2004.
137
+
138
+ Mykhaylo Andriluka, Leonid Pishchulin, Peter Gehler, and Bernt Schiele. 2d human pose estimation: New benchmark and state of the art analysis. In Proceedings of the IEEE Conference on computer Vision and Pattern Recognition, pp. 3686–3693, 2014. URL http: //ieeexplore.ieee.org/document/6909866/.
139
+
140
+ Mykhaylo Andriluka, Umar Iqbal, Eldar Insafutdinov, Leonid Pishchulin, Anton Milan, Juergen Gall, and Bernt Schiele. Posetrack: A benchmark for human pose estimation and tracking. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5167– 5176, 2018.
141
+
142
+ Zhe Cao, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Realtime multi-person 2d pose estimation using part affinity fields. In CVPR, 2017.
143
+
144
+ Qi Dang, Jianqin Yin, Bin Wang, and Wenqing Zheng. Deep learning based 2d human pose estimation: A survey. Tsinghua Science and Technology, 24(6):663–676, Dec 2019. ISSN 1007-0214. doi: 10.26599/TST.2018.9010100.
145
+
146
+ Carl Doersch and Andrew Zisserman. Sim2real transfer learning for 3d pose estimation: motion to the rescue. CoRR, abs/1907.02499, 2019. URL http://arxiv.org/abs/1907.02499.
147
+
148
+ Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. DeCaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning, pp. 647–655, 2014. URL https://arxiv.org/ abs/1310.1531.
149
+
150
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. URL https://arxiv.org/abs/1512.03385.
151
+
152
+ 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.
153
+
154
+ Kaiming He, Ross Girshick, and Piotr Dollar. Rethinking imagenet pre-training. ´ arXiv preprint arXiv:1811.08883, 2018.
155
+
156
+ Oskar Heinroth and Magdalena Wiebe Heinroth. Die Vogel Mitteleuropas: in allen Lebens-und ¨ Entwicklungsstufen photographisch aufgenommen und in ihrem Seelenleben bei der Aufzucht vom Ei ab beobachtet, volume 1. Edition Leipzig, 1966.
157
+
158
+ Minyoung Huh, Pulkit Agrawal, and Alexei A Efros. What makes imagenet good for transfer learning? arXiv preprint arXiv:1608.08614, 2016.
159
+
160
+ Auke J Ijspeert. Biorobotics: Using robots to emulate and investigate agile locomotion. science, 346(6206):196–203, 2014.
161
+
162
+ Eldar Insafutdinov, Leonid Pishchulin, Bjoern Andres, Mykhaylo Andriluka, and Bernt Schiele. DeeperCut: A deeper, stronger, and faster multi-person pose estimation model. In European Conference on Computer Vision, pp. 34–50. Springer, 2016. URL https://arxiv.org/ abs/1605.03170.
163
+
164
+ Eldar Insafutdinov, Mykhaylo Andriluka, Leonid Pishchulin, Siyu Tang, Evgeny Levinkov, Bjoern Andres, and Bernt Schiele. Arttrack: Articulated multi-person tracking in the wild. In CVPR’17, 2017. URL http://arxiv.org/abs/1612.01465.
165
+
166
+ Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2661– 2671, 2019.
167
+
168
+ Sven Kreiss, Lorenzo Bertoni, and Alexandre Alahi. Pifpaf: Composite fields for human pose estimation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 11977–11986, 2019.
169
+
170
+ Matthias Kummerer, Thomas SA Wallis, and Matthias Bethge. Deepgaze ii: Reading fixations ¨ from deep features trained on object recognition. arXiv preprint arXiv:1610.01563, 2016. URL https://arxiv.org/abs/1610.01563.
171
+
172
+ Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Uijlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Tom Duerig, et al. The open images dataset v4: Unified image classification, object detection, and visual relationship detection at scale. arXiv preprint arXiv:1811.00982, 2018.
173
+
174
+ Hengduo Li, Bharat Singh, Mahyar Najibi, Zuxuan Wu, and Larry S Davis. An analysis of pretraining on object detection. arXiv preprint arXiv:1904.05871, 2019.
175
+
176
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014.
177
+
178
+ Lars-Erik Magnusson and B Thafvellin. Studies on the conformation and related traits of standardbred trotters in sweden. Journal of Animal Physiology and Animal Nutrition (Germany, FR), 1990.
179
+
180
+ Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 181– 196, 2018.
181
+
182
+ William A Mason and Dale F Lott. Ethology and comparative psychology. Annual Review of Psychology, 27(1):129–154, 1976.
183
+
184
+ A Mathis, P Mamidanna, KM Cury, T Abe, VN Murthy, MW Mathis, and M Bethge. Deeplabcut: markerless pose estimation of user-defined body parts with deep learning. Nature Neuroscience, 21(9):1281–1289, 2018.
185
+
186
+ Alexander Mathis and Richard A. Warren. On the inference speed and video-compression robustness of deeplabcut. BioRxiv, 2018. doi: 10.1101/457242. URL https://doi.org/10.1101/ 457242.
187
+
188
+ Dushyant Mehta, Helge Rhodin, Dan Casas, Oleksandr Sotnychenko, Weipeng Xu, and Christian Theobalt. Monocular 3d human pose estimation using transfer learning and improved cnn supervision. ArXiv, abs/1611.09813, 2016.
189
+
190
+ Franziska Mueller, Florian Bernard, Oleksandr Sotnychenko, Dushyant Mehta, Srinath Sridhar, Dan Casas, and Christian Theobalt. Ganerated hands for real-time 3d hand tracking from monocular RGB. CoRR, abs/1712.01057, 2017. URL http://arxiv.org/abs/1712.01057.
191
+
192
+ Tanmay Nath, Alexander Mathis, An Chi Chen, Amir Patel, Matthias Bethge, and Mackenzie Weygandt Mathis. Using deeplabcut for 3d markerless pose estimation across species and behaviors. Nature Protocols, 14:2152–2176, 2019.
193
+
194
+ David Novotny, Diane Larlus, and Andrea Vedaldi. Anchornet: A weakly supervised network to learn geometry-sensitive features for semantic matching. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5277–5286, 2017.
195
+
196
+ Helge Rhodin, Jorg Sp ¨ orri, Isinsu Katircioglu, Victor Constantin, Fr ¨ ed´ eric Meyer, Erich M ´ uller, ¨ Mathieu Salzmann, and Pascal Fua. Learning monocular 3d human pose estimation from multiview images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8437–8446, 2018.
197
+
198
+ Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510–4520, 2018.
199
+
200
+ Ke Sun, Bin Xiao, Dong Liu, and Jingdong Wang. Deep high-resolution representation learning for human pose estimation. arXiv preprint arXiv:1902.09212, 2019.
201
+
202
+ Bin Xiao, Haiping Wu, and Yichen Wei. Simple baselines for human pose estimation and tracking. CoRR, abs/1804.06208, 2018. URL http://arxiv.org/abs/1804.06208.
203
+
204
+ Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014.
205
+
206
+ A APPENDIX
207
+
208
+ ![](images/8d746d88abc55d3007e9333e4c5b828444df5c75efe3706d696735fa3c13d361.jpg)
209
+ Figure 7: Example frames with human and pretrained network annotations. Here we show the smallest networks, namely ResNet-50 and the ultra-lightweight MobileNetV2-0.35, trained for 100, 000 iterations. Top Left set: example training images. Top Right: within domain test image results. Bottom: out-of-domain horses. Examples illustrate the challenges: varying coat colors, size changes, background, human legs, various postures, background horses, and partially occluded horses while they walk in and out of the video frames.
210
+
211
+ ![](images/24e621bdebdbc97f555e240f2bc8947c5539271b8087c3720855e3e1118cc175.jpg)
212
+ Figure 8: Transfer Learning boosts accuracy (PCK). A: Percent Correct Keypoint (PCK) vs. Training Set Fraction shows high performance for all networks on Horse-10. Darker to light red shades are test results for pretrained networks: ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35. Darker to lighter blue is for training, the same ordering as in test. All lines are averages of 3 splits (see Methods). B: Same as in A, plus the out-of-domain data (pink is for out-of-domain data on 20 unseen horses). C: Same as in B, but without pretraining on ImageNet.
213
+
214
+ ![](images/594b9db788576f6a1c41b43223914f86854e6594adee1824a2ecc8ab8b0267f6.jpg)
215
+ Figure 9: Test and training performance when training from scratch.) A: Normalized Error vs. Training Set Fraction of Horse-10. $5 \%$ is $\approx ~ 1 6 0$ frames. Darker to light red shades are test results for ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35. Darker to lighter blue is for training, same ordering as in test. B: Normalized Error vs. Network performance as ranked by the Top $1 \%$ accuracy on ImageNet, but here on Horse-10; namely, MobileNetV2-0.35, MobileNetV2-0.5, MobileNetV2-.75, MobileNetV2-1, ResNet-50, ResNet-101. Test data is in red, train is blue. This data is for $5 0 \%$ training set fraction.
216
+
217
+ ![](images/ebfa3d0655a6d7c01d6622dcbabfe43f362ebab95773f43f4ec130a3f9180b70.jpg)
218
+ Figure 10: Speed Benchmarking for ResNets and MobileNetV2s: Inference speed for videos of different dimensions for all the architectures. A-C: FPS vs. batchsize, with video frame sizes as stated in the title. Three splits are shown for each network. MobileNetV2 gives a more than 2X speed improvement (over ResNet-50) for offline processing and about $4 0 \%$ for batchsize $^ { \cdot = 1 }$ on a Titan RTX GPU. On CPU we found even larger gains.
219
+
220
+ Table 1: Batch size 1 (FPS): Mean inference speed for batchsize $^ { = 1 }$ and batchsize ${ } = 2 5 6$ (Table 2) for there different video frame sizes on a Titan RTX GPU. Video was $\approx 1 1$ , 000 frames long of a horse, with 22 bodyparts to be identified. See Methods for further details.
221
+
222
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>128x128</td><td rowspan=1 colspan=1>256x256</td><td rowspan=1 colspan=1>512x512</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.35</td><td rowspan=1 colspan=1>195</td><td rowspan=1 colspan=1>132</td><td rowspan=1 colspan=1>65</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.50</td><td rowspan=1 colspan=1>185</td><td rowspan=1 colspan=1>131</td><td rowspan=1 colspan=1>61</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.75</td><td rowspan=1 colspan=1>185</td><td rowspan=1 colspan=1>129</td><td rowspan=1 colspan=1>55</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-1</td><td rowspan=1 colspan=1>190</td><td rowspan=1 colspan=1>132</td><td rowspan=1 colspan=1>53</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>146</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>45</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>93</td><td rowspan=1 colspan=1>69</td><td rowspan=1 colspan=1>34</td></tr></table>
223
+
224
+ Table 2: Batch size 256 (FPS)
225
+
226
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>128x128</td><td rowspan=1 colspan=1>256x256</td><td rowspan=1 colspan=1>512x512</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.35</td><td rowspan=1 colspan=1>2557</td><td rowspan=1 colspan=1>784</td><td rowspan=1 colspan=1>176</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.50</td><td rowspan=1 colspan=1>2338</td><td rowspan=1 colspan=1>711</td><td rowspan=1 colspan=1>161</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.75</td><td rowspan=1 colspan=1>2008</td><td rowspan=1 colspan=1>568</td><td rowspan=1 colspan=1>128</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-1</td><td rowspan=1 colspan=1>1834</td><td rowspan=1 colspan=1>523</td><td rowspan=1 colspan=1>118</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>1208</td><td rowspan=1 colspan=1>339</td><td rowspan=1 colspan=1>84</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>902</td><td rowspan=1 colspan=1>249</td><td rowspan=1 colspan=1>62</td></tr></table>
parse/train/BkgMbCVFvr/BkgMbCVFvr_content_list.json ADDED
@@ -0,0 +1,1270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "PRETRAINING BOOSTS OUT-OF-DOMAIN ROBUSTNESS FOR POSE ESTIMATION ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 174,
8
+ 99,
9
+ 655,
10
+ 146
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous authors Paper under double-blind review ",
17
+ "bbox": [
18
+ 183,
19
+ 170,
20
+ 398,
21
+ 198
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 234,
32
+ 544,
33
+ 251
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Deep neural networks are highly effective tools for human and animal pose estimation. However, robustness to out-of-domain data remains a challenge. Here, we probe the transfer and generalization ability for pose estimation with two architecture classes (MobileNetV2s and ResNets) pretrained on ImageNet. We generated a novel dataset of 30 horses that allowed for both within-domain and outof-domain (unseen horse) testing. We find that pretraining on ImageNet strongly improves out-of-domain performance. Moreover, we show that for both pretrained and networks trained from scratch, better ImageNet-performing architectures perform better for pose estimation, with a substantial improvement on out-of-domain data when pretrained. Collectively, our results demonstrate that transfer learning is particularly beneficial for out-of-domain robustness. ",
40
+ "bbox": [
41
+ 233,
42
+ 266,
43
+ 764,
44
+ 419
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 176,
54
+ 446,
55
+ 336,
56
+ 463
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Pose estimation is an important tool for understanding behavior, as it belies analysis of movement kinematics, action recognition, and ethology (Mason & Lott, 1976; Heinroth & Heinroth, 1966; Ijspeert, 2014; Anderson & Perona, 2014). Pose estimation on humans has reached remarkable capabilities due to innovations in both algorithms (Insafutdinov et al., 2017; Cao et al., 2017; He et al., 2017; Alp Guler et al., 2018; Xiao et al., 2018; Kreiss et al., 2019; Sun et al., 2019) and large- ¨ scale datasets (Lin et al., 2014; Andriluka et al., 2014; 2018). However, it is a challenging problem due to small joints, occlusions, clothing, and changes in background and scene statistics. Thus, many networks suffer when applied to out-of-domain data, i.e. images that are sufficiently different from the training set. For instance, they fail on very articulated human movements like skiing, or other ‘rare poses’, if not in the training set (Rhodin et al., 2018; Dang et al., 2019). Moreover, animal pose estimation has additional challenges. Not all animals share the same keypoints, therefore a universal “animal pose detector” is not feasible. Even building animal-specific networks would require a lot of data, due to the large variability in body shapes, colors, and the number of species as well as breeds of a type of animal. Therefore, the question of how one can robustly learn from limited annotated datasets is of particular importance, and animal pose estimation datasets allow for generalization to be systematically tested (Novotny et al., 2017). ",
63
+ "bbox": [
64
+ 174,
65
+ 479,
66
+ 825,
67
+ 700
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "How can robustness be achieved? Transfer learning, or the transferability of pretrained features from one task to another, is a powerful approach that has been well studied in computer vision (Donahue et al., 2014; Yosinski et al., 2014; Kummerer et al., 2016; Huh et al., 2016; He et al., 2018). It ¨ has been shown to improve performance on some human pose estimation tasks (Mehta et al., 2016; Mueller et al., 2017; Xiao et al., 2018; Insafutdinov et al., 2017), yet is not universally used in the top-performing networks on the human 2D/3D pose estimation benchmarks (Doersch & Zisserman, 2019). For keypoint detection, He et al. recently showed that pretraining on ImageNet did not result in overall performance improvements if randomly initialized models were allowed to train for much longer than usual, therefore suggesting that (given enough task-data) the main benefit of transfer learning is shorter training time, rather than performance (He et al., 2018). However, it has not been tested whether pretraining on ImageNet offers advantages in robustness, for instance as measured by any performance advantage on out-of-domain data. ",
74
+ "bbox": [
75
+ 174,
76
+ 708,
77
+ 825,
78
+ 875
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "We address this by building a new pose estimation task of 8, 114 labeled video frames from 30 Thoroughbred horses. We focus on horses as their diversity readily allows us to assess out-of-domain generalization, i.e. the ability to generalize to the different, unseen horses in different contexts. We created a task, called Horse-10, that uses only 10 horses for the test/train splits, and uses the other 20 horses to test out-of-domain performance (Figure 1). The data will be made available at TBA. ",
85
+ "bbox": [
86
+ 176,
87
+ 882,
88
+ 823,
89
+ 924
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "image",
95
+ "img_path": "images/731b3da0ff1d973cbbd2dd09e04b1a4db5c69e291dc8e2f188eb729b8f3a4d9e.jpg",
96
+ "image_caption": [
97
+ "Figure 1: Horse Dataset: Example frames for each young Thoroughbred horse in the dataset. In each video the horse walks from left to right. The videos vary in horse color, the appearance of sunlight and shadow, and relative horse size as well as background. This makes the data set ideal for tests in robustness and generalization. To illustrate the horse-10 task we arranged the horses according to one split: the ten leftmost horses were used for train/test within-domain, and the rest are the out-of-domain held out horses. "
98
+ ],
99
+ "image_footnote": [],
100
+ "bbox": [
101
+ 174,
102
+ 102,
103
+ 823,
104
+ 335
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "",
111
+ "bbox": [
112
+ 174,
113
+ 474,
114
+ 823,
115
+ 502
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "Here we report two key insights: (1) higher ImageNet performance leads to better generalization for both within domain and on out-of-domain data for pose estimation but with a stronger effect on out-of-domain data (see Figure 2B); (2) transfer learning improves robustness again most strongly for out-of-domain data, and yields up to 3 times more accurate results than training from scratch (see Figure 4D,E). Thus, while it has been previously shown that training from scratch can match performance on in-domain data for sufficiently large amount of training data and training times (He et al., 2018), we show it clearly cannot match performance of pretrained networks on out-of-domain data (see Figure 5). Collectively, this sheds a new light on the inductive biases of “better ImageNet architectures” for visual tasks to be particularly beneficial for robustness, even beyond within domain data accuracy, on out-of-domain datasets. ",
122
+ "bbox": [
123
+ 174,
124
+ 510,
125
+ 825,
126
+ 648
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "2 RESULTS ",
133
+ "text_level": 1,
134
+ "bbox": [
135
+ 174,
136
+ 669,
137
+ 281,
138
+ 684
139
+ ],
140
+ "page_idx": 1
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "To test within and out-of-domain performance we created a new dataset of 30 different walking horses (Thoroughbreds that are led by different humans), resulting in a dataset of 8, 114 images with 22 labeled body parts each. Horses have various coat colors and the “in-the-wild” aspect of the collected data at various Thoroughbred yearling sales and farms added additional complexity. The sunlight variation between each video added to the complexity of the learning challenge, as well as the handlers often wearing horse-leg-colored clothing. Some horses were in direct sunlight while others had the light behind them, and others were walking into and out of shadows, which was particularly problematic with a dataset dominated by dark colored coats (Figure 1). Thus, this dataset is ideal for testing robustness and out-of-sample generalization. ",
145
+ "bbox": [
146
+ 174,
147
+ 700,
148
+ 825,
149
+ 825
150
+ ],
151
+ "page_idx": 1
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": ".1 IMAGENET ACCURACY PREDICTS ANIMAL POSE ESTIMATION ACCURAC ",
156
+ "text_level": 1,
157
+ "bbox": [
158
+ 189,
159
+ 843,
160
+ 705,
161
+ 856
162
+ ],
163
+ "page_idx": 1
164
+ },
165
+ {
166
+ "type": "text",
167
+ "text": "To probe the role of different ImageNet pretrained architectures, we compared four variants of MobileNetV2 with varying expansion ratios, as the width multiplier parameterizes ImageNet performance over a wide range (see Methods), and two variants of ResNets (50 and 101 layers deep). We utilized a ‘simple’ yet competitive pose estimation architecture (Insafutdinov et al., 2016; Mathis et al., 2018) embedded in DeepLabCut, a toolbox for data-set generation, training, and evaluation (see Methods). The architectures then consisted of either MobileNetV2s (Sandler et al., 2018) or ResNets (He et al., 2016), where a single deconvolution layer is connected to the final convolutional layer to predict poses via body-part specific scoremaps as well as location refinement maps (Insafutdinov et al., 2016; Mathis et al., 2018). We created 3 splits containing 10 random horses each, and then varied the amount of training data from these 10 horses (referred to as Horse-10, see Methods). As the horses could vary dramatically in size across frames, due to the “in-the-wild” variation in distance from the camera, we used a normalized pixel error; i.e. we normalized the raw pixel errors by the eye-to-nose distance and report the fraction within this distance (Figure 2A). In total, we found that all pretrained-ImageNet networks showed great performance on Horse-10 within domain (Figures 2B, 7). ",
168
+ "bbox": [
169
+ 176,
170
+ 867,
171
+ 823,
172
+ 924
173
+ ],
174
+ "page_idx": 1
175
+ },
176
+ {
177
+ "type": "image",
178
+ "img_path": "images/37dbe0a7484a17b0998b14c94a78330aff9713a534eb2eb2a061d91f3f65a14c.jpg",
179
+ "image_caption": [
180
+ "Figure 2: Transfer Learning boosts performance, especially on out-of-domain data. A: Illustration of the normalized error metric. B: Normalized Error vs. Network performance as ranked by the Top $1 \\%$ accuracy on ImageNet (order by increasing ImageNet performance: MobileNetV2- 0.35, MobileNetV2-0.5, MobileNetV2-0.75, MobileNetV2-1, ResNet-50, ResNet-101). The pose estimation performance is for $5 0 \\%$ training set fraction. The faint lines indicate data for the three splits. LEFT: Test data is in red, train is blue. RIGHT: additionally, pink is out-of-domain data; dashed lines indicate networks trained from scratch. Better ImageNet networks perform better on Horse-10; this relationship is even stronger for out-of-domain data. C: Example frames with human annotated body parts vs. predicted body parts for MobileNetV2-0.35 and ResNet-50 architectures with ImageNet pretraining on out-of-domain horses. D: Normalized Error vs. Training Set Fraction of Horse-10. For reference, $5 \\%$ training data is $\\approx 1 6 0$ frames. Darker to light red shades are test results for pretrained networks on within-domain data. Shades of pink show the test on out-ofdomain data (order according to ImageNet performance: ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35). E: Same as C but for training from scratch. F: Same as D but for training from scratch. All lines are averages of 3 splits (see Methods). "
181
+ ],
182
+ "image_footnote": [],
183
+ "bbox": [
184
+ 173,
185
+ 111,
186
+ 816,
187
+ 688
188
+ ],
189
+ "page_idx": 2
190
+ },
191
+ {
192
+ "type": "image",
193
+ "img_path": "images/cdee02af92618fdfa301fa2dc6b55c19164b90da666c1f9fcdb8d8ed46d53cc3.jpg",
194
+ "image_caption": [
195
+ "Figure 3: Fraction of correctly identified bodyparts improves with transfer learning A: Percent Correct Keypoint (PCK) vs. Training Set Fraction shows high performance for all pretrained networks on Horse-10. B: Same as A, but training from scratch. The performance drops strongly, especially for out-of-domain data C: Performance gain when using transfer learning. All lines are averages of 3 splits, individual splits are shown as faint lines. "
196
+ ],
197
+ "image_footnote": [],
198
+ "bbox": [
199
+ 181,
200
+ 103,
201
+ 823,
202
+ 282
203
+ ],
204
+ "page_idx": 3
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "",
209
+ "bbox": [
210
+ 173,
211
+ 406,
212
+ 825,
213
+ 560
214
+ ],
215
+ "page_idx": 3
216
+ },
217
+ {
218
+ "type": "text",
219
+ "text": "To further assess the errors we computed the percent correct keypoints (PCK; defined as within $3 0 \\%$ of the distance from nose-to-eye, see Methods) and found that performance was nearly $9 7 \\%$ for ResNets (with at least $2 0 \\%$ training data) and only fell to $\\approx 9 3 \\%$ on MobileNetV2-based models (Figure 8A). Even with very small datasets $( 5 \\%$ , i.e. around 160 training images) performance was $8 0 \\%$ to $8 5 \\%$ on MobileNetV2 and ResNets, respectively (Figure 8A). ",
220
+ "bbox": [
221
+ 174,
222
+ 566,
223
+ 825,
224
+ 637
225
+ ],
226
+ "page_idx": 3
227
+ },
228
+ {
229
+ "type": "text",
230
+ "text": "Next, we directly compare the ImageNet performance to their respective performance on this pose estimation task. We find Top- $. 1 \\%$ accuracy on ImageNet, correlates with pose estimation error (linear fit: slope $- 0 . 3 3 \\%$ , $R ^ { 2 } = 0 . 9 5$ , $p = 0 . 0 0 1$ ; Figures 2B). This linear relationship is consistent with a recently reported correlation of ImageNet accuracy and performance for various object recognition tasks (Kornblith et al., 2019). ",
231
+ "bbox": [
232
+ 174,
233
+ 643,
234
+ 825,
235
+ 713
236
+ ],
237
+ "page_idx": 3
238
+ },
239
+ {
240
+ "type": "text",
241
+ "text": "2.2 USING PRETRAINED-IMAGENET NETWORKS SIGNIFICANTLY BOOSTS OUT-OF-DOMAIN PERFORMANCE ",
242
+ "text_level": 1,
243
+ "bbox": [
244
+ 176,
245
+ 736,
246
+ 812,
247
+ 763
248
+ ],
249
+ "page_idx": 3
250
+ },
251
+ {
252
+ "type": "text",
253
+ "text": "The larger challenge is posed by the out-of-domain horses, rather than on different frames for same horses as used for training. Thus, we evaluated the performance of the networks that had been trained for various fractions of the training data and found that both MobileNetV2s and ResNets were robust (Figures 2B-D). ",
254
+ "bbox": [
255
+ 174,
256
+ 776,
257
+ 823,
258
+ 833
259
+ ],
260
+ "page_idx": 3
261
+ },
262
+ {
263
+ "type": "text",
264
+ "text": "Most strikingly, on out-of-domain horses, the relationship between ImageNet performance and performance on Horse-10 was even stronger. This can be quantified by comparing the linear regression slope for out-of-domain test data: $- 1 . 6 \\%$ pose-estimation improvement per percentage point of ImageNet performance, $R ^ { 2 } = 0 . 9 5$ , $p = 0 . 0 0 0 8$ vs. within-domain test data $- 0 . 3 3 \\%$ , $\\mathbf { \\dot { \\mathit { R } } ^ { 2 } } = 0 . 9 5$ , $p = 0 . 0 0 1 0$ (Figures 2B-F). In other words, less powerful models (MobileNetV2s) seem to overfit more on the training data. We mused that this improved generalization could be a consequence of the ",
265
+ "bbox": [
266
+ 173,
267
+ 840,
268
+ 825,
269
+ 924
270
+ ],
271
+ "page_idx": 3
272
+ },
273
+ {
274
+ "type": "image",
275
+ "img_path": "images/8f33e51f7b9bd2de920f8f721f4d4c16429c4e28057f84bbe0e423fd377e3f25.jpg",
276
+ "image_caption": [
277
+ "Figure 4: Up to a 3X gain with transfer learning on out-of-domain data. A: Transfer learning gain vs. architectures with $5 0 \\%$ of the data used for training (comparing pretrained networks to from-scratch from Figure 2B). B: Same as in A, but for varying levels of input data (5 to $90 \\%$ ), light to dark, respectively. All lines are averages of 3 splits. "
278
+ ],
279
+ "image_footnote": [],
280
+ "bbox": [
281
+ 178,
282
+ 99,
283
+ 795,
284
+ 296
285
+ ],
286
+ "page_idx": 4
287
+ },
288
+ {
289
+ "type": "text",
290
+ "text": "ImageNet pretraining or the architectures themselves. Thus, we trained the different architectures only on the task itself. ",
291
+ "bbox": [
292
+ 173,
293
+ 405,
294
+ 823,
295
+ 433
296
+ ],
297
+ "page_idx": 4
298
+ },
299
+ {
300
+ "type": "text",
301
+ "text": "2.3 TASK-BASED TRAINING FROM SCRATCH ",
302
+ "text_level": 1,
303
+ "bbox": [
304
+ 174,
305
+ 450,
306
+ 491,
307
+ 464
308
+ ],
309
+ "page_idx": 4
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "To assess the impact of ImageNet pretraining we also trained all architectures from scratch. Thereby we could directly test if the increased slope for out-of-domain performance across networks was merely a result of more powerful network architectures. ",
314
+ "bbox": [
315
+ 176,
316
+ 476,
317
+ 825,
318
+ 517
319
+ ],
320
+ "page_idx": 4
321
+ },
322
+ {
323
+ "type": "text",
324
+ "text": "When training from scratch directly on the task for the same amount of iterations (see Methods), we found that all networks performed well on within domain data, given enough training data. The ResNets once again showed an advantage over the MobileNetV2 variants. All the networks performed worse on within domain compared to pretrained-ImageNet networks, and strikingly $2 X$ worse on out-of-domain data (Figures 2E,F). ",
325
+ "bbox": [
326
+ 174,
327
+ 525,
328
+ 823,
329
+ 594
330
+ ],
331
+ "page_idx": 4
332
+ },
333
+ {
334
+ "type": "text",
335
+ "text": "The PCK for all networks as a fraction of the training set size also reflected this decrease in performance compared to pretraining (Figures 8A-C). For example, while PCK with pretrained ResNet network was nearly $\\bar { 9 } 7 \\%$ (with $2 0 \\%$ of the training data), without pretraining this falls to around $8 0 \\%$ . Out-of-domain performance drops substantially (pretrained vs. randomized initial weights; comparing Figure 8B to Figure 8C). ",
336
+ "bbox": [
337
+ 174,
338
+ 601,
339
+ 823,
340
+ 671
341
+ ],
342
+ "page_idx": 4
343
+ },
344
+ {
345
+ "type": "text",
346
+ "text": "Without pretraining we find that the Top- $. 1 \\%$ accuracy on ImageNet ranking of models only weakly correlates with pose estimation error (linear fit: slope $- 0 . 2 6 \\%$ , $R ^ { 2 } = 0 . 5 3$ , $p = 0 . 1 6 6$ ; Figures 2B and 9B). On out-of-domain horses the slope was similar (slope $- 0 . 2 1 \\%$ , $\\bar { R ^ { 2 } } = 0 . 5 4 , p = 0 . 0 9 8 )$ , unlike when training from pretrained checkpoints. Taken together, our results suggests that ImageNet pretraining significantly boosts generalization (vs. just being a feature of the architectures themselves). ",
347
+ "bbox": [
348
+ 174,
349
+ 678,
350
+ 825,
351
+ 762
352
+ ],
353
+ "page_idx": 4
354
+ },
355
+ {
356
+ "type": "text",
357
+ "text": "Next we quantified the amount of performance gain across all networks (with vs. without pretraining). We found an up to $2 X$ gain in performance (increase in PCK) with transfer learning (Figure 3A-C). Remarkably, for both ResNets and MobileNetV2s, pretraining on ImageNet boosts within domain and out-of-domain reduction in pixel-errors (Figure 4A,B), with the largest gains on out-of-domain data - with $9 0 \\%$ of the training data there was a gain of up to a $3 X$ (Figure 4B). ",
358
+ "bbox": [
359
+ 174,
360
+ 768,
361
+ 825,
362
+ 838
363
+ ],
364
+ "page_idx": 4
365
+ },
366
+ {
367
+ "type": "text",
368
+ "text": "2.4 FROM SCRATCH NETWORKS CANNOT MATCH THE PERFORMANCE OF PRETRAINED-IMAGENET NETWORKS ON OUT-OF-DOMAIN DATA ",
369
+ "text_level": 1,
370
+ "bbox": [
371
+ 176,
372
+ 856,
373
+ 687,
374
+ 883
375
+ ],
376
+ "page_idx": 4
377
+ },
378
+ {
379
+ "type": "text",
380
+ "text": "He et al. (2018) recently showed that training ResNets directly on COCO data for object detection, instance segmentation and key point detection, catches-up with pretrained network accuracy when training for $6 X$ more iterations as typical training schedules. However, due to the nature of the task, they did not test this relationship on out-of-domain data. Given that we see the largest gains of transfer learning on out-of-domain data, we asked if the randomly initialized networks could also catch-up on that metric. ",
381
+ "bbox": [
382
+ 176,
383
+ 895,
384
+ 821,
385
+ 924
386
+ ],
387
+ "page_idx": 4
388
+ },
389
+ {
390
+ "type": "image",
391
+ "img_path": "images/ae95a8dc6012eef8cac60ff784ba8dab4c6b71c305e2420b63cca8bebb009bb2.jpg",
392
+ "image_caption": [
393
+ "Figure 5: Training randomly initialized networks longer cannot rescue out-of-domain performance. A: Normalized error vs. training iterations for ResNet 50 using $5 \\%$ of the training data. Training from scratch for 600, 000 iterations does not match the performance of pretrained condition after 100, 000 iterations. Out-of-domain testing does not approach pretrained levels of performance. Faint, dashed lines are backwards projecting from lowest from scratch performance to aid in visualization. B: Same as A but using $50 \\%$ of the training data. Test errors when training from scratch closely match the transfer learning performance after many iterations. Crucially, out-of-domain testing does not approach performance for pretrained network. "
394
+ ],
395
+ "image_footnote": [],
396
+ "bbox": [
397
+ 179,
398
+ 98,
399
+ 820,
400
+ 294
401
+ ],
402
+ "page_idx": 5
403
+ },
404
+ {
405
+ "type": "text",
406
+ "text": "",
407
+ "bbox": [
408
+ 174,
409
+ 464,
410
+ 825,
411
+ 520
412
+ ],
413
+ "page_idx": 5
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "For all the network analysis so far, we trained for 100, 000 iterations (as the loss had relatively flattened), therefore we trained $6 X$ longer to see if test/training errors would decrease. Indeed, consistent with He et al. 2018, we found that randomly initialized networks could closely match the performance of pretrained networks, given enough data and time (Figure 5A, B); for smaller datasets $( 5 \\%$ training data), this was not the case (Figure 5A), again suggesting that pretrained-networks offer an advantage for small datasets, which is particularly important for applications in biology (Mathis et al., 2018). ",
418
+ "bbox": [
419
+ 174,
420
+ 526,
421
+ 825,
422
+ 625
423
+ ],
424
+ "page_idx": 5
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "Crucially, and most strikingly, for out-of-domain data this was not the case: the from-scratch trained networks never caught up (and indeed plateaued early; Figure 5A, B). Thus, transfer learning offers multiple advantages. Not only does pretraining networks on ImageNet allow for using smaller datasets and shorter training time, it also significantly improves robustness. ",
429
+ "bbox": [
430
+ 176,
431
+ 632,
432
+ 825,
433
+ 688
434
+ ],
435
+ "page_idx": 5
436
+ },
437
+ {
438
+ "type": "text",
439
+ "text": "3 DISCUSSION ",
440
+ "text_level": 1,
441
+ "bbox": [
442
+ 176,
443
+ 709,
444
+ 310,
445
+ 726
446
+ ],
447
+ "page_idx": 5
448
+ },
449
+ {
450
+ "type": "text",
451
+ "text": "Here we report two key findings: (1) pretrained-ImageNet networks offer an advantage: shorter training times, less data requirements, and robustness on out-of-domain data, and (2) networks that have higher ImageNet performance lead to better generalization, especially on out-of-domain data. Recently, it was shown that for many object recognition datasets the transfer ability is improved when fine-tuning architectures with better ImageNet performance (Kornblith et al., 2019; Huh et al., 2016). In fact, Kornblith et al. (2019) find high correlation between between ImageNet and transfer accuracy for other recognition tasks $( r > 0 . 9 5 )$ ). In contrast to the exhaustive study by Kornblith et al., we only focused on two architecture types: ResNets (He et al., 2016) and MobileNetV2s (Sandler et al., 2018). However, we vary parameters of those networks to also span a broad range of ImageNet accuracies. Consistent with Kornblith et al, we find that ImageNet accuracy is weakly correlated with performance on pose estimation when trained from scratch $R ^ { 2 } = 0 . 5 \\dot { 3 }$ ), and strongly when fine-tuning $R ^ { 2 } = 0 . 9 5 )$ . We also find that “better” ImageNet networks transfer better. Moreover, we show that transfer learning significantly improves performance on out-of-domain data. ",
452
+ "bbox": [
453
+ 174,
454
+ 743,
455
+ 825,
456
+ 924
457
+ ],
458
+ "page_idx": 5
459
+ },
460
+ {
461
+ "type": "image",
462
+ "img_path": "images/0c86f831246d9acabf504ef5ee319c5f340f85fe9ad114ffa2ede2ceaabc8e10.jpg",
463
+ "image_caption": [
464
+ "Figure 6: Summary of Findings: We present a new horse dataset for testing within and out-ofdomain performance for pose estimation. We tested two classes of models, MobileNetV2s and ResNets, which span a wide range of performance on ImageNet. We find that networks that perform better on ImageNet are better for pose estimation. We also find that pretrained-ImageNet models strongly improve out-of-domain robustness. "
465
+ ],
466
+ "image_footnote": [],
467
+ "bbox": [
468
+ 173,
469
+ 103,
470
+ 823,
471
+ 262
472
+ ],
473
+ "page_idx": 6
474
+ },
475
+ {
476
+ "type": "text",
477
+ "text": "3.1 TRANSFER LEARNING ",
478
+ "text_level": 1,
479
+ "bbox": [
480
+ 176,
481
+ 378,
482
+ 366,
483
+ 392
484
+ ],
485
+ "page_idx": 6
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "We show that for both within and out-of-domain pose estimation tasks, transfer learning improves performance. Most notably, transfer learning boosts out-of-domain generalization, improving up to $3 X$ compared to networks without pretraining, and even when training for much longer, as suggested in He et al. (2018), this gap cannot be closed. ",
490
+ "bbox": [
491
+ 174,
492
+ 405,
493
+ 825,
494
+ 460
495
+ ],
496
+ "page_idx": 6
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "Another important insight is that for small amounts of data, pretrained networks offer a large advantage (Figures 4 & 5). Corroborating He et al. (2018) we find that given enough training data, training from scratch, with purely task-driven training can match the performance of of transfer learning; however, we also found that for out-of-domain data, pretraining helps significantly, boosting performance up to 3 times (Figure 4). ",
501
+ "bbox": [
502
+ 174,
503
+ 468,
504
+ 823,
505
+ 537
506
+ ],
507
+ "page_idx": 6
508
+ },
509
+ {
510
+ "type": "text",
511
+ "text": "3.2 ON THE IMPORTANCE OF DATA ",
512
+ "text_level": 1,
513
+ "bbox": [
514
+ 178,
515
+ 555,
516
+ 426,
517
+ 569
518
+ ],
519
+ "page_idx": 6
520
+ },
521
+ {
522
+ "type": "text",
523
+ "text": "Looking forward, this suggests that collecting annotations of task data (instead of pretraining data) is more useful. We think that benchmarks with different contexts, like Horse-10, are important to improve pose estimation algorithms for biological applications (i.e. for small-scale lab-based experiments). A future goal will be to limit, or remove, training altogether. However, in order to create networks that generalize across laboratories and setups, transfer learning will be important for robustness. Yet, more work needs to be done to close the gap between within domain and outof-domain generalization. ",
524
+ "bbox": [
525
+ 174,
526
+ 580,
527
+ 825,
528
+ 678
529
+ ],
530
+ "page_idx": 6
531
+ },
532
+ {
533
+ "type": "text",
534
+ "text": "What is the limit of transfer learning? Would ever larger data sets give better generalization? Interestingly, it appears to strongly depend on what task the network was pretrained on. Recent work by Mahajan et al. (2018) showed that pretraining for large-scale hashtag predictions on Instagram data (3.5 billion images) improves classification, while at the same time possibly harming localization performance for tasks like object detection, instance segmentation, and keypoint detection. This highlights the importance of the task, rather then the sheer size as a crucial factor. Further corroborating this insight, Li et al. showed that pretraining on large-scale object detection task can improve performance for tasks that require fine, spatial information like segmentation (Li et al., 2019). Thus, one interesting future direction to boost robustness could be to utilize networks pretrained on OpenImages, which contains bounding boxes for 15 million instances and close to 2 million images (Kuznetsova et al., 2018). ",
535
+ "bbox": [
536
+ 174,
537
+ 685,
538
+ 825,
539
+ 838
540
+ ],
541
+ "page_idx": 6
542
+ },
543
+ {
544
+ "type": "text",
545
+ "text": "3.3 MOBILENETV2 FOR FAST POSE ESTIMATION ",
546
+ "text_level": 1,
547
+ "bbox": [
548
+ 174,
549
+ 856,
550
+ 524,
551
+ 869
552
+ ],
553
+ "page_idx": 6
554
+ },
555
+ {
556
+ "type": "text",
557
+ "text": "Here, we introduce using MobileNetV2 variants for animal pose estimation that can achieve high accuracy but with $2 . 5 X$ the speed as a ResNet backbone (Figure 10), making pretrained-MobileNetV2 an excellent option for real-time applications in the wild (on mobile-phones) and in the laboratory. ",
558
+ "bbox": [
559
+ 176,
560
+ 882,
561
+ 823,
562
+ 924
563
+ ],
564
+ "page_idx": 6
565
+ },
566
+ {
567
+ "type": "text",
568
+ "text": "If an end-user utilizes small training sets, ResNets offer an advantage, yet MobileNetV2s are significantly faster (Figure 10) and performs reasonably well, within domain; i.e. to match the ResNet-101 performance with $1 0 \\%$ of the training set one needs about $5 0 \\%$ for the best MobileNetV2. Potentially, the few pixels lost in accuracy is worth the significant speed improvement (twice as fast) for high-throughput experiments and for real-time applications. MobileNetV2 can run batch inference of $( > 2 , 5 0 0 F P S )$ on a GPU. Using MobileNetV2 also has other advantages: one, MobileNetV2 has low memory demands, and even runs on mobile phones, as the name suggests; two: on CPUs one gets even more speed improvements (Figure 10). ",
569
+ "bbox": [
570
+ 174,
571
+ 103,
572
+ 825,
573
+ 215
574
+ ],
575
+ "page_idx": 7
576
+ },
577
+ {
578
+ "type": "text",
579
+ "text": "What are the trade-offs? With more data for training the MobileNetV2 match the performance of ResNets trained with less labeling data (Figure 2B). However, the ResNets still perform best with matched amounts of data. Thus, to close this gap “Student-Teacher networks” could be used. For example, one could build a larger and more robust ResNet-101 network, then run inference to generate a larger dataset to train the MobileNetV2 variant for fast inference on within domain data. ",
580
+ "bbox": [
581
+ 174,
582
+ 222,
583
+ 825,
584
+ 291
585
+ ],
586
+ "page_idx": 7
587
+ },
588
+ {
589
+ "type": "text",
590
+ "text": "4 CONCLUSIONS ",
591
+ "text_level": 1,
592
+ "bbox": [
593
+ 176,
594
+ 313,
595
+ 328,
596
+ 328
597
+ ],
598
+ "page_idx": 7
599
+ },
600
+ {
601
+ "type": "text",
602
+ "text": "We found a significant advantage of using pretrained networks for out-of-domain robustness. While there is still a gap to close, we believe this work demonstrates that transfer learning approaches are powerful to build robust architectures. We also demonstrate that ImageNet performance correlates with animal pose estimation accuracy on a challenging “in-the-wild” new horse dataset (Figure 6). Moreover, we aim to add a new variant of networks to the open-source DeepLabCut project, MobileNetV2s, that pave the way for fast and accurate pose estimation. Collectively, our work highlights that pretrained networks require less training data, and allow for faster training, and boost robustness, especially for out-of-domain data. ",
603
+ "bbox": [
604
+ 174,
605
+ 343,
606
+ 825,
607
+ 455
608
+ ],
609
+ "page_idx": 7
610
+ },
611
+ {
612
+ "type": "text",
613
+ "text": "5 METHODS ",
614
+ "text_level": 1,
615
+ "bbox": [
616
+ 174,
617
+ 474,
618
+ 290,
619
+ 491
620
+ ],
621
+ "page_idx": 7
622
+ },
623
+ {
624
+ "type": "text",
625
+ "text": "5.1 HORSE DATASET ",
626
+ "text_level": 1,
627
+ "bbox": [
628
+ 176,
629
+ 506,
630
+ 333,
631
+ 520
632
+ ],
633
+ "page_idx": 7
634
+ },
635
+ {
636
+ "type": "text",
637
+ "text": "Here we developed a novel horse data set comprising 30 different horses captured for $4 - 1 0$ seconds with a GoPro camera (Resolution: $1 9 2 0 \\times 1 0 8 0$ , Frame Rate: 60 FPS), which we call Horse-30. We used the DeepLabCut2.0 toolbox (Nath et al., 2019) for labeling. We downsampled the frames by a factor of $1 5 \\%$ to speed-up the benchmarking process ( $2 8 8 \\times 1 6 2$ pixels; one video was downsampled to $3 0 \\%$ ). ",
638
+ "bbox": [
639
+ 174,
640
+ 532,
641
+ 825,
642
+ 602
643
+ ],
644
+ "page_idx": 7
645
+ },
646
+ {
647
+ "type": "text",
648
+ "text": "Using previously established anatomical landmarks for equine biomechanical evaluation (Magnusson & Thafvellin, 1990; Anderson & McIlwraith, 2004), the following 22 body parts were labeled by an expert in Thoroughbred horses [BR] across 8, 114 frames: Nose, Eye, Nearknee, Nearfrontfetlock, Nearfrontfoot, Offknee, Offfrontfetlock, Offfrontfoot, Shoulder, Midshoulder, Elbow, Girth, Wither, Nearhindhock, Nearhindfetlock, Nearhindfoot, Hip, Stifle, Offhindhock, Offhindfetlock, Offhindfoot, Ischium. ",
649
+ "bbox": [
650
+ 174,
651
+ 609,
652
+ 823,
653
+ 693
654
+ ],
655
+ "page_idx": 7
656
+ },
657
+ {
658
+ "type": "text",
659
+ "text": "We created 3 splits that contain 10 randomly selected training horses each (referred to as Horse-10). For each training set we took a subset of $5 \\%$ $\\approx 1 6 0$ frames), $1 0 \\%$ $\\approx 3 0 0$ frames), $2 0 \\%$ $\\approx 5 6 0$ frames), $5 0 \\%$ $\\approx 1 4 7 0$ frames), and $9 0 \\%$ $\\approx 2 5 8 0$ frames) of the frames for training, and then evaluated the performance on the training, test, and unseen (“out-of-domain”) horses (i.e. the other horses that are in Horse-30, but were not in the given split of Horse-10). As metric we used mean average Euclidean error, which is computed by comparing the inferred poses for each body parts against the human prediction as well as percent correct key-point (PCK) values; i.e. what fraction of machine-applied points fall within a specific range of human-labeled ground-truth labels; although we use a matching threshold of $3 0 \\%$ of the head segment length (nose to eye for horse, which was computed by taking the median for all annotated images per horse) rather than $5 0 \\%$ as for MPII pose (Andriluka et al., 2014). ",
660
+ "bbox": [
661
+ 174,
662
+ 699,
663
+ 825,
664
+ 852
665
+ ],
666
+ "page_idx": 7
667
+ },
668
+ {
669
+ "type": "text",
670
+ "text": "5.2 NETWORK VARIANTS ",
671
+ "text_level": 1,
672
+ "bbox": [
673
+ 176,
674
+ 869,
675
+ 362,
676
+ 883
677
+ ],
678
+ "page_idx": 7
679
+ },
680
+ {
681
+ "type": "text",
682
+ "text": "For this study we utilized a recently introduced an animal pose estimation toolbox called DeepLabCut (Mathis et al., 2018; Mathis & Warren, 2018; Nath et al., 2019). The TensorFlow-based network architectures could be easily exchanged while keeping data loading, training, and evaluation consistent. ",
683
+ "bbox": [
684
+ 174,
685
+ 895,
686
+ 823,
687
+ 922
688
+ ],
689
+ "page_idx": 7
690
+ },
691
+ {
692
+ "type": "text",
693
+ "text": "",
694
+ "bbox": [
695
+ 173,
696
+ 103,
697
+ 821,
698
+ 132
699
+ ],
700
+ "page_idx": 8
701
+ },
702
+ {
703
+ "type": "text",
704
+ "text": "DeepLabCut (Mathis et al., 2018; Nath et al., 2019) is built on a subset of the deep feature detectors in DeeperCut (Insafutdinov et al., 2016). The feature detectors in DeepLabCut consist of residual networks (ResNets) (He et al., 2016) followed by deconvolutional layers to predict pose scoremaps and location refinement maps, which can then be used for predicting the pose while also proving a confidence score (Insafutdinov et al., 2016; Mathis et al., 2018). We utilize an output stride of 16 for the ResNets (achieved by atrous convolution) and then upsample the filter banks with deconvolutions by a factor of two to predict the heatmaps and location-refinement at 1/8th of the original image size scale. This gives a good balance of feature-map size and accuracy. However, the ratio can, of course, be changed and this affects speed, while still being relatively robust (Insafutdinov et al., 2016). ",
705
+ "bbox": [
706
+ 174,
707
+ 138,
708
+ 825,
709
+ 263
710
+ ],
711
+ "page_idx": 8
712
+ },
713
+ {
714
+ "type": "text",
715
+ "text": "Here we also introduce a MobileNetV2 architecture that could be used within DeepLabCut (Sandler et al., 2018). MobileNetV2 utilizes depth-wise separable convolutions, inverted residual bottlenecks to significantly decrease the number of operations and memory needed while retaining high accuracy for ImageNet, object detection and image segmentation accuracy (Sandler et al., 2018). We configured the output-stride as 16 (by changing the (otherwise) last stride 2 convolution to stride 1). We utilized four variants of MobileNetV2 with different expansion ratios (0.35, 0.5, 0.75 and 1) as this ratio modulates the ImageNet accuracy from $6 0 . 3 \\%$ to $7 1 . 8 \\%$ , and pretrained models on ImageNet are available from TensorFlow (Abadi et al., 2016). ",
716
+ "bbox": [
717
+ 174,
718
+ 271,
719
+ 825,
720
+ 382
721
+ ],
722
+ "page_idx": 8
723
+ },
724
+ {
725
+ "type": "text",
726
+ "text": "5.3 NETWORK TRAINING PARAMETERS ",
727
+ "text_level": 1,
728
+ "bbox": [
729
+ 176,
730
+ 402,
731
+ 460,
732
+ 415
733
+ ],
734
+ "page_idx": 8
735
+ },
736
+ {
737
+ "type": "text",
738
+ "text": "Most training parameters used here are consistent with the ones reported in DeepLabCut-2.0. (Nath et al., 2019). The training loss is defined as the cross entropy loss for the scoremaps and the location refinement error via a Huber loss with weight 0.05; it is minimized via stochastic gradient descent with batch size 1 (Insafutdinov et al., 2016; Mathis et al., 2018). We use the following training schedule: 0.005 for the first $1 0 k$ iterations then 0.02 onwards. For training from scratch, we had to start with a lower learning rate to avoid divergence of the loss and used $\\bar { 1 } 0 ^ { - 6 }$ for the first 5, 000 steps, then $1 0 ^ { - 4 }$ for the next $2 0 k$ , followed by 0.02. We always trained for $1 0 0 k$ iterations, unless noted. When training up to $6 0 0 k$ iterations, we changed to 0.002 after $4 3 0 k$ iterations (as it is default for DeepLabCut). ",
739
+ "bbox": [
740
+ 174,
741
+ 428,
742
+ 825,
743
+ 553
744
+ ],
745
+ "page_idx": 8
746
+ },
747
+ {
748
+ "type": "text",
749
+ "text": "Speed Benchmarking ",
750
+ "text_level": 1,
751
+ "bbox": [
752
+ 174,
753
+ 568,
754
+ 313,
755
+ 582
756
+ ],
757
+ "page_idx": 8
758
+ },
759
+ {
760
+ "type": "text",
761
+ "text": "Using an example from the horse dataset we evaluated one video with 11, 178 frames at resolutions $5 1 2 \\times 5 1 2$ , $2 5 6 \\times 2 5 6$ and $1 2 8 \\times 1 2 8$ . We used batch sizes: $[ 1 , 2 , 4 , 1 6 , 3 2 , 1 2 8 , 2 5 6 , 5 1 2 ]$ , and ran all models for all 3 (training set shuffles) trained with $5 0 \\%$ of the data in a pseudo random order on an NVIDIA Titan RTX. For the benchmarking on a CPU we used shortened videos with merely 728 frames; the CPU was an Intel Xeon CPU E5-2603 v4 $@$ 1.70GHz with 6 cores. We also changed the inference code from its numpy implementation (Mathis & Warren, 2018) to TensorFlow, which brings a $2 - 1 0 \\%$ gain in speed. ",
762
+ "bbox": [
763
+ 174,
764
+ 597,
765
+ 825,
766
+ 695
767
+ ],
768
+ "page_idx": 8
769
+ },
770
+ {
771
+ "type": "text",
772
+ "text": "REFERENCES ",
773
+ "text_level": 1,
774
+ "bbox": [
775
+ 176,
776
+ 718,
777
+ 285,
778
+ 733
779
+ ],
780
+ "page_idx": 8
781
+ },
782
+ {
783
+ "type": "text",
784
+ "text": "Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: a system for largescale machine learning. In OSDI, volume 16, pp. 265–283, 2016. \nRıza Alp Guler, Natalia Neverova, and Iasonas Kokkinos. Densepose: Dense human pose estimation ¨ in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7297–7306, 2018. \nD. J. Anderson and P. Perona. Toward a science of computational ethology. Neuron, 84(1):18–31, Oct 2014. URL https://doi.org/10.1016/j.neuron.2014.09.005. \nTM Anderson and CW McIlwraith. Longitudinal development of equine conformation from weanling to age 3 years in the thoroughbred. Equine veterinary journal, 36(7):563–570, 2004. ",
785
+ "bbox": [
786
+ 171,
787
+ 742,
788
+ 826,
789
+ 924
790
+ ],
791
+ "page_idx": 8
792
+ },
793
+ {
794
+ "type": "text",
795
+ "text": "Mykhaylo Andriluka, Leonid Pishchulin, Peter Gehler, and Bernt Schiele. 2d human pose estimation: New benchmark and state of the art analysis. In Proceedings of the IEEE Conference on computer Vision and Pattern Recognition, pp. 3686–3693, 2014. URL http: //ieeexplore.ieee.org/document/6909866/. ",
796
+ "bbox": [
797
+ 174,
798
+ 103,
799
+ 823,
800
+ 160
801
+ ],
802
+ "page_idx": 9
803
+ },
804
+ {
805
+ "type": "text",
806
+ "text": "Mykhaylo Andriluka, Umar Iqbal, Eldar Insafutdinov, Leonid Pishchulin, Anton Milan, Juergen Gall, and Bernt Schiele. Posetrack: A benchmark for human pose estimation and tracking. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5167– 5176, 2018. ",
807
+ "bbox": [
808
+ 173,
809
+ 171,
810
+ 825,
811
+ 227
812
+ ],
813
+ "page_idx": 9
814
+ },
815
+ {
816
+ "type": "text",
817
+ "text": "Zhe Cao, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Realtime multi-person 2d pose estimation using part affinity fields. In CVPR, 2017. ",
818
+ "bbox": [
819
+ 171,
820
+ 238,
821
+ 823,
822
+ 267
823
+ ],
824
+ "page_idx": 9
825
+ },
826
+ {
827
+ "type": "text",
828
+ "text": "Qi Dang, Jianqin Yin, Bin Wang, and Wenqing Zheng. Deep learning based 2d human pose estimation: A survey. Tsinghua Science and Technology, 24(6):663–676, Dec 2019. ISSN 1007-0214. doi: 10.26599/TST.2018.9010100. ",
829
+ "bbox": [
830
+ 174,
831
+ 277,
832
+ 823,
833
+ 320
834
+ ],
835
+ "page_idx": 9
836
+ },
837
+ {
838
+ "type": "text",
839
+ "text": "Carl Doersch and Andrew Zisserman. Sim2real transfer learning for 3d pose estimation: motion to the rescue. CoRR, abs/1907.02499, 2019. URL http://arxiv.org/abs/1907.02499. ",
840
+ "bbox": [
841
+ 174,
842
+ 332,
843
+ 821,
844
+ 361
845
+ ],
846
+ "page_idx": 9
847
+ },
848
+ {
849
+ "type": "text",
850
+ "text": "Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. DeCaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning, pp. 647–655, 2014. URL https://arxiv.org/ abs/1310.1531. ",
851
+ "bbox": [
852
+ 173,
853
+ 371,
854
+ 825,
855
+ 429
856
+ ],
857
+ "page_idx": 9
858
+ },
859
+ {
860
+ "type": "text",
861
+ "text": "Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. URL https://arxiv.org/abs/1512.03385. ",
862
+ "bbox": [
863
+ 174,
864
+ 439,
865
+ 821,
866
+ 483
867
+ ],
868
+ "page_idx": 9
869
+ },
870
+ {
871
+ "type": "text",
872
+ "text": "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. ",
873
+ "bbox": [
874
+ 169,
875
+ 492,
876
+ 823,
877
+ 522
878
+ ],
879
+ "page_idx": 9
880
+ },
881
+ {
882
+ "type": "text",
883
+ "text": "Kaiming He, Ross Girshick, and Piotr Dollar. Rethinking imagenet pre-training. ´ arXiv preprint arXiv:1811.08883, 2018. ",
884
+ "bbox": [
885
+ 173,
886
+ 532,
887
+ 823,
888
+ 561
889
+ ],
890
+ "page_idx": 9
891
+ },
892
+ {
893
+ "type": "text",
894
+ "text": "Oskar Heinroth and Magdalena Wiebe Heinroth. Die Vogel Mitteleuropas: in allen Lebens-und ¨ Entwicklungsstufen photographisch aufgenommen und in ihrem Seelenleben bei der Aufzucht vom Ei ab beobachtet, volume 1. Edition Leipzig, 1966. ",
895
+ "bbox": [
896
+ 173,
897
+ 571,
898
+ 826,
899
+ 616
900
+ ],
901
+ "page_idx": 9
902
+ },
903
+ {
904
+ "type": "text",
905
+ "text": "Minyoung Huh, Pulkit Agrawal, and Alexei A Efros. What makes imagenet good for transfer learning? arXiv preprint arXiv:1608.08614, 2016. ",
906
+ "bbox": [
907
+ 169,
908
+ 626,
909
+ 823,
910
+ 656
911
+ ],
912
+ "page_idx": 9
913
+ },
914
+ {
915
+ "type": "text",
916
+ "text": "Auke J Ijspeert. Biorobotics: Using robots to emulate and investigate agile locomotion. science, 346(6206):196–203, 2014. ",
917
+ "bbox": [
918
+ 169,
919
+ 666,
920
+ 823,
921
+ 695
922
+ ],
923
+ "page_idx": 9
924
+ },
925
+ {
926
+ "type": "text",
927
+ "text": "Eldar Insafutdinov, Leonid Pishchulin, Bjoern Andres, Mykhaylo Andriluka, and Bernt Schiele. DeeperCut: A deeper, stronger, and faster multi-person pose estimation model. In European Conference on Computer Vision, pp. 34–50. Springer, 2016. URL https://arxiv.org/ abs/1605.03170. ",
928
+ "bbox": [
929
+ 174,
930
+ 705,
931
+ 825,
932
+ 762
933
+ ],
934
+ "page_idx": 9
935
+ },
936
+ {
937
+ "type": "text",
938
+ "text": "Eldar Insafutdinov, Mykhaylo Andriluka, Leonid Pishchulin, Siyu Tang, Evgeny Levinkov, Bjoern Andres, and Bernt Schiele. Arttrack: Articulated multi-person tracking in the wild. In CVPR’17, 2017. URL http://arxiv.org/abs/1612.01465. ",
939
+ "bbox": [
940
+ 173,
941
+ 773,
942
+ 826,
943
+ 816
944
+ ],
945
+ "page_idx": 9
946
+ },
947
+ {
948
+ "type": "text",
949
+ "text": "Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2661– 2671, 2019. ",
950
+ "bbox": [
951
+ 174,
952
+ 827,
953
+ 823,
954
+ 869
955
+ ],
956
+ "page_idx": 9
957
+ },
958
+ {
959
+ "type": "text",
960
+ "text": "Sven Kreiss, Lorenzo Bertoni, and Alexandre Alahi. Pifpaf: Composite fields for human pose estimation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 11977–11986, 2019. ",
961
+ "bbox": [
962
+ 174,
963
+ 882,
964
+ 825,
965
+ 924
966
+ ],
967
+ "page_idx": 9
968
+ },
969
+ {
970
+ "type": "text",
971
+ "text": "Matthias Kummerer, Thomas SA Wallis, and Matthias Bethge. Deepgaze ii: Reading fixations ¨ from deep features trained on object recognition. arXiv preprint arXiv:1610.01563, 2016. URL https://arxiv.org/abs/1610.01563. ",
972
+ "bbox": [
973
+ 174,
974
+ 103,
975
+ 823,
976
+ 146
977
+ ],
978
+ "page_idx": 10
979
+ },
980
+ {
981
+ "type": "text",
982
+ "text": "Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Uijlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Tom Duerig, et al. The open images dataset v4: Unified image classification, object detection, and visual relationship detection at scale. arXiv preprint arXiv:1811.00982, 2018. ",
983
+ "bbox": [
984
+ 174,
985
+ 155,
986
+ 825,
987
+ 210
988
+ ],
989
+ "page_idx": 10
990
+ },
991
+ {
992
+ "type": "text",
993
+ "text": "Hengduo Li, Bharat Singh, Mahyar Najibi, Zuxuan Wu, and Larry S Davis. An analysis of pretraining on object detection. arXiv preprint arXiv:1904.05871, 2019. ",
994
+ "bbox": [
995
+ 171,
996
+ 220,
997
+ 821,
998
+ 250
999
+ ],
1000
+ "page_idx": 10
1001
+ },
1002
+ {
1003
+ "type": "text",
1004
+ "text": "Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014. ",
1005
+ "bbox": [
1006
+ 174,
1007
+ 258,
1008
+ 825,
1009
+ 301
1010
+ ],
1011
+ "page_idx": 10
1012
+ },
1013
+ {
1014
+ "type": "text",
1015
+ "text": "Lars-Erik Magnusson and B Thafvellin. Studies on the conformation and related traits of standardbred trotters in sweden. Journal of Animal Physiology and Animal Nutrition (Germany, FR), 1990. ",
1016
+ "bbox": [
1017
+ 174,
1018
+ 310,
1019
+ 825,
1020
+ 353
1021
+ ],
1022
+ "page_idx": 10
1023
+ },
1024
+ {
1025
+ "type": "text",
1026
+ "text": "Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 181– 196, 2018. ",
1027
+ "bbox": [
1028
+ 174,
1029
+ 362,
1030
+ 825,
1031
+ 419
1032
+ ],
1033
+ "page_idx": 10
1034
+ },
1035
+ {
1036
+ "type": "text",
1037
+ "text": "William A Mason and Dale F Lott. Ethology and comparative psychology. Annual Review of Psychology, 27(1):129–154, 1976. ",
1038
+ "bbox": [
1039
+ 171,
1040
+ 428,
1041
+ 823,
1042
+ 458
1043
+ ],
1044
+ "page_idx": 10
1045
+ },
1046
+ {
1047
+ "type": "text",
1048
+ "text": "A Mathis, P Mamidanna, KM Cury, T Abe, VN Murthy, MW Mathis, and M Bethge. Deeplabcut: markerless pose estimation of user-defined body parts with deep learning. Nature Neuroscience, 21(9):1281–1289, 2018. ",
1049
+ "bbox": [
1050
+ 173,
1051
+ 465,
1052
+ 823,
1053
+ 508
1054
+ ],
1055
+ "page_idx": 10
1056
+ },
1057
+ {
1058
+ "type": "text",
1059
+ "text": "Alexander Mathis and Richard A. Warren. On the inference speed and video-compression robustness of deeplabcut. BioRxiv, 2018. doi: 10.1101/457242. URL https://doi.org/10.1101/ 457242. ",
1060
+ "bbox": [
1061
+ 173,
1062
+ 518,
1063
+ 823,
1064
+ 560
1065
+ ],
1066
+ "page_idx": 10
1067
+ },
1068
+ {
1069
+ "type": "text",
1070
+ "text": "Dushyant Mehta, Helge Rhodin, Dan Casas, Oleksandr Sotnychenko, Weipeng Xu, and Christian Theobalt. Monocular 3d human pose estimation using transfer learning and improved cnn supervision. ArXiv, abs/1611.09813, 2016. ",
1071
+ "bbox": [
1072
+ 174,
1073
+ 570,
1074
+ 825,
1075
+ 613
1076
+ ],
1077
+ "page_idx": 10
1078
+ },
1079
+ {
1080
+ "type": "text",
1081
+ "text": "Franziska Mueller, Florian Bernard, Oleksandr Sotnychenko, Dushyant Mehta, Srinath Sridhar, Dan Casas, and Christian Theobalt. Ganerated hands for real-time 3d hand tracking from monocular RGB. CoRR, abs/1712.01057, 2017. URL http://arxiv.org/abs/1712.01057. ",
1082
+ "bbox": [
1083
+ 174,
1084
+ 622,
1085
+ 825,
1086
+ 665
1087
+ ],
1088
+ "page_idx": 10
1089
+ },
1090
+ {
1091
+ "type": "text",
1092
+ "text": "Tanmay Nath, Alexander Mathis, An Chi Chen, Amir Patel, Matthias Bethge, and Mackenzie Weygandt Mathis. Using deeplabcut for 3d markerless pose estimation across species and behaviors. Nature Protocols, 14:2152–2176, 2019. ",
1093
+ "bbox": [
1094
+ 173,
1095
+ 674,
1096
+ 825,
1097
+ 717
1098
+ ],
1099
+ "page_idx": 10
1100
+ },
1101
+ {
1102
+ "type": "text",
1103
+ "text": "David Novotny, Diane Larlus, and Andrea Vedaldi. Anchornet: A weakly supervised network to learn geometry-sensitive features for semantic matching. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5277–5286, 2017. ",
1104
+ "bbox": [
1105
+ 173,
1106
+ 726,
1107
+ 823,
1108
+ 768
1109
+ ],
1110
+ "page_idx": 10
1111
+ },
1112
+ {
1113
+ "type": "text",
1114
+ "text": "Helge Rhodin, Jorg Sp ¨ orri, Isinsu Katircioglu, Victor Constantin, Fr ¨ ed´ eric Meyer, Erich M ´ uller, ¨ Mathieu Salzmann, and Pascal Fua. Learning monocular 3d human pose estimation from multiview images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8437–8446, 2018. ",
1115
+ "bbox": [
1116
+ 173,
1117
+ 777,
1118
+ 825,
1119
+ 834
1120
+ ],
1121
+ "page_idx": 10
1122
+ },
1123
+ {
1124
+ "type": "text",
1125
+ "text": "Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510–4520, 2018. ",
1126
+ "bbox": [
1127
+ 173,
1128
+ 843,
1129
+ 821,
1130
+ 886
1131
+ ],
1132
+ "page_idx": 10
1133
+ },
1134
+ {
1135
+ "type": "text",
1136
+ "text": "Ke Sun, Bin Xiao, Dong Liu, and Jingdong Wang. Deep high-resolution representation learning for human pose estimation. arXiv preprint arXiv:1902.09212, 2019. ",
1137
+ "bbox": [
1138
+ 174,
1139
+ 895,
1140
+ 821,
1141
+ 924
1142
+ ],
1143
+ "page_idx": 10
1144
+ },
1145
+ {
1146
+ "type": "text",
1147
+ "text": "Bin Xiao, Haiping Wu, and Yichen Wei. Simple baselines for human pose estimation and tracking. CoRR, abs/1804.06208, 2018. URL http://arxiv.org/abs/1804.06208. ",
1148
+ "bbox": [
1149
+ 174,
1150
+ 103,
1151
+ 823,
1152
+ 132
1153
+ ],
1154
+ "page_idx": 11
1155
+ },
1156
+ {
1157
+ "type": "text",
1158
+ "text": "Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014. ",
1159
+ "bbox": [
1160
+ 174,
1161
+ 141,
1162
+ 823,
1163
+ 170
1164
+ ],
1165
+ "page_idx": 11
1166
+ },
1167
+ {
1168
+ "type": "text",
1169
+ "text": "A APPENDIX ",
1170
+ "bbox": [
1171
+ 174,
1172
+ 196,
1173
+ 299,
1174
+ 212
1175
+ ],
1176
+ "page_idx": 11
1177
+ },
1178
+ {
1179
+ "type": "image",
1180
+ "img_path": "images/8d746d88abc55d3007e9333e4c5b828444df5c75efe3706d696735fa3c13d361.jpg",
1181
+ "image_caption": [
1182
+ "Figure 7: Example frames with human and pretrained network annotations. Here we show the smallest networks, namely ResNet-50 and the ultra-lightweight MobileNetV2-0.35, trained for 100, 000 iterations. Top Left set: example training images. Top Right: within domain test image results. Bottom: out-of-domain horses. Examples illustrate the challenges: varying coat colors, size changes, background, human legs, various postures, background horses, and partially occluded horses while they walk in and out of the video frames. "
1183
+ ],
1184
+ "image_footnote": [],
1185
+ "bbox": [
1186
+ 171,
1187
+ 223,
1188
+ 826,
1189
+ 704
1190
+ ],
1191
+ "page_idx": 11
1192
+ },
1193
+ {
1194
+ "type": "image",
1195
+ "img_path": "images/24e621bdebdbc97f555e240f2bc8947c5539271b8087c3720855e3e1118cc175.jpg",
1196
+ "image_caption": [
1197
+ "Figure 8: Transfer Learning boosts accuracy (PCK). A: Percent Correct Keypoint (PCK) vs. Training Set Fraction shows high performance for all networks on Horse-10. Darker to light red shades are test results for pretrained networks: ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35. Darker to lighter blue is for training, the same ordering as in test. All lines are averages of 3 splits (see Methods). B: Same as in A, plus the out-of-domain data (pink is for out-of-domain data on 20 unseen horses). C: Same as in B, but without pretraining on ImageNet. "
1198
+ ],
1199
+ "image_footnote": [],
1200
+ "bbox": [
1201
+ 176,
1202
+ 145,
1203
+ 823,
1204
+ 329
1205
+ ],
1206
+ "page_idx": 12
1207
+ },
1208
+ {
1209
+ "type": "image",
1210
+ "img_path": "images/594b9db788576f6a1c41b43223914f86854e6594adee1824a2ecc8ab8b0267f6.jpg",
1211
+ "image_caption": [
1212
+ "Figure 9: Test and training performance when training from scratch.) A: Normalized Error vs. Training Set Fraction of Horse-10. $5 \\%$ is $\\approx ~ 1 6 0$ frames. Darker to light red shades are test results for ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35. Darker to lighter blue is for training, same ordering as in test. B: Normalized Error vs. Network performance as ranked by the Top $1 \\%$ accuracy on ImageNet, but here on Horse-10; namely, MobileNetV2-0.35, MobileNetV2-0.5, MobileNetV2-.75, MobileNetV2-1, ResNet-50, ResNet-101. Test data is in red, train is blue. This data is for $5 0 \\%$ training set fraction. "
1213
+ ],
1214
+ "image_footnote": [],
1215
+ "bbox": [
1216
+ 240,
1217
+ 560,
1218
+ 748,
1219
+ 755
1220
+ ],
1221
+ "page_idx": 12
1222
+ },
1223
+ {
1224
+ "type": "image",
1225
+ "img_path": "images/ebfa3d0655a6d7c01d6622dcbabfe43f362ebab95773f43f4ec130a3f9180b70.jpg",
1226
+ "image_caption": [
1227
+ "Figure 10: Speed Benchmarking for ResNets and MobileNetV2s: Inference speed for videos of different dimensions for all the architectures. A-C: FPS vs. batchsize, with video frame sizes as stated in the title. Three splits are shown for each network. MobileNetV2 gives a more than 2X speed improvement (over ResNet-50) for offline processing and about $4 0 \\%$ for batchsize $^ { \\cdot = 1 }$ on a Titan RTX GPU. On CPU we found even larger gains. "
1228
+ ],
1229
+ "image_footnote": [],
1230
+ "bbox": [
1231
+ 220,
1232
+ 123,
1233
+ 781,
1234
+ 409
1235
+ ],
1236
+ "page_idx": 13
1237
+ },
1238
+ {
1239
+ "type": "table",
1240
+ "img_path": "images/8894b5261960372cd7b4c1da85eefee8a3c606e205a5233e69aeecf7648c09c7.jpg",
1241
+ "table_caption": [
1242
+ "Table 1: Batch size 1 (FPS): Mean inference speed for batchsize $^ { = 1 }$ and batchsize ${ } = 2 5 6$ (Table 2) for there different video frame sizes on a Titan RTX GPU. Video was $\\approx 1 1$ , 000 frames long of a horse, with 22 bodyparts to be identified. See Methods for further details. "
1243
+ ],
1244
+ "table_footnote": [],
1245
+ "table_body": "<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>128x128</td><td rowspan=1 colspan=1>256x256</td><td rowspan=1 colspan=1>512x512</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.35</td><td rowspan=1 colspan=1>195</td><td rowspan=1 colspan=1>132</td><td rowspan=1 colspan=1>65</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.50</td><td rowspan=1 colspan=1>185</td><td rowspan=1 colspan=1>131</td><td rowspan=1 colspan=1>61</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.75</td><td rowspan=1 colspan=1>185</td><td rowspan=1 colspan=1>129</td><td rowspan=1 colspan=1>55</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-1</td><td rowspan=1 colspan=1>190</td><td rowspan=1 colspan=1>132</td><td rowspan=1 colspan=1>53</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>146</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>45</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>93</td><td rowspan=1 colspan=1>69</td><td rowspan=1 colspan=1>34</td></tr></table>",
1246
+ "bbox": [
1247
+ 310,
1248
+ 604,
1249
+ 687,
1250
+ 708
1251
+ ],
1252
+ "page_idx": 13
1253
+ },
1254
+ {
1255
+ "type": "table",
1256
+ "img_path": "images/8d21159a80f25f56dcdd5a5b6b7b1c700358a26bfe75265b7ed69de790195fbc.jpg",
1257
+ "table_caption": [
1258
+ "Table 2: Batch size 256 (FPS) "
1259
+ ],
1260
+ "table_footnote": [],
1261
+ "table_body": "<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>128x128</td><td rowspan=1 colspan=1>256x256</td><td rowspan=1 colspan=1>512x512</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.35</td><td rowspan=1 colspan=1>2557</td><td rowspan=1 colspan=1>784</td><td rowspan=1 colspan=1>176</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.50</td><td rowspan=1 colspan=1>2338</td><td rowspan=1 colspan=1>711</td><td rowspan=1 colspan=1>161</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.75</td><td rowspan=1 colspan=1>2008</td><td rowspan=1 colspan=1>568</td><td rowspan=1 colspan=1>128</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-1</td><td rowspan=1 colspan=1>1834</td><td rowspan=1 colspan=1>523</td><td rowspan=1 colspan=1>118</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>1208</td><td rowspan=1 colspan=1>339</td><td rowspan=1 colspan=1>84</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>902</td><td rowspan=1 colspan=1>249</td><td rowspan=1 colspan=1>62</td></tr></table>",
1262
+ "bbox": [
1263
+ 310,
1264
+ 791,
1265
+ 686,
1266
+ 895
1267
+ ],
1268
+ "page_idx": 13
1269
+ }
1270
+ ]
parse/train/BkgMbCVFvr/BkgMbCVFvr_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/BkgMbCVFvr/BkgMbCVFvr_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HkedQp4tPr/HkedQp4tPr.md ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PARALLEL SCHEDULED SAMPLING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Auto-regressive model architectures are the workhorse of sequence generation tasks in text, images, audio, and more. These models are predominantly trained with teacher-forcing, wherein the model is encouraged to predict the next ground-truth token conditioned on all previous ground-truth tokens in the sequence. At test time, the model does not have access to ground-truth tokens and must instead condition on its own prior predictions, resulting in a train-test discrepancy known as exposure bias (Ranzato et al., 2015). Scheduled Sampling (Bengio et al., 2015) aims to mitigate exposure bias by randomly replacing some tokens with model predictions during the course of training. Unfortunately, this technique is inherently sequential and unlike teacher-forcing, cannot be trivially parallelized across time. In this paper, we introduce a simple technique to parallelize Scheduled Sampling, significantly increasing training throughput. Experimentally, we find the proposed technique leads to equivalent or better performance on image generation, summarization, dialog generation, and translation compared to teacher-forcing. In dialog response generation, Parallel Scheduled Sampling achieves a 1.6 BLEU score $( 1 1 . 5 \% )$ improvement over teacher-forcing with more than 250 times higher throughput than Scheduled Sampling. In image generation, our approach achieves $20 \%$ and $1 3 . 8 \%$ improvement in Fréchet Inception Distance (FID) and Inception Score (IS) respectively. Finally, we discuss the effects of different hyper-parameters associated with Scheduled Sampling on the model performance.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Auto-regressive models are a popular choice for generating sequences of any kind including audio (van den Oord et al., 2016b), images (van den Oord et al., 2016a), and text (Sutskever et al., 2014; Cho et al., 2014). Here, the joint probability of the sequence is factorized in a pre-determined order during train and test time. For example, auto-regressive models for text generation factorize the joint probability left-to-right. The text sequence is generated by a decoder network left-to-right, one token (word or word-piece or character) at a time and are widely used in text generation tasks such as summarization (Liu et al., 2018), machine translation (Sutskever et al., 2014) and dialog response generation (Budzianowski et al., 2018) in the encoder-decoder (Cho et al., 2014; Sutskever et al., 2014) setting. Such models are typically trained by teacher-forcing (Williams and Zipser, 1989) where ground-truth history is fed to the model as input, which at test time is replaced by the model prediction. Auto-regressive models applied in any domain suffer from this train-test time discrepancy.
12
+
13
+ Scheduled Sampling (Bengio et al., 2015) aims to mitigate the discrepancy between train and test time in teacher-forcing by randomly replacing some tokens in the history with the model’s prediction. More concretely, at a given time step in generating the output sequence, the model is conditioned either on ground-truth or model prediction from the previous time-step with some probability. The probability of selecting model predicted token is gradually increased as training progresses. This procedure potentially allows the model to recover from its own errors, and Bengio et al. (2015) observe better empirical performance in natural language parsing, image captioning, and speech recognition compared to teacher-forced training. Scheduled Sampling has also been used to get better performance in other tasks such as video prediction (Finn et al., 2016), knowledge base completion (Miwa and Bansal, 2016) and piano music transcription (Sigtia et al., 2016).
14
+
15
+ A key bottleneck in training models with Scheduled Sampling is its inherently sequential nature. Unlike teacher-forcing, tokens must be processed one time-step at a time. The sequential procedure makes Scheduled Sampling impractical for training neural networks, particularly on problems involving long sequence generation. In this work, we describe a simple technique to parallelize Scheduled Sampling. Given an input example, we first generate an entire model prediction sequence in parallel by conditioning on ground-truth history (equivalent to forward-pass of teacher-forcing). Then, we employ a (parallel) mixing step where we generate a new sequence whose token at every time step is either from the model prediction or the ground-truth. Finally, we perform training as in teacher-forcing by conditioning on the sequence obtained from mixing. In Section 2.3 we show that by performing multiple passes of parallel prediction and mixing, we obtain a conditioning sequence that converges to a sample decode from the model.
16
+
17
+ ![](images/2688ba4f4e028342a188be62a91385d37d4887ab204fa6c88f61a1a9c6b25269.jpg)
18
+ Figure 1: Parallel Scheduled Sampling for $K = 3$ passes. On each pass, the model is conditioned on the previous pass’s output. New tokens are sampled according to the model’s logits, which are then mixed with the gold sequence. After the final pass, the loss is calculated with respect to the gold tokens.
19
+
20
+ Our key contributions are,
21
+
22
+ • A novel, fully parallelizable approach to reducing train-test discrepancy of auto-regressive models without modification. We believe this to be the first approach that does not require full-sequence decoding within the training loop. We find the method produces the same empirical benefits of Scheduled Sampling while using as little as $0 . 3 \%$ of the training time. We prove equivalence of the proposed approach to Scheduled Sampling under certain choices of hyperparameters. This recovers the clear interpolation between training-time teacher-forcing and test-time decoding described in Bengio et al. (2015). We extensively evaluate our approach on four auto-regressive tasks in text and image domains. We find that Parallel Scheduled Sampling matches Scheduled Sampling’s benefits, takes massively less compute time, and significantly improves performance compared to teacher-forcing on most tasks. In dialog response generation task, Parallel Scheduled Sampling achieves 1.6 BLEU score $( 1 1 . 5 \% )$ improvement over teacher-forcing while in image generation it achieves $20 \%$ and $1 3 . 8 \%$ improvement in Frechet Inception Distance (FID) and Inception Score (IS) respectively.
23
+
24
+ # 2 METHOD
25
+
26
+ Our proposed technique can be applied to both conditional and unconditional auto-regressive generative models. For notational simplicity, we consider the task of conditional sequence generation. The training set is given in terms of $N$ input-output sequences $\{ ( x ^ { i } , y ^ { i } ) \} _ { i = 1 } ^ { n }$ , where $x ^ { i }$ is the input and target $y ^ { i }$ is the desired output. The target $y ^ { i }$ is a variable-length sequence of $T _ { i }$ tokens (or pixels), $( y _ { 1 } ^ { i } , y _ { 2 } ^ { i } , \dots , y _ { T _ { i } } ^ { i } )$ , whereas $x ^ { i }$ may be variable-length (as in translation) or fixed-length (as in image captioning). The goal is to learn a model that accurately predicts $y ^ { i }$ given $x ^ { i }$ . We use $y _ { 1 : t }$ to denote the sequence of tokens $( y _ { 1 } , y _ { 2 } , \ldots , y _ { t } )$ .
27
+
28
+ # 2.1 TEACHER-FORCING AND DECODING
29
+
30
+ Given an input $x$ and a target $y$ , the log-probability of the target can be decomposed autoregressively:
31
+
32
+ $$
33
+ P ( y | x ) = \prod _ { t = 1 } ^ { T } P ( y _ { t } | y _ { 1 : t - 1 } , x )
34
+ $$
35
+
36
+ Auto-regressive sequence generation models learn to assign high likelihood to token $y _ { t }$ given previous target tokens $y _ { 1 : t - 1 } = ( y _ { 1 } , \dotsc , y _ { t - 1 } )$ and inputs $x$ via a learned likelihood model $p _ { \theta }$ . Neural language models such as RNNs (Mikolov et al., 2010) and Transformer (Vaswani et al., 2017) adopt left-to-right decomposition while image generation models (van den Oord et al., 2016a; Parmar et al., 2018) adopt a raster-scan order.
37
+
38
+ Such models are typically trained with teacher-forcing (Williams and Zipser, 1989). In teacherforcing, the log likelihood of the training set is directly maximized,
39
+
40
+ $$
41
+ \theta ^ { * } = \operatorname * { a r g m a x } _ { \theta } \mathcal { L } _ { \mathrm { t f } } ( \theta ) = \operatorname * { a r g m a x } _ { \theta } \sum _ { i = 1 } ^ { N } \sum _ { t = 1 } ^ { T _ { i } } \log p _ { \theta } ( y _ { t } ^ { i } | y _ { 1 : t - 1 } ^ { i } , x ^ { i } )
42
+ $$
43
+
44
+ Importantly, teacher-forcing conditions on gold target prefixes $y _ { 1 : t - 1 }$ , enabling backpropagation through all timesteps with a single pass of inference.
45
+
46
+ At inference time, beam or sample decoding is often used to generate a candidate target $\hat { y } ^ { i }$ . In this regime, target tokens are generated one at a time while conditioning on previously-generated tokens.
47
+
48
+ $$
49
+ \hat { y } _ { t } \sim p _ { \theta } \big ( \hat { y } _ { t } | \hat { y } _ { 1 : t - 1 } , x \big ) \quad \mathrm { ~ o r ~ } \quad \hat { y } _ { t } = \operatorname * { a r g m a x } _ { y } p _ { \theta } \big ( y | \hat { y } _ { 1 : t - 1 } , x \big )
50
+ $$
51
+
52
+ A potential failure mode for teacher-forcing-trained models is in conditioning on previously unobserved target prefixes $\hat { y } _ { 1 : t - 1 }$ . As the model has not conditioned on these prefixes at training time, it may generate bland, repetitive, or nonsensical candidate targets (Holtzman et al., 2019).
53
+
54
+ # 2.2 SCHEDULED SAMPLING
55
+
56
+ Scheduled Sampling (Bengio et al., 2015), hereafter Sequential Scheduled Sampling is a training technique designed to bridge the gap between teacher-forcing and sample decoding. In its simplest form, Sequential Scheduled Sampling generates tokens $\tilde { y } _ { 1 : t }$ and conditions on these target prefixes during training. Sequential Scheduled Sampling uses the same objective function as teacher-forcing (Equation 1) except the conditioning tokens $\tilde { y } _ { 1 : t }$ are a random mixture of gold tokens $y _ { 1 : t }$ and sampled tokens $\hat { y } _ { 1 : t }$ instead of gold tokens $y _ { 1 : t }$ . See Algorithm 1 for implementation.
57
+
58
+ # Algorithm 1 Sequential Scheduled Sampling (single example)
59
+
60
+ $$
61
+ \tilde { y } _ { t } = \left\{ \begin{array} { l l } { y _ { t } } & { \mathrm { w i t h } \mathrm { p r o b a b i l i t y } 1 - p } \\ { \hat { y } _ { t } } & { \mathrm { w i t h } \mathrm { p r o b a b i l i t y } p } \end{array} \right.
62
+ $$
63
+
64
+ As $p \to 0$ , we condition on $y _ { 1 : t - 1 }$ as in teacher-forcing, and as $p 1$ , we condition on $\hat { y } _ { t : t - 1 }$ as in sample decoding. Typically a schedule will be used to gradually increase $p$ over the course of training. As illustrated in Bengio et al. (2015), Scheduled Sampling leads to a performance improvement in a variety of language generation tasks.
65
+
66
+ In spite of its benefits, Sequential Scheduled Sampling is inherently a sequential algorithm: choosing conditioning token $\tilde { y } _ { t }$ requires conditioning autoregressively on tokens $\tilde { y } _ { 1 : t - 1 }$ . While this is natural for sequential architectures such as RNNs and LSTMs, it is poorly suited to self-attending feed-forward models such as Transformer where inference for multiple timesteps can be carried out simultaneously.
67
+
68
+ # 2.3 PARALLEL SCHEDULED SAMPLING
69
+
70
+ We propose a natural extension to Sequential Scheduled Sampling called Parallel Scheduled Sampling. Whereas Sequential Scheduled Sampling selects conditioning tokens one after another, we propose generating conditioning tokens for all timesteps in parallel over the course of one or more passes. While this technique requires strictly more operations than Sequential Scheduled Sampling, it is better suited to hardware accelerators such as GPUs and TPUs (Jouppi et al., 2017). Moreover, we find in our experiments that only a modest number of passes is necessary for improving model performance.
71
+
72
+ Parallel Scheduled Sampling generates conditioning tokens for all timesteps simultaneously. The procedure consists of multiple passes, each pass consisting of parallel sampling and mixing steps (Figure 1). In the first pass, the algorithm conditions on gold tokens $y _ { 1 : t }$ , generating tokens $\hat { y } _ { 1 : t }$ i.i.d. according to $p _ { \theta } \big ( \hat { y } _ { t } \big | y _ { 1 : t - 1 } , x \big )$ . Sampling tokens in the first pass is equivalent to the forward-pass of teacher-forcing. The sampled tokens, $\hat { y } _ { 1 : t }$ , are mixed (in parallel) with gold tokens, $y _ { 1 : t }$ , to produce conditioning tokens for the next pass, $\tilde { y } _ { 1 : t }$ .
73
+
74
+ We now describe the multiple-pass procedure. Let $\hat { y } _ { k , 1 : t }$ , and $\tilde { y } _ { k , 1 : t }$ denote sampled and mixed tokens respectively on pass $k$ . The mixed tokens from pass $k$ , $\tilde { y } _ { k , 1 : t }$ , are used for conditioning on pass $k + 1$ in place of gold tokens $y _ { 1 : t }$ . Finally, the loss is calculated as before, conditioning on the final mixture of gold and sampled tokens $\tilde { y } _ { K , 1 : t }$ . See Algorithm 2 for implementation.
75
+
76
+ # Algorithm 2 Parallel Scheduled Sampling (single example)
77
+
78
+ Set $\tilde { y } _ { 0 , t } = y _ { t }$ .
79
+ for all passes $k = 1 , \ldots , K$ do for all timesteps $t$ in parallel do Sample $\hat { y } _ { k , t } \sim p _ { \theta } \big ( \hat { y } _ { k , t } \vert \tilde { y } _ { k - 1 , 1 : t - 1 } , x \big )$ . if $t < k$ then Copy y˜k,t = ˜yk−1,t else $\begin{array} { r } { \mathrm { S a m p l e ~ } \tilde { y } _ { k , t } = \left\{ \begin{array} { l l } { y _ { t } } & { \mathrm { w i t h ~ p r o b a b i l i t y ~ } 1 - p } \\ { \hat { y } _ { k , t } } & { \mathrm { w i t h ~ p r o b a b i l i t y ~ } p } \end{array} \right. } \end{array}$ end if end for
80
+ end for
81
+ return Accumulate loss $\begin{array} { r } { \sum _ { t } \log p _ { \theta } \bigl ( y _ { t } | \tilde { y } _ { K , 1 : t - 1 } , x \bigr ) } \end{array}$
82
+
83
+ Finally, we prove that by running the sampling and mixing steps for multiple passes as described in Algorithm 2, the final sample from Parallel Scheduled Sampling converges to a random sample decode from the model when $p = 1$ and $K \geq T$ .
84
+
85
+ Theorem 2.1. Consider a sequence of tokens $z = ( z _ { 1 } , z _ { 2 } , \dots , z _ { T } )$ of length $T$ . Let $p = 1$ and $K \geq T$ be fixed. Then the likelihood of $z _ { 1 : T }$ under Parallel Scheduled Sampling’s proposal distribution1 over conditioning tokens on pass $K$ , $q _ { \theta } ^ { K } ( z _ { 1 : T } )$ , is identical to random sample decoding’s, $p _ { \theta } { \left( z _ { 1 : T } \right) }$ , $q _ { \theta } ^ { K } ( z _ { 1 : T } ) = p _ { \theta } ( z _ { 1 : T } )$ .
86
+
87
+ Proof. We begin by establishing notation. Let $p _ { \theta } { \big ( } z _ { 1 : T } { \big ) }$ be the likelihood of a sequence $z _ { 1 : T }$ according to random sample decoding. Let $q _ { \theta } ^ { K } ( z _ { 1 : t } )$ be the likelihood of the same according to Parallel Scheduled Sampling’s proposal distribution on pass $K$ .
88
+
89
+ The proof proceeds by induction. First we show that the proposal distribution for the first token matches random sampling’s on the first pass, $q _ { \theta } ^ { 1 } ( z _ { 1 } ) = p _ { \theta } \overline { { { ( z _ { 1 } ) } } }$ . Then we show that if $q _ { \theta } ^ { K } ( z _ { 1 : t } ) =$ $p _ { \theta } ( z _ { 1 : t } )$ holds for some $K$ , it also holds for all $K ^ { \prime } > K$ . Finally, we show that if the previous statement holds, it also holds for tokens $z _ { 1 : t + 1 }$ on pass $K + 1$ . Thus, it follows that the proposal distribution matches random sampling’s for all $T$ tokens so long as $K \geq T$ .
90
+
91
+ Base Case: Consider the proposal distribution for the first token on the first pass, $z _ { 1 }$ . As $p = 1$ , the first token is sampled from $p _ { \theta } ( z _ { 1 } )$ by construction. Thus,
92
+
93
+ $$
94
+ q _ { \theta } ^ { 1 } ( z _ { 1 } ) = p _ { \theta } ( z _ { 1 } )
95
+ $$
96
+
97
+ Induction over $K$ : Suppose that the proposal distribution for tokens $q _ { \theta } ^ { K } ( z _ { 1 : t } ) = p _ { \theta } ( z _ { 1 : t } )$ some $K \geq t$ . Then the equality also hold for the proposal distribution on pass $K + 1$ . This follows trivially as tokens $z _ { 1 : t }$ are “copied” from pass $K$ to $K + 1$ and thus their likelihood is unchanged,
98
+
99
+ $$
100
+ q _ { \theta } ^ { K + 1 } ( z _ { 1 : t } ) = q _ { \theta } ^ { K } ( z _ { 1 : t } ) = p _ { \theta } ( z _ { 1 : t } )
101
+ $$
102
+
103
+ Induction over $t$ : Suppose that the proposal distribution matches random sample decoding’s for the first $t$ tokens for $t = K$ ; that is, $q _ { \theta } ^ { \mathbf { \dot { K } } } ( \dot { z } _ { 1 : t } ) = p _ { \theta } ( z _ { 1 : t } )$ . We show that the statement holds for pass $K + 1$ for tokens $z _ { 1 : t + 1 }$ . First, recall that by construction the proposal distribution for token $z _ { t + 1 }$ given previous tokens $z _ { 1 : t }$ is the same as random sampling’s when $t \geq K$ ,
104
+
105
+ $$
106
+ q _ { \theta } ^ { K + 1 } ( z _ { t + 1 } | z _ { 1 : t } ) = p _ { \theta } ( z _ { t + 1 } | z _ { 1 : t } )
107
+ $$
108
+
109
+ Note that this only holds when $p = 1$ . Then,
110
+
111
+ $$
112
+ \begin{array} { r l } & { q _ { \theta } ^ { K + 1 } ( { z } _ { 1 : t + 1 } ) = q _ { \theta } ^ { K + 1 } ( { z } _ { t + 1 } \vert { z } _ { 1 : t } ) q _ { \theta } ^ { K + 1 } ( { z } _ { 1 : t } ) } \\ & { \quad \quad \quad \quad = q _ { \theta } ^ { K + 1 } ( { z } _ { t + 1 } \vert { z } _ { 1 : t } ) q _ { \theta } ^ { K } ( { z } _ { 1 : t } ) } \\ & { \quad \quad \quad = p _ { \theta } ( { z } _ { t + 1 } \vert { z } _ { 1 : t } ) p _ { \theta } ( { z } _ { 1 : t } ) } \\ & { \quad \quad \quad = p _ { \theta } ( { z } _ { 1 : t + 1 } ) } \end{array}
113
+ $$
114
+
115
+ Where we use the chain rule, induction over $K$ for $z _ { 1 : t }$ , the inductive assumption for $q _ { \theta } ^ { K } ( z _ { 1 : t } )$ , and the definition of $q _ { \theta } ^ { K + 1 } ( z _ { t + 1 } | z _ { 1 : t } )$ when $t \geq K$ .
116
+
117
+ # 3 RELATED WORK
118
+
119
+ A variety of approaches have been introduced since Bengio et al. (2015) to eliminate the train-test discrepancy also known as exposure bias. Goyal et al. (2017) integrate a differentiable approximation to argmax into the Scheduled Sampling procedure. Ranzato et al. (2015) propose MIXER, which finetunes a model trained with teacher-forcing with REINFORCE to maximize BLEU on a validation set. Zhang et al. (2019) propose a procedure similar to Scheduled Sampling but with an alternative method for selecting the model’s next-token prediction. Both works inherently require full-sequence decoding within the training loop, making them impractical to apply in domains with long generations.
120
+
121
+ Concurrently, Mihaylova and Martins (2019) proposed a variant of Scheduled Sampling similar to the approach introduced in this work. In their work, only a single pass $K = 1$ is applied with the first pass conditioning on a mixture of input embeddings. Unlike this work, the proposed approach is not equivalent to Scheduled Sampling under any choice of hyperparameters. Lamb et al. (2016) introduce an alternative approach with similar motivation. A discriminator network is trained jointly with the generator to distinguish between generator’s hidden states produced by conditioning on ground-truth and model prediction sample. The generator, apart from maximizing the likelihood of the data, is also trained to fool the discriminator (Goodfellow et al., 2014). With this new objective, the dynamics of the generator would be the same for conditioning on both ground-truth and model prediction. Our parallel sampling approach is orthogonal to professor forcing and can be potentially applied in their framework.
122
+
123
+ Another approach with similar motivation is proposed in Collins and Roark (2004). Rather than a maximum likelihood objective, the authors apply a variant of the Perceptron algorithm (Rosenblatt, 1958) which penalizes the model’s most likely decode if it doesn’t exactly match the target. In the time-series modeling domain, Venkatraman et al. (2015) propose DAD, wherein the training set for a Markov dynamics model is augmented by pairing model predictions with ground-truth states. This method is similar in spirit to the approaches above except in its Markov assumptions. Further, methods with similar motivation have also been studied in sequential decision making and reinforcement learning setting (Daumé et al., 2009; Ross et al., 2011).
124
+
125
+ While our focus is on accelerating mitigation strategies for exposure bias, another line of work aims to accelerate sequential decoding. Stern et al. (2019) generate successively longer decodes by inserting tokens between pairs of already-decoded tokens. Roy et al. (2018) and Kaiser et al. (2018) generate tokens in parallel by additionally conditioning on a short sequence of discrete latent variables. Lee et al. (2018) apply an iterative refinement technique by performing multiple passes of parallel decoding.
126
+
127
+ # 4 EXPERIMENTS
128
+
129
+ We evaluate our proposed technique on image and text domains. In the text domain, we evaluate Parallel Scheduled Sampling on text summarization (Liu et al., 2018), task-oriented dialog response generation (Budzianowski et al., 2018), and machine translation (Sutskever et al., 2014; Vaswani et al., 2017) and compare it to teacher-forced training. We further evaluate the proposed technique on image generation on CIFAR-10. Since our procedure is intended to generate better sequences, we evaluate it at the sequence level and not at the word token or pixel level. We compare our method to Sequential Scheduled Sampling only on the dialog task (Budzianowski et al., 2018) as we find runtime infeasible on all other tasks. We use the Tensor2Tensor framework for all experiments (Vaswani et al., 2018).
130
+
131
+ # 4.1 DIALOG RESPONSE GENERATION
132
+
133
+ We evaluate our method on dialog response generation task using MultiWOZ (Budzianowski et al., 2018), a task-oriented dialog dataset. Here, we consider the problem of mapping conversation history consisting of alternating user and assistant turns to a single turn of assistant response. We use a Transformer model containing approximately one million parameters for this study as the dataset is much smaller (approximately $1 0 0 \mathrm { k }$ training examples) than those in other experiments. We truncate the length of the input and output to 512, and train all the models for $5 0 \mathrm { k }$ steps. As both model and dataset are small, we are able to empirically compare our method to Sequential Scheduled Sampling (such experiments are infeasible in larger models). Table 1 summarizes results for all experiments on the MultiWOZ dataset.
134
+
135
+ Both Sequential Scheduled Sampling and Parallel Scheduled Sampling (with just one pass) achieve better results than teacher-forced trained models. However, as can be seen in Table 1, Parallel Scheduled Sampling and teacher-forcing are both two orders of magnitude faster to train than Sequential Scheduled Sampling. A single pass of Parallel Scheduled Sampling is approximately $2 5 \%$ slower than teacher-forced training while producing the benefits of Sequential Scheduled Sampling. Table 1 also shows the impact of mixing probability, number of passes, warm-up steps, and the mixing probability schedule (Bengio et al., 2015) on model performance. Overall, we find a single pass with $50 \%$ gold/sampled mixing probability sufficient for improving performance. In the best setting, Parallel Scheduled Sampling achieves 1.6 BLEU score $( 1 1 . 5 \% )$ improvement over teacher-forcing.
136
+
137
+ # 4.2 SUMMARIZATION
138
+
139
+ Liu et al. (2018) propose a multi-document summarization task, where the task is to generate the text of a Wikipedia article given its references and other related documents. The dataset has close to 1.9 million training examples, and 230,000 test examples. We use a Transformer seq2seq model for this task in two hyper-parameter settings: a base model with 60 million parameters and a large model with 210 million parameters. For the base model, we restrict the maximum length of input and output to be 500, while for the large model the maximum length is set to 1500.
140
+
141
+ Table 2 shows the results of training base and large Transformer models for the summarization task. The base and large models were trained for $2 5 0 \mathrm { k }$ steps and $5 0 0 \mathrm { k }$ steps respectively. We use teacherforcing for the first $50 \%$ of training steps in Parallel Scheduled Sampling as warm-up steps. The mixing probability is set to $50 \%$ and we perform a single pass of sampling and mixing (Algorithm 2).
142
+
143
+ Table 1: Results from models trained with teacher-forcing, Sequential Scheduled Sampling, and Parallel Scheduled Sampling on dialog response generation. We report mean BLEU and maximum BLEU over 5 random restarts for each configuration except Sequential Scheduled Sampling, for which we report a single run. We provide results by varying different hyperparameters for both variants of Scheduled Sampling. We also provide training steps per second for the different training algorithms. In the best setting, Parallel Scheduled Sampling achieves 1.6 BLEU score $( 1 1 . 5 \% )$ improvement over teacher-forcing.
144
+
145
+ <table><tr><td>Training Method</td><td>Mixing Prob</td><td>Num Passes</td><td>Warm-up Steps</td><td>Schedule</td><td>Mean BLEU</td><td>Max BLEU</td><td>Training Steps/Sec</td></tr><tr><td>Teacher-Forcing</td><td>1</td><td></td><td>1</td><td></td><td>14.11</td><td>14.62</td><td>47</td></tr><tr><td>Sequential Ss</td><td>0.25</td><td></td><td>25k</td><td>exp</td><td>14.35</td><td>1</td><td>0.13</td></tr><tr><td>Sequential SS</td><td>0.50</td><td></td><td>25k</td><td>exp</td><td>13.84</td><td></td><td>0.13</td></tr><tr><td>Sequential SS</td><td>0.75</td><td></td><td>25k</td><td>exp</td><td>12.97</td><td></td><td>0.13</td></tr><tr><td>Sequential SS</td><td>1.00</td><td>-</td><td>25k</td><td>exp</td><td>3.95</td><td>-</td><td>0.13</td></tr><tr><td>Parallel SS</td><td>0.25</td><td>1</td><td>25k</td><td>exp</td><td>14.13</td><td>14.50</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.50</td><td>1</td><td>25k</td><td>exp</td><td>14.55</td><td>14.74</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.75</td><td>1</td><td>25k</td><td>exp</td><td>14.06</td><td>14.32</td><td>35</td></tr><tr><td>Parallel SS</td><td>1.00</td><td>1</td><td>25k</td><td>exp</td><td>5.63</td><td>6.24</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>2</td><td>25k</td><td>exp</td><td>14.60</td><td>14.75</td><td>27</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>3</td><td>25k</td><td>exp</td><td>14.32</td><td>14.73</td><td>23</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>5</td><td>25k</td><td>exp</td><td>14.33</td><td>14.70</td><td>17</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>7</td><td>25k 25k</td><td>exp</td><td>14.56</td><td>15.07</td><td>14</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>10</td><td></td><td>exp</td><td>14.55</td><td>15.21</td><td>10</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>1</td><td>10k</td><td>exp</td><td>14.24</td><td>14.88</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>1</td><td>15k</td><td>exp</td><td>14.56</td><td>14.98</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>1</td><td>20k</td><td>exp</td><td>14.52</td><td>15.01</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>1</td><td>30k</td><td>exp</td><td>14.66</td><td>14.98</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>1</td><td>35k</td><td>exp</td><td>14.56</td><td>15.11</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>1</td><td>40k</td><td>exp</td><td>14.73</td><td>15.38</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>1</td><td>25k</td><td>linear</td><td>14.49</td><td>14.76</td><td>35</td></tr><tr><td>Parallel SS</td><td>0.5</td><td>1</td><td>25k</td><td>sigmoid</td><td>14.30</td><td>14.66</td><td>35</td></tr></table>
146
+
147
+ Table 2: Performance on the summarization task using base and large Transformer when trained with teacher-forcing and Parallel Scheduled Sampling. We consider both beam search and greedy decoding. We adopt the widely-used ROUGE score as the evaluation metric (higher the better).
148
+
149
+ <table><tr><td>Model Size</td><td>Max Length</td><td>Training Method</td><td>Decoding Method</td><td>ROUGE-2</td><td>ROUGE-L</td></tr><tr><td>Base</td><td>500</td><td>Teacher-Forcing</td><td>Beam Search</td><td>24.74</td><td>34.42</td></tr><tr><td>Base</td><td>500</td><td>Parallel SS</td><td>Beam Search</td><td>25.19</td><td>34.76</td></tr><tr><td>Base</td><td>500</td><td>Teacher-Forcing</td><td>Greedy</td><td>20.18</td><td>28.66</td></tr><tr><td>Base</td><td>500</td><td>Parallel SS</td><td>Greedy</td><td>22.09</td><td>31.16</td></tr><tr><td>Large</td><td>1500</td><td>Teacher-Forcing</td><td>Beam Search</td><td>30.98</td><td>39.83</td></tr><tr><td>Large</td><td>1500</td><td>Parallel SS</td><td>Beam Search</td><td>30.35</td><td>39.09</td></tr><tr><td>Large</td><td>1500</td><td>Teacher-Forcing</td><td>Greedy</td><td>29.25</td><td>37.91</td></tr><tr><td>Large</td><td>1500</td><td>Parallel SS</td><td>Greedy</td><td>29.42</td><td>38.35</td></tr></table>
150
+
151
+ Table 3: Empirical results on CIFAR-10. We use Frechet Inception Distance (FID) (Heusel et al., 2017) and Inception Score (IS) (Salimans et al., 2016) metrics to evaluate the quality of the samples from teacher-forcing and Parallel Scheduled Sampling. We provide upper-bound scores by computing the metric on the ground-truth data.
152
+
153
+ <table><tr><td>Training Method</td><td>Mixing Prob</td><td>Num Passes</td><td>Warm-up Steps</td><td>Schedule</td><td>FID (↓)</td><td>IS (↑)</td></tr><tr><td>Ground Truth</td><td></td><td></td><td></td><td></td><td>0.0</td><td>11.31</td></tr><tr><td>Teacher-Forcing</td><td>=</td><td>=</td><td></td><td></td><td>52.39</td><td>5.64</td></tr><tr><td>Parallel SS</td><td>0.10</td><td>1</td><td>100k</td><td>exp</td><td>64.88</td><td>5.36</td></tr><tr><td>Parallel SS</td><td>0.25</td><td>1</td><td>100k</td><td>exp</td><td>48.85</td><td>6.08</td></tr><tr><td>Parallel SS</td><td>0.50</td><td>1</td><td>100k</td><td>exp</td><td>41.47</td><td>6.42</td></tr><tr><td>Parallel SS</td><td>0.75</td><td>1</td><td>100k</td><td>exp</td><td>43.38</td><td>6.48</td></tr><tr><td>Parallel SS</td><td>1.00</td><td>1</td><td>100k</td><td>exp</td><td>98.38</td><td>3.97</td></tr></table>
154
+
155
+ With the base model, Parallel Scheduled Sampling obtains better performance than teacher-forcing with both beam search and greedy decoding while it performs better only with greedy decoding when the large model is used. Since we use models that are much bigger than the ones in the dialog task discussed before, it is runtime infeasible to apply Sequential Schedule Sampling here.
156
+
157
+ # 4.3 IMAGE GENERATION
158
+
159
+ In the image domain, we evaluate our method for image generation on the CIFAR-10 dataset. We compare class-conditional Image Transformer (Parmar et al., 2018) trained with teacher-forcing and Parallel Scheduled Sampling. After training, we decode a total of 50,000 randomly-sampled images conditioned on classes drawn from the training set. In additional to a baseline model, we compare all metrics to ground truth samples from the CIFAR-10 training set. We evaluate the image samples using Frechet Inception Distance (FID) (Heusel et al., 2017) and Inception Score (IS) (Salimans et al., 2016) metrics. These metrics have been widely used to evaluate the quality of image samples from GANs (Lucic et al., 2018; Miyato et al., 2018; Karras et al., 2018; Zhang et al., 2018).
160
+
161
+ Table 3 compares teacher-forcing with Parallel Scheduled Sampling on image generation. We train the 50 million parameter Image Transformer model for 200K steps in both the cases. We find that Parallel Scheduled Sampling with a single pass and a mixing probability of $50 \%$ significantly decreases FID by $20 \%$ and increases IS by $1 3 . 8 \%$ compared to the baseline. Similarly to our summarization experiment, it is runtime infeasible to apply Sequential Schedule Sampling here.
162
+
163
+ # 4.4 MACHINE TRANSLATION
164
+
165
+ We evaluate our method on the WMT 2014 English-German task which consists of approximately 4.5 million training sentences. We experiment with the large Transformer model that contains approximately 210 million parameters. We did not see performance improvements by using Parallel Scheduled Sampling. The model trained with teacher-forcing for $5 0 0 \mathrm { k }$ steps gets 28.74 BLEU. The same model trained with $2 5 0 \mathrm { k }$ warm-up steps using teacher-forcing and the next 250k steps trained with Parallel Scheduled Sampling with mixing probability set to $50 \%$ and a single pass of sampling and mixing (Algorithm 2) obtains 28.57 BLEU. Hyper-parameter tuning of warm-up steps and mixing probability did not improve performance. We hypothesize the lack of performance improvement may be due to the fact that the summarization, dialog response generation and image generation tasks have much longer output sequences than in machine translation, though further investigation is required.
166
+
167
+ # 5 CONCLUSION
168
+
169
+ We introduce a simple technique to parallelize Scheduled Sampling that allows Schedule Sampling to be applied for training models with hundreds of millions of parameters on large datasets. The technique potentially mitigates discrepancy between train and test time in auto-regressive sequence generation models. We find that in most cases our technique leads to better empirical performance on summarization, dialog generation, and image generation compared to teacher-forced training. Our empirical results indicate that Parallel Scheduled Sampling can potentially improve the performance of auto-regressive sequence generation models particularly on tasks containing long sequences.
170
+
171
+ # REFERENCES
172
+
173
+ Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. NeurIPS, 2015.
174
+
175
+ Paweł Budzianowski, Tsung-Hsien Wen, Bo-Hsiang Tseng, Iñigo Casanueva, Stefan Ultes, Osman Ramadan, and Milica Gasic. Multiwoz - a large-scale multi-domain wizard-of-oz dataset for task-oriented dialogue modelling. EMNLP, 2018.
176
+
177
+ Kyunghyun Cho, Bart van Merrienboer, Çaglar Gülçehre, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. EMNLP, 2014.
178
+
179
+ Michael Collins and Brian Roark. Incremental parsing with the perceptron algorithm. ACL, 2004.
180
+
181
+ Hal Daumé, Iii, John Langford, and Daniel Marcu. Search-based structured prediction. Machine Learning, 2009.
182
+
183
+ Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. NeurIPS, 2016.
184
+
185
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. NeurIPS, 2014.
186
+
187
+ Kartik Goyal, Chris Dyer, and Taylor Berg-Kirkpatrick. Differentiable scheduled sampling for credit assignment. arXiv preprint arXiv:1704.06970, 2017.
188
+
189
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. NeurIPS, 2017.
190
+
191
+ Ari Holtzman, Jan Buys, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv, 2019.
192
+
193
+ Norman P Jouppi, Cliff Young, Nishant Patil, David Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, et al. In-datacenter performance analysis of a tensor processing unit. ACM/IEEE 44th Annual International Symposium on Computer Architecture (ISCA), 2017.
194
+
195
+ Lukasz Kaiser, Aurko Roy, Ashish Vaswani, Niki Parmar, Samy Bengio, Jakob Uszkoreit, and Noam Shazeer. Fast decoding in sequence models using discrete latent variables. arxiv, 2018.
196
+
197
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. ICLR, 2018.
198
+
199
+ Alex M Lamb, Anirudh Goyal ALIAS PARTH GOYAL, Ying Zhang, Saizheng Zhang, Aaron C Courville, and Yoshua Bengio. Professor forcing: A new algorithm for training recurrent networks. NeurIPS, 2016.
200
+
201
+ Jason Lee, Elman Mansimov, and Kyunghyun Cho. Deterministic non-autoregressive neural sequence modeling by iterative refinement. arXiv, 2018.
202
+
203
+ Peter J. Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. Generating wikipedia by summarizing long sequences. ICLR, 2018.
204
+
205
+ Mario Lucic, Karol Kurach, Marcin Michalski, Sylvain Gelly, and Olivier Bousquet. Are gans created equal? a large-scale study. NeurIPS, 2018.
206
+
207
+ Tsvetomila Mihaylova and André FT Martins. Scheduled sampling for transformers. arXiv preprint arXiv:1906.07651, 2019.
208
+
209
+ Tomas Mikolov, Martin Karafiát, Lukás Burget, Jan Honza Cernocký, and Sanjeev Khudanpur. Recurrent neural network based language model. INTERSPEECH, 2010.
210
+
211
+ Makoto Miwa and Mohit Bansal. End-to-end relation extraction using lstms on sequences and tree structures. ACL, 2016.
212
+
213
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. ICLR, 2018.
214
+
215
+ Niki J. Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, and Alexander Ku. Image transformer. ICML, 2018.
216
+
217
+ Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. arXiv preprint arXiv:1511.06732, 2015.
218
+
219
+ F. Rosenblatt. The perceptron: A probabilistic model for information storage and organization in the brain. Psychological Review, 1958.
220
+
221
+ Stephane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. AISTATS, 2011.
222
+
223
+ Aurko Roy, Ashish Vaswani, Arvind Neelakantan, and Niki Parmar. Theory and experiments on vector quantized autoencoders. arXiv, 2018.
224
+
225
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, Xi Chen, and Xi Chen. Improved techniques for training gans. NeurIPS, 2016.
226
+
227
+ Siddharth Sigtia, Emmanouil Benetos, and Simon Dixon. An end-to-end neural network for polyphonic piano music transcription. IEEE/ACM Trans. Audio, Speech and Lang. Proc., 2016.
228
+
229
+ Mitchell Stern, William Chan, Jamie Kiros, and Jakob Uszkoreit. Insertion transformer: Flexible sequence generation via insertion operations. CoRR, abs/1902.03249, 2019. URL http:// arxiv.org/abs/1902.03249.
230
+
231
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. NeurIPS, 2014.
232
+
233
+ Aäron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. ICML, 2016a.
234
+
235
+ Aäron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alexander Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. Arxiv, 2016b.
236
+
237
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. 2017.
238
+
239
+ Ashish Vaswani, Samy Bengio, Eugene Brevdo, Francois Chollet, Aidan N. Gomez, Stephan Gouws, Llion Jones, Łukasz Kaiser, Nal Kalchbrenner, Niki Parmar, Ryan Sepassi, Noam Shazeer, and Jakob Uszkoreit. Tensor2tensor for neural machine translation. CoRR, 2018.
240
+
241
+ Arun Venkatraman, Martial Hebert, and J Andrew Bagnell. Improving multi-step prediction of learned time series models. In Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015.
242
+
243
+ Ronald J Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural computation, 1989.
244
+
245
+ Han Zhang, Ian J. Goodfellow, Dimitris N. Metaxas, and Augustus Odena. Self-attention generative adversarial networks. ICML, 2018.
246
+
247
+ Wen Zhang, Yang Feng, Fandong Meng, Di You, and Qun Liu. Bridging the gap between training and inference for neural machine translation. arXiv preprint arXiv:1906.02448, 2019.
parse/train/HkxCzeHFDB/HkxCzeHFDB.md ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FUNCTIONAL REGULARISATION FOR CONTINUAL LEARNING WITH GAUSSIAN PROCESSES
2
+
3
+ Michalis K. Titsias∗ DeepMind mtitsias@google.com
4
+
5
+ Jonathan Schwarz∗ DeepMind & University College London schwarzjn@google.com
6
+
7
+ Alexander G. de G. Matthews DeepMind alexmatthews@google.com
8
+
9
+ Razvan Pascanu DeepMind razp@google.com
10
+
11
+ Yee Whye Teh DeepMind ywteh@google.com
12
+
13
+ # ABSTRACT
14
+
15
+ We introduce a framework for Continual Learning (CL) based on Bayesian inference over the function space rather than the parameters of a deep neural network. This method, referred to as functional regularisation for Continual Learning, avoids forgetting a previous task by constructing and memorising an approximate posterior belief over the underlying task-specific function. To achieve this we rely on a Gaussian process obtained by treating the weights of the last layer of a neural network as random and Gaussian distributed. Then, the training algorithm sequentially encounters tasks and constructs posterior beliefs over the task-specific functions by using inducing point sparse Gaussian process methods. At each step a new task is first learnt and then a summary is constructed consisting of (i) inducing inputs – a fixed-size subset of the task inputs selected such that it optimally represents the task – and (ii) a posterior distribution over the function values at these inputs. This summary then regularises learning of future tasks, through Kullback-Leibler regularisation terms. Our method thus unites approaches focused on (pseudo-)rehearsal with those derived from a sequential Bayesian inference perspective in a principled way, leading to strong results on accepted benchmarks.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Recent years have seen a resurgence of interest in continual learning, which refers to systems that learn in an online fashion from data associated with possibly an ever-increasing number of tasks (Ring, 1994; Robins, 1995; Schmidhuber, 2013; Goodfellow et al., 2013). A continual learning system must adapt to perform well on all earlier tasks without requiring extensive re-training on previous data. There are two main challenges for continual learning (i) avoiding catastrophic forgetting, i.e. remembering how to solve earlier tasks, and (ii) scalability over the number of tasks. Other possible desiderata may include forward and backward transfer, i.e. learning new tasks faster and retrospectively improving on previously tasks.
20
+
21
+ Similarly to many recent works on continual learning (Kirkpatrick et al., 2017; Nguyen et al., 2017; Rusu et al., 2016; Li & Hoiem, 2017; Farquhar & Gal, 2018), we focus on the scenario where a sequence of supervised learning tasks are presented to a continual learning system based on a deep neural network. While most methods assume known task boundaries, our approach will be also extended to deal with unknown task boundaries. Among the different techniques proposed to address this problem, we have methods which constrain or regularise the parameters of the network to not deviate significantly from those learnt on previous tasks. This includes methods that frame continual learning as sequential approximate Bayesian inference, including EWC (Kirkpatrick et al., 2017) and VCL (Nguyen et al., 2017). Such approaches suffer from brittleness due to representation drift. That is, as parameters adapt to new tasks the values that other parameters are constrained/regularised towards become obsolete (see Section 2.5 for further discussion on this). On the other hand, we have rehearsal/replay buffer methods, which use a memory store of past observations to remember previous tasks (Robins, 1995; Robins & McCallum, 1998; Lopez-Paz et al., 2017; Rebuffi et al., 2017). While these methods tend to not suffer from brittleness, uncertainty about the unknown functions is not expressed. Furthermore, they rely on various heuristics to decide which data to store (Rolnick et al., 2018), often requiring large quantities of stored observations to achieving good performance. In this paper we will address the open problem of deriving an optimisation objective to select the best observations for storage.
22
+
23
+ ![](images/9e49a9b74edc2967075a8b78bdd0cc85564eb234673a3fbf7067df9a8eae7a95.jpg)
24
+ Figure 1: Depiction of the proposed approach. See also the provided pseudocode. When learning task 1, first, parameters of the network $\theta$ and output layer $w$ are fitted (Panel A). Afterwards, the learned GP is sparsified and inducing points $u _ { 1 } , \ldots$ are found (Panel B). When moving to the next task the same steps are repeated. The only difference is that now the previously found summaries (in this case points $u _ { 1 } , . . , u _ { 8 } ,$ ) are used to regularise the function (via KL-divergence term), such that the first task is not forgotten.
25
+
26
+ In this paper, we develop a new approach to continual learning which addresses the shortcomings of both categories. It is based on approximate Bayesian inference, but on the space of functions instead of neural network parameters, so does not suffer from the aforementioned brittleness. Intuitively, while previous approaches constrain the parameters of a neural network to limit deviations from previously learnt parameters, our approach instead constrains the neural network predictions from deviating too far from those that solve previous tasks.
27
+
28
+ Effectively, our approach avoids forgetting an earlier task by memorising an approximate posterior belief over the underlying task-specific function. To implement this, we consider Gaussian processes (GPs) (Rasmussen & Williams, 2005), and make use of inducing point sparse GP methods (Csato & Opper, 2002; Titsias, 2009; Hensman et al., 2013; Bui et al., 2017b), which summarise posterior distributions over functions using small numbers of so-called inducing points. These inducing points are selected from the training set by optimising a variational objective, providing a principled mechanism to compress the dataset to a meaningful subset of fixed size. They are kept around when moving to the next task and, together with their posterior distributions, are used to regularise the continual learning of future tasks, through Kullback-Leibler regularisation terms within a variational inference framework, thus avoiding catastrophic forgetting of earlier tasks. Our approach bears similarities to replay-based approaches, with inducing points playing the role of the rehersal/replay buffer, but has two important advantages. First the approximate posterior distributions at the inducing points captures the uncertainty of the unknown function as well, rather than providing merely target values. Second, inducing points can be optimised using specialised criteria from the GP literature, achieving better performance than a random selection of observations. An intuitive depiction of our approach is given in Figure 1.
29
+
30
+ To enable our functional regularisation approach to deal with high-dimensional and complex datasets, we use a linear kernel with features parameterised by neural networks (Wilson et al., 2016). Such GPs can be understood as Bayesian neural networks, where only the weights of the last layer are treated in a Bayesian fashion, while those in earlier layers are optimised. This view allows for a more computationally efficient and accurate training procedure to be carried out in weight space, before the approximation is translated into function space where the inducing points are constructed and then used for regularising learning of future tasks. Finally, note that inducing points are also used to regularize the deep network, even though they were selected to best represent functions given by the GP. See Section 2.3 for further details.
31
+
32
+ # 2 FUNCTIONAL REGULARISATION FOR CONTINUAL LEARNING
33
+
34
+ We consider supervised learning of multiple tasks, with known task boundaries, that are processed sequentially one at a time. At each step we receive a set of examples $( X _ { i } , { \bf y } _ { i } )$ where $X _ { i } = \bar { \{ \substack { x _ { i , j } \} } } _ { j = 1 } ^ { N _ { i } }$ are input vectors and $\mathbf { y } _ { i } = \{ y _ { i , j } \} _ { j = 1 } ^ { N _ { i } }$ are output targets so that each $y _ { i , j }$ is assigned to the input $x _ { i , j } \in \mathbb { R } ^ { D }$ . We assume the most extreme case (and challenging in terms of avoiding forgetting) where each dataset $( X _ { i } , { \bf y } _ { i } )$ introduces a new task, while less extreme cases can be treated similarly. We wish to sequentially train a shared model or representation from all tasks so that catastrophic forgetting is avoided, i.e. when the model is trained on the $i$ -th task it should still provide accurate predictions for all tasks $j < i$ seen in the past. As a model we consider a deep neural network with its final hidden layer providing the feature vector $\phi ( x ; \theta ) \in \mathbb { R } ^ { K }$ where $x$ is the input vector and $\theta$ are the model parameters. This representation is shared across tasks and $\theta$ is a task-shared parameter. To solve a specific task $i$ we additionally construct an output layer
35
+
36
+ $$
37
+ f _ { i } ( x ; w _ { i } ) \equiv f _ { i } ( x ; w _ { i } , \theta ) = w _ { i } ^ { \top } \phi ( x ; \theta ) ,
38
+ $$
39
+
40
+ where for simplicity we assume that $f _ { i } ( x ; w _ { i } )$ is a scalar function and $w _ { i }$ is the vector of task-specific weights. Dealing with vector-valued functions is straightforward and is discussed in the Appendix. By placing a Gaussian prior on the output weights, $w _ { i } \stackrel { - } { \sim } \mathcal { N } ( w _ { i } | 0 , \sigma _ { w } ^ { 2 } I )$ , we obtain a distribution over functions. While each task has its own independent/private weight vector $w _ { i }$ the whole distribution refers to the full infinite set of tasks that can be tackled by the same feature vector $\phi ( x ; \theta )$ . We can marginalise out $w _ { i }$ and obtain the equivalent function space view of the model, where each task-specific function is an independent draw from a GP (Rasmussen $\&$ Williams, 2005), i.e.
41
+
42
+ $$
43
+ f _ { i } ( \boldsymbol { x } ) \sim \mathcal { G P } ( 0 , \boldsymbol { k } ( \boldsymbol { x } , \boldsymbol { x } ^ { \prime } ) ) , \ : \boldsymbol { k } ( \boldsymbol { x } , \boldsymbol { x } ^ { \prime } ) = \sigma _ { w } ^ { 2 } \phi ( \boldsymbol { x } ; \boldsymbol { \theta } ) ^ { \top } \phi ( \boldsymbol { x } ^ { \prime } ; \boldsymbol { \theta } ) ,
44
+ $$
45
+
46
+ where the kernel function is defined by the dot product of the neural network feature vector. By assuming for now that all possible tasks are simultaneously present similarly to multi-task GPs (Bonilla et al., 2008; Álvarez et al., 2012), the joint distribution over function values and output data for all tasks is written as $\begin{array} { r } { \prod _ { i } p ( { \bf y } _ { i } | { \bf f } _ { i } ) p ( { \bf f } _ { i } ) = \prod _ { i } p ( { \bf y } _ { i } | { \bf f } _ { i } ) \mathcal { N } ( { \bf f } _ { i } | { \bf 0 } , { \cal K } _ { X _ { i } } ) } \end{array}$ , where the vector $\mathbf { f } _ { i }$ stores all function values for the input dataset $X _ { i }$ , i.e. $f _ { i , j } = f ( x _ { i , j } ) , j = 1 , \ldots , N _ { i }$ . Also the kernel matrix $K _ { X _ { i } }$ is obtained by evaluating the kernel function on $X _ { i }$ , i.e. each element $[ K _ { X _ { i } } ] _ { j , k } = \sigma _ { w } ^ { 2 } \phi ( x _ { i , j } ; \theta ) ^ { \top } \phi ( x _ { i , k } ; \theta )$ where $x _ { i , j } , x _ { i , k } \in X _ { i }$ . The form of each likelihooes binary classification then $p ( \mathbf { y } _ { i } | \mathbf { f } _ { i } )$ e if thewhere $i$ $\begin{array} { r } { p ( \mathbf { y } _ { i } \vert \mathbf { f } _ { i } ) = \prod _ { j = 1 } ^ { N _ { i } } p ( y _ { i , j } \vert f _ { i , j } ) = \prod _ { j = 1 } ^ { N _ { i } } \frac { 1 } { 1 + e ^ { - y _ { i , j } f _ { i , j } } } } \end{array}$ $y _ { i , j } \in \{ - 1 , 1 \}$ indicates the binary class label.
47
+
48
+ Inference in this model requires estimating each posterior distribution $p ( \mathbf { f } _ { i } | \mathbf { y } _ { i } , X _ { i } )$ , which can be approximated by a multivariate Gaussian $\mathcal { N } ( \mathbf { f } _ { i } | \mu _ { i } , \Sigma _ { i } )$ . Given this Gaussian we can express our posterior belief over any function value $f _ { i , * }$ at some test input $x _ { i , * }$ using the posterior GP (Rasmussen & Williams, 2005),
49
+
50
+ $$
51
+ p ( f _ { i , * } | X _ { i } , y _ { i } ) = \int p _ { \theta } ( f _ { i , * } | \mathbf { f } _ { i } ) { \mathcal { N } } ( \mathbf { f } _ { i } | \mu _ { i } , \Sigma _ { i } ) d \mathbf { f } _ { i } .
52
+ $$
53
+
54
+ Given that the tasks arrive one at a time, the above suggests that one way to avoid forgetting the $i$ -th task is to memorise the corresponding posterior belief $\mathcal { N } ( \mathbf { f } _ { i } | \mu _ { i } , \Sigma _ { i } )$ . While this can regularise continual learning of subsequent tasks (similarly to the more general variational framework in the next section), it can be prohibitively expensive since the non-parametric nature of the model means that for each $\mathcal { N } ( \mathbf { f } _ { i } | \mu _ { i } , \Sigma _ { i } )$ we need to store $O ( N _ { i } ^ { 2 } )$ parameters and additionally we need to keep in memory the full set of input vectors $X _ { i }$ .
55
+
56
+ Therefore, in order to reduce the time and memory requirements we would like to apply data distillation and approximate each full posterior by applying sparse GP methods. As shown next, by applying variational sparse GP inference (Titsias, 2009) in a sequential fashion we obtain a new algorithm for function space regularisation in continual learning.
57
+
58
+ # 2.1 LEARNING THE FIRST TASK
59
+
60
+ Suppose we encounter the first task with data $( X _ { 1 } , \mathbf { y } _ { 1 } )$ . We introduce a small set $Z _ { 1 } = \{ z _ { 1 , j } \} _ { j = 1 } ^ { M _ { 1 } }$ of $z _ { 1 , j }$ lives in the same space as each training input $x _ { 1 , j }$ . The inducing set $Z _ { 1 }$ can be a subset of $X _ { 1 }$ or it can contain pseudo inputs (Snelson & Ghahramani, 2006), i.e. points lying between the training inputs. For simplicity next we consider $Z _ { 1 }$ as pseudo points, although in practice for continual learning it can be more suitable to select them from the training inputs (see Section 2.4). By evaluating the function output at each $z _ { 1 , j }$ we obtain a vector of auxiliary function values $\mathbf { u } _ { 1 } = \{ u _ { 1 , j } \} _ { j = 1 } ^ { M _ { 1 } }$ , where each $u _ { 1 , j } = f ( z _ { 1 , j } )$ . Hence, we obtain the joint distribution
61
+
62
+ $$
63
+ p ( \mathbf { y } _ { 1 } , \mathbf { f } _ { 1 } , \mathbf { u } _ { 1 } ) = p ( \mathbf { y } _ { 1 } | \mathbf { f } _ { 1 } ) p _ { \theta } ( \mathbf { f } _ { 1 } | \mathbf { u } _ { 1 } ) p _ { \theta } ( \mathbf { u } _ { 1 } ) .
64
+ $$
65
+
66
+ The exact posterior distribution $p _ { \theta } ( \mathbf { f } _ { 1 } | \mathbf { u } _ { 1 } , \mathbf { y } _ { 1 } ) p _ { \theta } ( \mathbf { u } _ { 1 } | \mathbf { y } _ { 1 } )$ is approximated by a distribution of the form, $q ( \mathbf { f } _ { 1 } , \mathbf { u } _ { 1 } ) \ = \ p _ { \theta } ( \mathbf { f } _ { 1 } | \mathbf { u } _ { 1 } ) q ( \mathbf { u } _ { 1 } )$ , where ${ \bf \nabla } { \bf \zeta } _ { q } ( { \bf \equiv u } _ { i } )$ is a variational distribution and $p _ { \theta } ( \mathbf { f } _ { 1 } | \mathbf { u } _ { 1 } )$ is the GP prior conditional, $p _ { \theta } ( \mathbf { f } _ { 1 } | \mathbf { u } _ { 1 } ) = \mathcal { N } ( \mathbf { f } _ { 1 } | K _ { X _ { 1 } Z _ { 1 } } K _ { Z _ { 1 } } ^ { - 1 } \mathbf { u } _ { 1 } , K _ { X _ { 1 } } - K _ { X _ { 1 } Z _ { 1 } } K _ { Z _ { 1 } } ^ { - 1 } K _ { Z _ { 1 } X _ { 1 } } )$ . Here, $K _ { X _ { 1 } Z _ { 1 } }$ is the cross kernel matrix between the sets $X _ { 1 }$ and $Z _ { 1 }$ , $K _ { Z _ { 1 } X _ { 1 } } ~ = ~ K _ { X _ { 1 } Z _ { 1 } } ^ { \top }$ and $K _ { Z _ { 1 } }$ is the kernel matrix on $Z _ { 1 }$ . The method learns $( q ( \mathbf { u } _ { 1 } ) , Z _ { 1 } )$ by minimising the KL divergence $\operatorname { K L } ( p _ { \boldsymbol { \theta } } ( \mathbf { f } _ { 1 } | \mathbf { u } _ { 1 } ) q ( \mathbf { u } _ { 1 } ) | | p _ { \boldsymbol { \theta } } ( \mathbf { f } _ { 1 } | \mathbf { u } _ { 1 } , \mathbf { y } _ { 1 } ) p _ { \boldsymbol { \theta } } ( \mathbf { u } _ { 1 } | \mathbf { y } _ { 1 } ) )$ . The ELBO is also maximised over the neural network feature vector parameters $\theta$ that determine the kernel matrices. This ELBO is generally written in the form (Hensman et al., 2013; Lloyd et al., 2015; Dezfouli & Bonilla, 2015; Hensman et al., 2015; Sheth et al., 2015),
67
+
68
+ $$
69
+ \mathcal { F } ( \theta , q ( \mathbf { u } _ { 1 } ) ) = \sum _ { j = 1 } ^ { N _ { 1 } } \mathbb { E } _ { q ( f _ { 1 , j } ) } [ \log p ( y _ { 1 , j } | f _ { 1 , j } ) ] - \mathrm { K L } ( q ( \mathbf { u } _ { 1 } ) | | p _ { \theta } ( \mathbf { u } _ { 1 } ) ) ,
70
+ $$
71
+
72
+ where $\begin{array} { r } { q ( f _ { 1 , j } ) = \int p ( f _ { 1 , j } | \mathbf { u } _ { 1 } ) q ( \mathbf { u } _ { 1 } ) d \mathbf { u } _ { 1 } } \end{array}$ is an univariate Gaussian distribution with analytic mean and variance that depend on $( \theta , Z _ { 1 } , q ( \mathbf { u } _ { 1 } ) , x _ { 1 , j } )$ . Each expectation $\mathbb { E } _ { q ( f _ { 1 , j } ) } [ \log p ( y _ { 1 , j } | f _ { 1 , j } ) ]$ is a one-dimensional integral and can be estimated by Gaussian quadrature. The variational distribution $q ( \mathbf { u } _ { 1 } )$ is chosen to be a Gaussian, parameterised as $q ( \mathbf { u } _ { 1 } ) \stackrel { * } { = } \mathcal { N } ( \mathbf { u } _ { 1 } | \boldsymbol { \mu } _ { u _ { 1 } } , L _ { u _ { 1 } } L _ { u _ { 1 } } ^ { \top } )$ , where $L _ { u 1 }$ is a square root matrix such as a lower triangular Cholesky factor. Then, based on the above we can jointly apply stochastic variational inference (Hensman et al., 2013) to maximise the ELBO over $( \theta , \mu _ { u _ { 1 } } , L _ { u _ { 1 } } )$ and optionally over the inducing inputs $Z _ { 1 }$ .
73
+
74
+ # 2.2 LEARNING THE SECOND AND SUBSEQUENT TASKS
75
+
76
+ The functional regularisation framework for continual learning arises from the variational sparse GP inference method as we encounter the second and subsequent tasks.
77
+
78
+ Once we have learned the first task we throw away the dataset $( X _ { 1 } , \mathbf { y } _ { 1 } )$ and we keep in memory only a task summary consisting of the inducing inputs $Z _ { 1 }$ and the variational Gaussian distribution $q ( \mathbf { u } _ { 1 } )$ (i.e. its parameters $\mu _ { u _ { 1 } }$ and $L _ { u _ { 1 } }$ ). Note also that $\theta$ (that determines the neural network feature vector $\phi ( x ; \theta ) \big .$ ) has a current value obtained by learning the first task. When the dataset $\left( X _ { 2 } , \mathbf { y } _ { 2 } \right)$ for the second task arrives, a suitable ELBO to continue learning $\theta$ and also estimate the second task summary $( Z _ { 2 } , q ( \mathbf { u } _ { 2 } ) )$ is
79
+
80
+ $$
81
+ \sum _ { j = 1 } ^ { N _ { 1 } } \mathbb { E } _ { q ( f _ { 1 , j } ) } [ \log p ( y _ { 1 j } | f _ { 1 , j } ) ] + \sum _ { j = 1 } ^ { N _ { 2 } } \mathbb { E } _ { q ( f _ { 2 , j } ) } [ \log p ( y _ { 2 , j } | f _ { 2 , j } ) ] - \sum _ { i = 1 , 2 } { \mathrm { K L } } ( q ( \mathbf { u } _ { i } ) | | p _ { \theta } ( \mathbf { u } _ { i } ) ) ,
82
+ $$
83
+
84
+ which is just the sum of the corresponding ELBOs for the two tasks. We need to approximate this ideal objective by making use of the fixed summary $( Z _ { 1 } , q ( \mathbf { u } _ { 1 } ) )$ that we have kept in memory for the first task. By considering $Z _ { 1 } \subset X _ { 1 }$ as our replay buffer with outputs $\widetilde { \mathbf { y } } _ { 1 } \subset \mathbf { y }$ and $\widetilde { \mathbf { u } } _ { 1 } \subset \mathbf { f } _ { 1 }$ the above can be approximated by
85
+
86
+ $$
87
+ \frac { N _ { 1 } } { M _ { 1 } } \sum _ { j = 1 } ^ { M _ { 1 } } \mathbb { E } _ { q ( u _ { 1 , j } ) } [ \log p ( \widetilde { y } _ { 1 , j } | u _ { 1 , j } ) ] + \sum _ { j = 1 } ^ { N _ { 2 } } \mathbb { E } _ { q ( f _ { 2 , j } ) } [ \log p ( y _ { 2 , j } | f _ { 2 , j } ) \ - \sum _ { i = 1 , 2 } \mathbf { K L } ( q ( \mathbf { u } _ { i } ) | p _ { \theta } ( \mathbf { u } _ { i } ) ) ,
88
+ $$
89
+
90
+ where each $q ( u _ { 1 , j } )$ is a univariate marginal of $q ( \mathbf { u } _ { 1 } )$ . However, since $q ( \mathbf { u } _ { 1 } )$ is kept fixed the whole expected log-likelihood term M4 1 PM1j=1 Eq(u1,j )[log p(y1,j |u1,j )] is just a constant that does not depend on the parameters $\theta$ any more. Thus, the objective function when learning the second task reduces to maximising,
91
+
92
+ $$
93
+ \mathcal { F } ( \theta , q ( \mathbf { u } _ { 2 } ) ) = \sum _ { j = 1 } ^ { N _ { 2 } } \mathbb { E } _ { q ( f _ { 2 , j } ) } [ \log p ( y _ { 2 , j } | f _ { 2 , j } ) ] - \sum _ { i = 1 , 2 } { \mathrm { K L } } ( q ( \mathbf { u } _ { i } ) | | p _ { \theta } ( \mathbf { u } _ { i } ) ) .
94
+ $$
95
+
96
+ The only term associated with the first task is $\mathrm { K L } ( q ( \mathbf { u } _ { 1 } ) | | p _ { \theta } ( \mathbf { u } _ { 1 } ) )$ . While $q ( \mathbf { u } _ { 1 } )$ is fixed (i.e. its parameters are constant), the GP prior $p _ { \theta } ( \mathbf { u } _ { 1 } ) = \mathcal { N } ( \mathbf { u } _ { 1 } | \mathbf { 0 } , K _ { Z _ { 1 } } )$ is still a function of the feature vector parameters $\theta$ , since $K _ { Z _ { 1 } }$ depends on $\theta$ . Thus, this KL term regularises the parameters $\theta$ so that, while learning the second task, the feature vector still needs to explain the posterior distribution over the function values $\mathbf { u } _ { 1 }$ at input locations $Z _ { 1 }$ . Notice that $- \mathrm { K L } ( q ( \mathbf { u } _ { i } ) | | p _ { \theta } ( \mathbf { u } _ { i } )$ is further simplified as $\begin{array} { r } { \int q ( \mathbf { u } _ { 1 } ) \log p _ { \theta } ( \mathbf { u } _ { 1 } ) d \mathbf { u } _ { 1 } + c o n s t } \end{array}$ , which shows that the regularisation is such that $p _ { \theta } ( \mathbf { u } _ { 1 } )$ needs to be consistent with all infinite draws from $q ( \mathbf { u } _ { 1 } )$ in a moment-matching or maximum likelihood sense.
97
+
98
+ Similarly for the subsequent tasks we can conclude that for any new task $k$ the objective will be
99
+
100
+ $$
101
+ \mathcal { F } ( \theta , q ( { \mathbf { u } } _ { k } ) ) = \sum _ { j = 1 } ^ { N _ { k } } \mathbb { E } _ { q ( f _ { k , j } ) } \log p ( y _ { k , j } | f _ { k , j } ) - \mathrm { K L } ( q ( { \mathbf { u } } _ { k } ) | | p _ { \theta } ( { \mathbf { u } } _ { k } ) ) - \sum _ { i = 1 } ^ { k - 1 } \mathrm { K L } ( q ( { \mathbf { u } } _ { i } ) | | p _ { \theta } ( { \mathbf { u } } _ { i } ) ) ~ .
102
+ $$
103
+
104
+ Thus, functional regularisation when learning a new task is achieved through the sum of the KL divergences $\begin{array} { r l } { \sum _ { i = 1 } ^ { k - 1 } \mathrm { K L } ( q ( \mathbf { u } _ { i } ) | | p _ { \theta } ( \mathbf { u } _ { i } ) ) } & { { } } \end{array}$ of all previous tasks, where each ${ \bf \nabla } q ( { \bf u } _ { i } )$ is the fixed posterior distribution which encodes our previously obtained knowledge about task $i < k$ . Furthermore, in order to keep the optimisation scalable over tasks, we can form unbiased approximations of this latter sum by sub-sampling the KL terms, i.e. by performing minibatch-based stochastic approximation over the regularisation terms associated with these previous tasks.
105
+
106
+ # 2.3 ACCURATE WEIGHT SPACE INFERENCE FOR THE CURRENT TASK
107
+
108
+ While the above framework arises by applying sparse GP inference, it can still be limited. When the budget of inducing variables is small, the sparse GP approximation may lead to inaccurate estimates of the posterior belief $q ( { \mathbf { u } } _ { k } )$ , which will degrade the quality of regularisation when learning new tasks. This is worrisome as in continual learning it is desirable to keep the size of the inducing set as small as possible.
109
+
110
+ One way to deal with this issue is to or even maximise the full GP ELBO $\begin{array} { r } { \sum _ { j = 1 } ^ { N _ { k } } \mathbb { E } _ { q ( f _ { k , j } ) } \mathrm { \bar { l o g } } p ( y _ { k , j } | f _ { k , j } ) - \mathrm { \bar { K L } } ( q ( \mathbf { f } _ { k } ) | | p _ { \theta } ( \mathbf { f } _ { k } ) ) } \end{array}$ ent task (i.e. by using as many inducing points as training examples), and once training is completed to distill the small subset $\mathbf { \bar { \it Z } } _ { k } , \mathbf { u } _ { k } \subset \mathbf { \bar { \it X } } _ { k } , \mathbf { f } _ { k }$ , and the corresponding marginal distribution $q ( \grave { \mathbf { u } } _ { k } )$ from $q ( \mathbf { f } _ { k } )$ , for subsequently regularising continual learning. However, carrying out this maximisation in the function space can be extremely slow since it scales as $O ( N _ { k } ^ { 3 } )$ per optimisation step. To our rescue, there is an alternative computationally efficient way to achieve this, by relying on the linear form of the kernel, that performs inference over the current task in the weight space. While this inference does not immediately provides us with the summary (induced points) for building the functional regularisation term, we can distill this term afterwards as discussed next. This allows us to address the continual learning aspect of the problem. Given that the current $k$ -th task is represented in the weight space as $f _ { k } ( x ; \bar { w _ { k } } ) \bar { = } w _ { k } ^ { \top } \phi ( x ; \bar { \theta } ) , w _ { k } \sim \mathcal { N } ( 0 , \sigma _ { w } ^ { 2 } I )$ , we introduce a full Gaussian variational approximation $q ( w _ { k } ) = \mathcal { N } ( w _ { k } | \mu _ { w _ { k } } , \Sigma _ { w _ { k } } )$ , where $\mu _ { k }$ is a $K$ dimensional mean vector and $\Sigma _ { w _ { k } }$ is the corresponding $K \times K$ full covariance matrix parameterised as $\Sigma _ { w _ { k } } = L _ { w _ { k } } L _ { w _ { k } } ^ { \top }$ . Learning the $k$ -th task is carried out by maximising the objective in equation 4, with the only difference that the ELBO for the current task is now in the weight space. The objective becomes
111
+
112
+ $$
113
+ \mathcal { F } ( \theta , q ( w _ { k } ) ) = \sum _ { j = 1 } ^ { N _ { k } } \mathbb { E } _ { q ( w _ { k } ) } [ \log p ( y _ { k , j } | w _ { k } ^ { \top } \phi ( x _ { k , j } ; \theta ) ) ] - \mathrm { K L } ( q ( w _ { k } ) | | p ( w _ { k } ) ) - \sum _ { i = 1 } ^ { k - 1 } \mathrm { K L } ( q ( \mathbf { u } _ { i } ) | | p \theta ( \mathbf { u } _ { i } ) ) ,
114
+ $$
115
+
116
+ where $\mathbb { E } _ { q ( w _ { k } ) } [ \log p ( y _ { k , j } | w _ { k } ^ { \top } \phi ( x _ { k , j } , \theta ) ) ]$ can be re-written as one-dimensional integral and estimated using Gaussian quadrature. Once the variational distribution $q ( w _ { k } )$ has been optimised, together with the constantly updated feature parameters $\theta$ , we can rely on this solution to select inducing points $Z _ { k }$ See Section 2.4 for more detail. We also compute the posterior distribution over their function values $\mathbf { u } _ { k }$ according to $q ( { \mathbf { u } } _ { k } ) = \mathcal { N } ( { \mathbf { u } } _ { k } \vert { \boldsymbol \mu } _ { u _ { k } } , L _ { u _ { k } } L _ { u _ { k } } ^ { \top } )$ , where
117
+
118
+ $$
119
+ \mu _ { u _ { k } } = \Phi _ { Z _ { k } } \mu _ { w _ { k } } , L _ { u _ { k } } = \Phi _ { Z _ { k } } L _ { w _ { k } }
120
+ $$
121
+
122
+ and the matrix $\Phi _ { Z _ { k } }$ stores as rows the feature vectors evaluated at $Z _ { k }$ . Subsequently, we store the $k$ -th task summary $\left( Z _ { k } , \mu _ { u _ { k } } , L _ { u _ { k } } \right)$ and use it for regularising continual learning of subsequent tasks, by always maximising the objective $\mathcal { F } ( \boldsymbol { \theta } , \boldsymbol { q } ( \boldsymbol { w } _ { k } ) )$ . Pseudo-code of the procedure is given in Algorithm 1.
123
+
124
+ # 2.4 SELECTION OF THE INDUCING POINTS
125
+
126
+ After having seen the $k$ -th task, and given that it is straightforward to compute the posterior distribution $q ( { \mathbf { u } } _ { k } )$ for any set of function values, the only issue remaining is to select the inducing inputs $Z _ { k }$ . A simple choice that works well in practice is to select $Z _ { k }$ as a random subset of the training inputs $X _ { k }$ . The question is whether we can do better with some more structured criterion.
127
+
128
+ <table><tr><td>for t= 1,2,..., do</td><td>Input: Feature vector Φ(x; 0) with initial value of 0,task k = O,starting_time(k)=10. Construct output weights wo and initialise variational parameters μwo (e.g. around zero) and Lwk = I.</td></tr><tr><td>Receive next data minibatch (Xt, yt).</td><td></td></tr><tr><td>Compute KL values lt = {lt,i},for any xt,i ∈ Xt.</td><td></td></tr><tr><td>if t - starting_time(k) &gt;min_time_in(k) and StatisticalTest(lt,lold) is significant then</td><td></td></tr><tr><td>#A newtask has been detected.</td><td></td></tr><tr><td>Select inducing inputs Zk for current task.</td><td></td></tr><tr><td>Compute the parameters of q(uk) from equation 5 and store them.</td><td></td></tr><tr><td>Construct new output weights Wk+1 and variational parameters (μwk+1, Lwk+1). k =k +1; starting_time(k)= t.</td><td></td></tr><tr><td></td><td></td></tr><tr><td>else lold =lt.</td><td></td></tr><tr><td>end if</td><td></td></tr><tr><td></td><td></td></tr><tr><td>Gradient step to update (0, μwx,Lwk) by maximising F(0,q(wk)).</td><td></td></tr><tr><td></td><td></td></tr><tr><td>end for</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>
129
+
130
+ In our experiments we will investigate several criteria where the most effective one will be an unsupervised criterion that only depends on the training inputs, while the other supervised criteria are described in the Appendix. This unsupervised criterion quantifies how well we reconstruct the full kernel matrix $K _ { X _ { k } }$ from the inducing set $Z _ { k }$ and it can be expressed as the trace of the covariance matrix of the prior GP conditional $p ( \mathbf { f } _ { k } | \mathbf { u } _ { k } )$ , i.e.
131
+
132
+ $$
133
+ \mathcal { T } ( Z _ { k } ) = \mathrm { t r } \left( K _ { X _ { k } } - K _ { X _ { k } Z _ { K } } K _ { Z _ { k } } ^ { - 1 } K _ { Z _ { k } X _ { k } } \right) = \sum _ { j = 1 } ^ { N _ { k } } \left[ k ( x _ { k , j } , x _ { k , j } ) - k _ { Z _ { K } , x _ { k , j } } ^ { \top } K _ { Z _ { k } } ^ { - 1 } k _ { Z _ { k } , x _ { k , j } } \right] ,
134
+ $$
135
+
136
+ where each $k ( x _ { k , j } , x _ { k , j } ) - k _ { Z _ { K } , x _ { k , j } } ^ { \top } K _ { Z _ { k } } ^ { - 1 } k _ { Z _ { k } , x _ { k , j } } \ : \geq 0$ is a reconstruction error for an individual training point. The above quantity appears in the ELBO in (Titsias, 2009), is also used in (Csato & Opper, 2002) and it has deep connections with the Nystróm approximation (Williams & Seeger, 2001) and principal component analysis. The criterion in equation 6 promotes finding inducing points $Z _ { k }$ that are repulsive with one another and are spread evenly in the input space under a similarity/distance implied by the dot product of the feature vector $\phi ( x ; \theta _ { k } )$ (with $\theta _ { k }$ being the current parameter values after having trained with the $k$ -th task). An illustration of this repulsive property is given in Section 4.
137
+
138
+ To select $Z _ { k }$ , we minimise $\mathcal { T } ( Z _ { k } )$ by applying discrete optimisation where we select points from the training inputs $X _ { k }$ . The specific optimisation strategy we use in the experiments is to start with an initial random set $Z _ { k } \subset X _ { k }$ and then further refine it by doing local moves where random points in $Z _ { k }$ are proposed to be changed with random points of $X _ { k }$ .
139
+
140
+ # 2.5 PREDICTION AND DIFFERENCES WITH WEIGHT SPACE METHODS
141
+
142
+ Prediction at any $i$ -th task that has been encountered in the past follows the standard sparse GP predictive equations. Given a test data point $x _ { i , * }$ the predictive density of its output value $y _ { i , * }$ takes the form $\begin{array} { r } { p ( y _ { i , * } ) = \int p ( y _ { i , * } | f _ { i , * } ) p _ { \theta } ( f _ { i , * } | \mathbf { u } _ { i } ) q ( \mathbf { u } _ { i } ) d \mathbf { \bar { u } } _ { i } d f _ { i , * } = \int p ( y _ { i , * } | f _ { i , * } ) q _ { \theta } ( f _ { i , * } ^ { - } ) d f _ { i , * } } \end{array}$ where $q _ { \theta } ( f _ { i , * } ) = \mathcal { N } ( f _ { i , * } | \mu _ { i , * } , \sigma _ { i , * } ^ { 2 } )$ is an univariate posterior Gaussian with mean and variance,
143
+
144
+ $$
145
+ \mu _ { i , * } = \mu _ { u _ { i } } ^ { \top } K _ { Z _ { i } } ^ { - 1 } \Phi _ { Z _ { 1 } } \phi ( x _ { i , * } ; \theta ) , \ \sigma _ { i , * } ^ { 2 } = k ( x _ { i , * } , x _ { i , * } ) + k _ { Z _ { i } x _ { i , * } } ^ { \top } K _ { Z _ { i } } ^ { - 1 } \left[ L _ { u _ { i } } L _ { u _ { i } } ^ { \top } - K _ { Z _ { i } } \right] K _ { Z _ { i } } ^ { - 1 } k _ { Z _ { i } x _ { i , * } } ,
146
+ $$
147
+
148
+ where in $\mu _ { i , * }$ we have explicitly written the cross kernel vector $k _ { Z _ { k } x _ { i , * } } = \Phi _ { Z _ { i } } \phi ( x _ { i , * } ; \theta )$ (assuming $\sigma _ { w } ^ { 2 } \ = \ 1$ for simplicity) to reveal a crucial property of this prediction. Specifically, given that $f _ { i , * } = w _ { i } ^ { \top } \phi ( x _ { i , * } ; \theta )$ the vector $\mu _ { u _ { i } } ^ { \top } K _ { Z _ { i } } ^ { - 1 } \Phi _ { Z _ { i } }$ acts as a mean prediction for the task-specific parameter row vector $\boldsymbol { w _ { i } ^ { \intercal } }$ . As we learn future tasks and the parameter $\theta$ changes, this mean parameter prediction automatically adapts (recall that $K _ { Z _ { i } } = \Phi _ { Z _ { i } } \Phi _ { Z _ { i } } ^ { \top }$ and $\Phi _ { Z _ { i } }$ vary with $\theta$ and only $\mu _ { u _ { i } }$ is constant) in order to counteract changes in the feature vector $\phi ( x _ { i , * } ; \theta )$ , so that the overall prediction for the function value, i.e. $\mu _ { i , * } = \mathbb { E } [ f _ { i , * } ]$ , does not become obsolete. For instance, the prediction of the function values at the inducing inputs $Z _ { i }$ always remains constant to our fixed/stored mean belief $\mu _ { u _ { i } }$ since by setting $x _ { i , * } = Z _ { i }$ the formula gives $\mu _ { u _ { i } } ^ { \top } K _ { Z _ { i } } ^ { - 1 } \Phi _ { Z _ { i } } \Phi _ { Z _ { i } } ^ { \top } = \mu _ { u _ { i } } ^ { \top }$ . Similar observations can be made for the predictive variances.
149
+
150
+ ![](images/095dca8b382e7de4b3cd78e50dba37ee4dacffb31e36516e0bb425f22844f1f6.jpg)
151
+ Figure 2: Detecting task boundaries using the predictive uncertainty of a Gaussian Process. As GP predictions revert to the prior (shaded blue) when queried far from observed data (shown as black dots), we can test for a distribution shift by comparing the GP posterior over functions (in green) to the prior. Small distance between predictive distributions at test points (red dots) suggest a task switch.
152
+
153
+ The above analysis reveals an important difference between continual learning in function space and in weight space, where in the latter framework task-specific parameters such as $w _ { i }$ might not automatically adapt to counteract changes in the feature vector $\phi ( x ; \theta )$ , as we learn new tasks and $\theta$ changes. For instance, if as a summary of the task, instead of the function space posterior distribution ${ \bf \nabla } { \bf } q ( { \bf u } _ { i } )$ , we had kept in memory the weight space posterior $q ( w _ { i } )$ (see Section 2.3), then the corresponding mean prediction on the function value, $\mathbf { \bar { E } } [ f _ { i , * } ] = \mu _ { w _ { i } } ^ { \top } \boldsymbol { \dot { \phi } } ( x _ { i , * } ; \theta )$ , can become obsolete as $\phi ( x _ { i , * } ; \theta )$ changes and $\mu _ { w _ { i } }$ remains constant.
154
+
155
+ # 3 DETECTING TASK BOUNDARIES USING BAYESIAN UNCERTAINTIES
156
+
157
+ So far we have made the assumption that task switches are known, which may not always be a realistic setting. Instead, we now introduce a novel approach for detecting task boundaries in continual learning arising naturally from our method by a simple observation: The GP predictive uncertainty grows as the model is queried far away from observed data, eventually falling back to the prior. When a minibatch of data posterior to be sm $\{ x _ { i } , y _ { i } \} _ { i = 1 } ^ { b }$ from a new task arrives, we thus expect the distance between prior andure 2). Thus, a simple way to detect a change in the input distribution is to compare the GP univariate posterior density
158
+
159
+ $$
160
+ q ( f ( x _ { i } ) ) = { \mathcal { N } } ( f ( x _ { i } ) | \mu _ { i } , \sigma _ { i } ^ { 2 } ) \approx \int p ( f ( x _ { i } ) | \mathbf { f } ) p ( \mathbf { f } | \mathbf { y } , X ) d f ( x _ { i } ) ,
161
+ $$
162
+
163
+ where $( \mu _ { i } , \sigma _ { i } ^ { 2 } )$ are predictive mean and variance, with the prior GP density $p ( f ( x _ { i } ) ) \ =$ $\mathcal { N } ( f ( x _ { i } ) | 0 , k ( x _ { i } , x _ { i } ) )$ . This can be achieved by using a divergence measure between distributions such as the symmetrised KL divergence,
164
+
165
+ $$
166
+ \ell _ { i } = 0 . 5 \Big ( \int q ( f ( x _ { i } ) ) \log \frac { q ( f ( x _ { i } ) ) } { p ( f ( x _ { i } ) ) } d f ( x _ { i } ) + \int p ( f ( x _ { i } ) ) \log \frac { p ( f ( x _ { i } ) ) } { q ( f ( x _ { i } ) ) } d f ( x _ { i } ) \Big ) , \ i = 1 , \dots , b ,
167
+ $$
168
+
169
+ computed separately for any $x _ { i }$ in the minibatch. Given that all distributions are univariate Gaussians the above can be obtained analytically. When each score $\ell _ { i }$ is close to zero this indicate that the input distribution has changed so that a task switch can be detected. Each $\ell _ { i } \geq 0$ can be thought of as expressing a degree of surprise about $x _ { i }$ , i.e. the smaller is $\ell _ { i }$ the more surprising is $x _ { i }$ . Thus our idea has close links to Bayesian surprise (Itti & Baldi, 2006).
170
+
171
+ In order to use this intuition to detect task switches, we can perform a statistical test between the values $\{ \ell _ { i } \} _ { i = 1 } ^ { b }$ for the current batch and those from the previous batch $\{ \ell _ { i } ^ { o l d } \} _ { i = 1 } ^ { b }$ before making any updates to the parameters using the current batch. A suitable choice is Welch’s t-test (due to unequal variances), demanding that with high statistical significance the mean of $\{ \ell _ { i } \} _ { i = 1 } ^ { b }$ is smaller than the mean of {\`oldi }bi= .
172
+
173
+ The ability to detect changes based on the above procedure arises from our framework as we construct posterior distributions over function values $f ( x _ { i } )$ that depend on inputs $x _ { i }$ (while in contrast a posterior over weights alone does not depend on any input). Subsequently, these predictive densities contain information about the distribution of these inputs in the sense that when an $x _ { i }$ is close to the training inputs from the same task we expect reduced uncertainty, while for inputs of a different task we expect high uncertainty that falls back to the prior uncertainty.
174
+
175
+ # 4 EXPERIMENTS
176
+
177
+ We now test the scalability and competitiveness of our method on various continual learning problems, referring to the proposed approach as Functional Regularised Continual Learning (FRCL). Throughout this section, we will aim to answer three key questions:
178
+
179
+ (i) How does FRCL compare to state-of-the-art algorithms for Continual Learning?
180
+ (ii) How important is a principled criterion for inducing point selection? How do varying numbers of inducing points/task affect overall performance?
181
+ (iii) If ground truth task boundaries are not given, does the detection method outlined in Section 3 succeed in detecting task changes?
182
+
183
+ In order to answer these questions, we consider experiments on three established Continual Learning classification problems: Split-MNIST, Permuted-MNIST and sequential Omniglot (Goodfellow et al., 2013; Zenke et al., 2017; Schwarz et al., 2018), described in the Appendix. FRCL methods have been implemented using GPflow (Matthews et al., 2017).
184
+
185
+ In addition to comparing our method with other approaches in the literature by quoting published results, we also show results for an additional baseline (BASELINE) corresponding to a simple replay-buffer method for Continual Learning (explained in the Appendix).
186
+
187
+ # 4.1 IS FRCL A COMPETITIVE MODEL FOR CONTINUAL LEARNING?
188
+
189
+ Addressing first question (i), we show results on the MNIST-variations in Table 1 and on the more challenging Omniglot benchmark in Table 2. Note that we also specify the inducing point optimisation criterion in brackets, i.e. FRCL (TRACE-TERM) corresponds to the loss in equation 6. We observe strong results on all benchmarks, setting a new state-of-the-art results on Permuted-MNIST & Omniglot while coming close to existing results on Split-MNIST. The improvement on the BASELINE shows that approximate posterior distributions over functions values can lead to more effective regularisation for CL compared to just having a replay buffer of input-output pairs. Furthermore, despite its simplicity, the simple BASELINE strategy performs competitively. In line with other results, we conclude that rehearsal-based ideas continue to provide a strong baseline. This also gives justification to a main motivation of this work:
190
+
191
+ ![](images/ac01f742def4f9a18b10db91c27fdf4ab26062142e41ecdfb6fb9560e31599f0.jpg)
192
+ Figure 3: Comparing optimisation criteria for varying number of inducing points.
193
+
194
+ To unite the two previously separate lines of CL work on rehearsal-based and Bayesian methods.
195
+ Nevertheless, other methods may be more suitable when storing data is not feasible.
196
+
197
+ # 4.2 INDUCING POINT OPTIMISATION AND TASK SWITCH DETECTION
198
+
199
+ An appealing theoretical property of our method is the principled selection of inducing points through optimisation. Answering question (ii), we now proceed to investigate the importance of the criterion used as well as the dependence on the number of inducing points. These results are shown in Figure 3. Note that the definition of objectives Class. Error, ELBO & Log pred. density are given in the Appendix. In accordance with our intuition, we observe that optimisation becomes increasingly important as the number of inducing points is reduced. The results also give strong statistical motivation to use the trace-term motivated before. Further, as can be seen looking at the results for Log pred. density, a poorly chosen criterion may behave worse than random.
200
+
201
+ Table 1: Results on Permuted- and Split-MNIST. Baseline results are taken from Nguyen et al. (2017). For the experiments conducted in this work we show the mean and standard deviation over 10 random repetitions. Where applicable, we also report the number of inducing points/replay buffer size per task in parentheses.
202
+
203
+ <table><tr><td>Algorithm</td><td>Permuted-MNIST</td><td>Split-MNIST</td></tr><tr><td>DLP (Eskin et al., 2004)</td><td>82%</td><td>61.2%</td></tr><tr><td>EWC (Kirkpatrick et al., 2017)</td><td>84%</td><td>63.1%</td></tr><tr><td>SI (Zenke et al., 2017)</td><td>86%</td><td>98.9%</td></tr><tr><td>VCL (Nguyen et al., 2017)</td><td>90%</td><td>97.0%</td></tr><tr><td>+ random Coreset</td><td>93% (200 points/task)</td><td></td></tr><tr><td>+ k-center Coreset</td><td>93% (200 points/task)</td><td></td></tr><tr><td>+unspecified Coreset selection</td><td></td><td>98.4% (40 points/task)</td></tr><tr><td>BASELINE</td><td>48.6% ± 1.7 (10 points/task)</td><td></td></tr><tr><td>FRCL (RANDOM)</td><td>48.2% ± 4.0 (10 points/task)</td><td>59.8% ± 8.0 (2 points/task)</td></tr><tr><td>FRCL (TRACE)</td><td>61.7% ± 1.8 (10 points/task)</td><td>82.0% ± 5.0 (2 points/task)</td></tr><tr><td>BASELINE</td><td>82.3% ± 0.3 (200 points/task)</td><td>95.8% ± 1.1 (40 points/task)</td></tr><tr><td>FRCL (RANDOM)</td><td>94.2% ±0.1 (200 points/task)</td><td>97.1% ±0.7 (40 points/task)</td></tr><tr><td>FRCL(TRACE)</td><td>94.3% ± 0.2 (200 points/task)</td><td>97.8% ± 0.7 (40 points/task)</td></tr></table>
204
+
205
+ Table 2: Results on sequential Omniglot. Baseline results are taken from Schwarz et al. (2018). Shown are mean and standard deviation over 5 random task permutations. Note that methods ‘Single model per Task’ and ‘Progressive Nets’ are not directly comparable due to unrealistic assumptions, but serve as an upper bound on the performance for the remaining continual learning methods.
206
+
207
+ <table><tr><td>Algorithm</td><td colspan="2">Test Accuracy</td></tr><tr><td>Single model per Task</td><td colspan="2">88.34</td></tr><tr><td>Progressive Nets</td><td colspan="2">86.50 ± 0.9</td></tr><tr><td>Finetuning</td><td colspan="2">26.20 ± 4.6</td></tr><tr><td>Learning Without Forgetting</td><td colspan="2">62.06 ± 2.0</td></tr><tr><td>Elastic Weight Consolidation (EWC)</td><td colspan="2">67.32 ± 4.7</td></tr><tr><td>Online EWC</td><td colspan="2">69.99 ± 3.2</td></tr><tr><td>Progress &amp; Compress</td><td colspan="2">70.32 ± 3.3</td></tr><tr><td>Methods evaluated in this paper</td><td>1 point/char</td><td>2 points/char 3 points/char</td></tr><tr><td>BASELINE</td><td>42.73 ± 1.2 57.17 ± 1.2</td><td>65.32 ± 1.1</td></tr><tr><td>FRCL (RANDOM)</td><td>69.74 ± 1.1 80.32 ± 2.5</td><td>81.42 ± 1.2</td></tr><tr><td>FRCL (TRACE)</td><td>72.02 ± 1.3 81.47 ± 1.6</td><td>81.01 ± 1.1</td></tr></table>
208
+
209
+ ![](images/11b29b6ba57361ff6a6516ce4b4da86c74d0830f501b8c41212bf0f4431864ed.jpg)
210
+ (a) A TSNE projection of inducing points in feature space. (c) Optimised inducing points
211
+ Figure 4: Inducing point optimisation for the first task on the Permuted-MNIST benchmark. The number of inducing points was limited to 10. Left: A example optimisation shown in the feature space of a trained network. Points are coloured by class label. Data shown corresponds to the first row in the images on the right. Right: Optimised inducing points consistently cover examples of all classes. Each row corresponds to a different run with random initialisation. Best viewed in colour.
212
+
213
+ To provide an insight into the solutions obtained by the trace-term criterion, we provide a visualisation of inducing points in Figure 4. Remarkably, even though the objective is unsupervised, it results in a consistent allocation of one example per class. Furthermore, the optimised inducing points are spread across the input space as shown by the TNSE (Maaten & Hinton, 2008) visualisation, which is in line with the intuition that the objective encourages repulsive inducing points.
214
+
215
+ Finally, we answer question (iii) by first showing both the mean of the terms $\{ \ell _ { i } \} _ { i = 1 } ^ { b }$ (top) as well as the result of Welch’s t-test (bottom) between terms $\{ \ell _ { i } \} _ { i = 1 } ^ { b }$ , $\{ \ell _ { i } ^ { o l d } \} _ { i = 1 } ^ { b }$ in Figure 5, using only a small number Omniglot alphabets and 1000 training iterations per task for illustrative purposes. We note that the intuition built up in Section 3 holds, with clear spikes being shown whenever the t-test returns a positive result.
216
+
217
+ Furthermore, we provide a quantitative comparison in Table 3. On the positive side, we note very strong results for Split- & Perm-MNIST and further observe that we find a similar t-test threshold value to apply to all dataset, making this an easy hyper-parameter to set. While the task boundary detection results for Omniglot are less strong, which may due to the smaller batch size (32 for Omniglot, $\geq 1 0 0$ for the MNIST-versions), resulting in a noisier test result. Note that this could be easily mitigated by using a larger set $\{ \ell _ { i } ^ { o l d } \}$ , e.g. the last 10 minibatches, which would make this test more robust.
218
+
219
+ Table 3: Task boundary detection evaluated as a binary classification task (Positive labels corresponds to task switches).
220
+
221
+ <table><tr><td colspan="3">Precision/Recall/F1 @ Threshold</td></tr><tr><td></td><td>Split-MNIST</td><td>Perm-MNIST Omniglot</td></tr><tr><td>4.0</td><td>0.94/1.0/0.97</td><td>0.43/0.98/0.60 0.13/0.90/0.23</td></tr><tr><td>5.0</td><td>1.0/1.0/1.0 0.95/0.94/0.94</td><td>0.71/0.75/0.73</td></tr><tr><td>6.0</td><td>1.0/1.0/1.0 1.0/0.91/0.95</td><td>0.89/0.59/0.71</td></tr><tr><td>7.0</td><td>1.0/1.0/1.0 1.0/0.91/0.95</td><td>0.89/0.46/0.60</td></tr><tr><td>8.0</td><td>1.0/1.0/1.0 1.0/0.86/0.92</td><td>0.88/0.32/0.46</td></tr></table>
222
+
223
+ ![](images/bc9291cb06d6dd9f46342e2774e496a253576628cd6b70dcb28d3959a9fe39ac.jpg)
224
+ Figure 5: Visualising KL terms and test statistics on multiple Omniglot tasks.
225
+
226
+ # 5 DISCUSSION
227
+
228
+ We introduced a functional regularisation approach for supervised continual learning that combines inducing point GP inference with deep neural networks. Our method constructs task-specific posterior beliefs or summaries on inducing inputs. Subsequently, the task-specific summaries allow us to regularise continual learning and avoid catastrophic forgetting. Our approach unifies the two extant approaches to continual learning, of parameter regularisation and replay/rehersal. Viewed from the regularisation perspective, our approach regularises the functional outputs of the neural network, thus avoid the brittleness due to representation drift. Viewed from a rehearsal method perspective, we provide a principled way of compressing data from previous task, by means of optimizing the selection of inducing points. By investigating the behaviour of the posterior beliefs, we also proposed a method for detecting task boundaries. All these improvements lead to strong empirical gains compared to state-of-the-art continual learning methods.
229
+
230
+ Regarding related work on online learning using GPs, notice that previous algorithms (Bui et al., 2017a; Csato & Opper, 2002; Csato, 2002) learn in an online fashion a single task where data from this task arrive sequentially. In contrast in this paper we developed a continual learning method for dealing with a sequence of different tasks.
231
+
232
+ A direction for future research is to enforce a fixed memory buffer (or a buffer that grows sub-linearly w.r.t. the number of tasks), in which case one would need to compress the summaries of all previous seen tasks into a single summary. Finally, while in this paper we applied the method to supervised classification tasks, it will be interesting to consider also applications in other domains such as reinforcement learning.
233
+
234
+ # ACKNOWLEDGEMENTS
235
+
236
+ We would like to thank Hyunjik Kim and Raia Hadsell for useful discussions and feedback.
237
+
238
+ # REFERENCES
239
+
240
+ Mauricio A. Álvarez, Lorenzo Rosasco, and Neil D. Lawrence. Kernels for vector-valued functions: A review. Found. Trends Mach. Learn., 4(3):195–266, March 2012. ISSN 1935-8237. doi: 10.1561/2200000036. URL http://dx.doi.org/10.1561/2200000036.
241
+
242
+ Edwin V Bonilla, Kian M. Chai, and Christopher Williams. Multi-task gaussian process prediction. In J. C. Platt, D. Koller, Y. Singer, and S. T. Roweis (eds.), Advances in Neural Information Processing Systems 20, pp. 153–160. Curran Associates, Inc., 2008. URL http://papers. nips.cc/paper/3189-multi-task-gaussian-process-prediction.pdf.
243
+
244
+ Thang D Bui, Cuong Nguyen, and Richard E Turner. Streaming Sparse Gaussian Process Approximations. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 3299–3307. Curran Associates, Inc., 2017a.
245
+
246
+ Thang D. Bui, Josiah Yan, and Richard E. Turner. A Unifying Framework for Gaussian Process Pseudo-Point Approximations using Power Expectation Propagation. Journal of Machine Learning Research, 18(104):1–72, 2017b.
247
+
248
+ Csato. Gaussian processes: iterative sparse approximations. PhD thesis, Aston University, 2002.
249
+
250
+ L. Csato and M. Opper. Sparse online Gaussian processes. Neural Computation, 14:641–668, 2002.
251
+
252
+ Amir Dezfouli and Edwin V Bonilla. Scalable Inference for Gaussian Process Models with BlackBox Likelihoods. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 1414–1422. 2015.
253
+
254
+ Eleazar Eskin, Alex J Smola, and SVN Vishwanathan. Laplace propagation. In Advances in neural information processing systems, pp. 441–448, 2004.
255
+
256
+ Sebastian Farquhar and Yarin Gal. Towards Robust Evaluations of Continual Learning. arXiv preprint arXiv:1805.09733, 2018.
257
+
258
+ Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211, 2013.
259
+
260
+ James Hensman, Nicolo Fusi, and Neil D Lawrence. Gaussian processes for Big Data. In Conference on Uncertainty in Artificial Intellegence, pp. 282–290. auai.org, 2013.
261
+
262
+ James Hensman, Alexander G de G Matthews, and Zoubin Ghahramani. Scalable Variational Gaussian Process Classification. In Proceedings of the Eighteenth International Conference on Artificial Intelligence and Statistics, 2015.
263
+
264
+ Laurent Itti and Pierre F Baldi. Bayesian surprise attracts human attention. In Advances in neural information processing systems, pp. 547–554, 2006.
265
+
266
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, pp. 201611835, 2017.
267
+
268
+ Brenden Lake, Ruslan Salakhutdinov, Jason Gross, and Joshua Tenenbaum. One shot learning of simple visual concepts. In Proceedings of the Annual Meeting of the Cognitive Science Society, volume 33, 2011.
269
+
270
+ Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017.
271
+
272
+ Chris Lloyd, Tom Gunter, Michael A. Osborne, and Stephen J. Roberts. Variational inference for gaussian process modulated poisson processes. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 1814– 1822, 2015.
273
+
274
+ David Lopez-Paz et al. Gradient episodic memory for continual learning. In Advances in Neural Information Processing Systems, pp. 6470–6479, 2017.
275
+
276
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
277
+
278
+ Alexander G. de G. Matthews, Mark van der Wilk, Tom Nickson, Keisuke. Fujii, Alexis Boukouvalas, Pablo Le‘on-Villagr‘a, Zoubin Ghahramani, and James Hensman. GPflow: A Gaussian process library using TensorFlow. Journal of Machine Learning Research, 18(40):1–6, April 2017.
279
+
280
+ Cuong V Nguyen, Yingzhen Li, Thang D Bui, and Richard E Turner. Variational continual learning. arXiv preprint arXiv:1710.10628, 2017.
281
+
282
+ Carl Edward Rasmussen and Christopher K. I. Williams. Gaussian Processes for Machine Learning (Adaptive Computation and Machine Learning). The MIT Press, 2005. ISBN 026218253X.
283
+
284
+ Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H Lampert. icarl: Incremental classifier and representation learning. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5533–5542. IEEE, 2017.
285
+
286
+ Mark Bishop Ring. Continual learning in reinforcement environments. PhD thesis, University of Texas at Austin Austin, Texas 78712, 1994.
287
+
288
+ Anthony Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7(2): 123–146, 1995.
289
+
290
+ Anthony Robins and Simon McCallum. Catastrophic forgetting and the pseudorehearsal solution in hopfield-type networks. Connection Science, 10(2):121–135, 1998.
291
+
292
+ David Rolnick, Arun Ahuja, Jonathan Schwarz, Timothy P Lillicrap, and Greg Wayne. Experience replay for continual learning. arXiv preprint arXiv:1811.11682, 2018.
293
+
294
+ Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
295
+
296
+ Jürgen Schmidhuber. Powerplay: Training an increasingly general problem solver by continually searching for the simplest still unsolvable problem. Frontiers in psychology, 4:313, 2013.
297
+
298
+ Jonathan Schwarz, Jelena Luketina, Wojciech M Czarnecki, Agnieszka Grabska-Barwinska, Yee Whye Teh, Razvan Pascanu, and Raia Hadsell. Progress & compress: A scalable framework for continual learning. arXiv preprint arXiv:1805.06370, 2018.
299
+
300
+ Rishit Sheth, Yuyang Wang, and Roni Khardon. Sparse variational inference for generalized gp models. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 1302–1311, Lille, France, 07–09 Jul 2015. PMLR.
301
+
302
+ Edward Snelson and Zoubin Ghahramani. Sparse gaussian processes using pseudo-inputs. In Y. Weiss, B. Schölkopf, and J. C. Platt (eds.), Advances in Neural Information Processing Systems 18, pp. 1257–1264. 2006.
303
+
304
+ Michalis K Titsias. Variational learning of inducing variables in sparse Gaussian processes. In International Conference on Artificial Intelligence and Statistics, pp. 567–574, 2009.
305
+
306
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pp. 3630–3638, 2016.
307
+
308
+ Christopher K. I. Williams and Matthias Seeger. Using the nyström method to speed up kernel machines. In T. K. Leen, T. G. Dietterich, and V. Tresp (eds.), Advances in Neural Information Processing Systems 13, pp. 682–688. MIT Press, 2001.
309
+
310
+ Andrew Gordon Wilson, Zhiting Hu, Ruslan Salakhutdinov, and Eric P. Xing. Deep kernel learning. In Arthur Gretton and Christian C. Robert (eds.), Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, volume 51 of Proceedings of Machine Learning Research, pp. 370–378, Cadiz, Spain, 09–11 May 2016. PMLR.
311
+
312
+ Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. arXiv preprint arXiv:1703.04200, 2017.
313
+
314
+ # A TASK DESCRIPTIONS
315
+
316
+ Split-MNIST and Permuted-MNIST. Among a large number of diverse experiments in continual learning publications, two versions of the popular MNIST dataset have recently started to become increasingly popular benchmarks: Permuted- and Split-MNIST. In Permuted-MNIST (e.g. Goodfellow et al., 2013; Kirkpatrick et al., 2017; Zenke et al., 2017), each task is a variant of the initial 10-class MNIST classification task where all input pixels have undergone a fixed (random) permutation. The Split-MNIST experiment was introduced by Zenke et al. (2017): Five binary classification tasks are constructed from the classes in the following order: 0/1, 2/3, 4/5, 6/7, and 8/9.
317
+
318
+ Omniglot. To assess our method under more challenging conditions, we consider the sequential Omniglot task proposed for continual learning in Schwarz et al. (2018). Omniglot Lake et al. (2011) is a dataset of 50 alphabets, each with a varying number of classes/characters which we treat of as a sequence of distinct classification problems. As suggested in Schwarz et al. (2018), for Omniglot, we apply data-augmentation and use the same train/validation/test split. Following the same experimental setup proposed, we used an identical convolutional network to construct the feature vector $\phi ( x ; \theta )$ . Results reported are obtained by training on the union of training and validation set after choosing any hyper-parameters based on the validation set. Note that all experiments were run with data processing and neural network construction code kindly provided by the authors in Schwarz et al. (2018), ensuring directly comparable results.
319
+
320
+ Given that Permuted-MNIST and Omniglot are multi-class classification problems, where each $k$ -th task involves classification over $C _ { k }$ classes, we need to generalise the model and the variational method to deal with multiple GP functions per task. This is outlined in the next section.
321
+
322
+ # B EXTENSION TO MULTI-CLASS (OR MULTIPLE-OUTPUTS) TASKS
323
+
324
+ For multi-class classification problems, such as permuted MNIST and Omniglot considered in our experiments, where in general each $k$ -th task involves classification over varying number of classes, we need to extend the method to deal with multiple functions per task. For instance, assume that the $k$ -th task is a multi-class classification problem that inolves $C _ { k }$ classes. To model this we need $C _ { k }$ independent draws from the GP, such that $f _ { k } ^ { c } ( x ) \sim \mathcal { G P } ( 0 , k ( x , x ^ { \prime } ) )$ with $c = 1 , \ldots , C _ { k }$ , which are combined based on a multi-class likelihood such as softmax. While in the main text we presented the method assuming a single GP function per task, the generalisation to multiple functions is straightforward by assuming that all variational approximations factorise across different functions/classes. For example, the variational distribution over all inducing variables $U _ { k } = \{ \mathbf { u } _ { k } ^ { c } \} _ { c = 1 } ^ { C _ { k } }$ takes the form $\begin{array} { r } { q ( U _ { k } ) = \prod _ { c = 1 } ^ { C _ { k } } q ( \mathbf { u } _ { k } ^ { c } ) } \end{array}$ and similarly the variational approximation over the task weights ${ { W } _ { k } } = \left\{ w _ { k } ^ { c } \right\}$ , needed in the ELBO in Section 3.2, also factorises across classes. Notice also that all inducing variables $U _ { k }$ are evaluated on the same inputs $Z _ { k }$ . Furthermroe, the KL regularization term for each task takes the form of a sum over the different functions, i.e. $\mathrm { K L } ( q ( U _ { k } ) | \bar { | } p _ { \theta } ( U _ { k } ) ) =$ $\begin{array} { r } { \sum _ { c = 1 } ^ { { C _ { k } } } \mathrm { K L } ( q ( \mathbf { u } _ { k } ^ { c } ) | | p _ { \theta } ( \mathbf { u } _ { k } ^ { c } ) ) } \end{array}$ .
325
+
326
+ # C BASELINE MODEL
327
+
328
+ The BASELINE model (see main text) is based on storing an explicit replay buffer $( \widetilde { \mathbf { y } } _ { i } , \widetilde { X } _ { i } )$ , i.e. a subset of the training data where $\widetilde { \mathbf { y } } _ { i } \subset \mathbf { y } _ { i }$ and $\widetilde { X } _ { i } \subset X _ { i }$ , for each past task. Then, at each step when we encounter the $k$ e-th task training is performed by optimising an unbiased estimate of the full loss
329
+
330
+ (i.e. if we had all $k$ tasks at once), given by
331
+
332
+ $$
333
+ L ( \theta , w _ { 1 : k } ) = \ell _ { k } ( \mathbf { y } _ { k } , X _ { k } ; w _ { k } , \theta ) + \sum _ { i = 1 } ^ { k - 1 } \frac { N _ { i } } { M _ { i } } \ell _ { i } ( \widetilde { \mathbf { y } } _ { i } , \widetilde { X } _ { i } ; w _ { i } , \theta ) ,
334
+ $$
335
+
336
+ where each $\ell _ { i } ( \cdot )$ is a task-specific loss function, such as cross entropy for classification, and each scalar $\frac { N _ { i } } { M _ { i } }$ corrects for the bias on the loss value caused by approximating the initial full loss by a random replay buffer of size $M _ { i }$ . All output weights $w _ { i : k }$ of the current and old tasks, in the multi-head architecture, are constantly updated together with the feature parameter vector $\theta$ . Also at each step a fresh set of output weights is constructed in order to deal with the current task.
337
+
338
+ # D SELECTION OF THE INDUCING POINTS AND OPTIMISATION CRITERIA
339
+
340
+ After having seen the $k$ -th task, and given that it is straightforward to compute the posterior distribution $q ( { \mathbf { u } } _ { k } )$ for any set of function values, the only issue remaining is to select the inducing inputs $Z _ { k }$ . A simple choice that works well in practice is to select $Z _ { k }$ as a random subset of the training inputs $X _ { k }$ . The question is whether we can do better with some more structured criterion. In our experiments we will investigate three supervised criteria, that make use of class labels, and one unsupervised that only depends on inputs and the neural network feature vector. All criteria below optimise over $Z _ { k }$ using discrete search.
341
+
342
+ The first supervised criterion is to minimize the negative average log predictive density,
343
+
344
+ $$
345
+ \mathrm { L o g \ p r e d . \ d e n s i t y } ( Z _ { k } ) = - { \frac { 1 } { | X _ { k } \setminus Z _ { k } | } } \sum _ { \substack { x _ { k , j } \in X _ { k } \setminus Z _ { k } } } \log p ( y _ { k , j } | Z _ { k } ) ,
346
+ $$
347
+
348
+ computed at all remaining training inputs by excluding the selected inducing inputs $Z _ { k }$ . Each predictive density $p ( y _ { k , j } | Z _ { k } )$ is obtained through the inducing inputs $Z _ { k }$ and it takes the form
349
+
350
+ $$
351
+ p ( y _ { k , j } | Z _ { k } ) = \int p ( y _ { k , j } | f _ { k , j } ) q ( \mathbf { u } _ { k } | Z _ { k } ) d \mathbf { u } _ { k } = \int p ( y _ { k , j } | f _ { k , j } ) \mathcal { N } ( \mathbf { u } _ { k } | \mu _ { u _ { k } } , L _ { u _ { k } } L _ { u _ { k } } ^ { \top } ) d \mathbf { u } _ { k } ,
352
+ $$
353
+
354
+ which for the classification problems, where the likelihood $p ( y _ { k , j } | f _ { k , j } )$ is not Gaussian, is computed numerically by one-dimensional Gaussian quadrature. Notice that for the multi-class case the predictive density is obtained by integrating over $q ( U _ { k } ) \equiv q ( U _ { k } | Z _ { k } )$ (see previous Appendix B). Modern GP packages, such as GPflow, provide efficient implementation of the above predictive densities.
355
+
356
+ The second supervised criterion is similar, but $- \log p ( y _ { k , j } | Z _ { K } )$ is replaced by classification error score $I ( y _ { k , j } \neq y _ { k , j } ^ { * } )$ ),
357
+
358
+ $$
359
+ \mathrm { C l a s s . ~ E r r o r } ( Z _ { k } ) = \frac { 1 } { \left| X _ { k } \setminus Z _ { k } \right| } \sum _ { \substack { x _ { k , j } \in X _ { k } \setminus Z _ { k } } } I ( y _ { k , j } \neq y _ { k , j } ^ { * } ) ,
360
+ $$
361
+
362
+ where $y _ { k , j } ^ { * }$ is the predicted label, which is obtained by first computing the predictive density $p ( y _ { k , j } | Z _ { k } )$ conditional on a given set of inducing inputs $Z _ { k }$ and then choosing $y _ { k , j } ^ { * }$ by taking argmax (i.e. selecting the class with the largest predictive probability).
363
+
364
+ Both criteria above essentially capture how well we predict the remaining points from the inducing points $Z _ { k }$ , thus good choices for $Z _ { k }$ are presumably those that lead to good prediction for the remaining points.
365
+
366
+ The third supevised criterion is the standard sparse GP variational lower bound,
367
+
368
+ $$
369
+ \mathrm { E L B O } ( Z _ { k } ) = \sum _ { j = 1 } ^ { N _ { k } } \mathbb { E } _ { q ( f _ { k , j } ) } [ \log p ( y _ { k , j } | f _ { k , j } ) ] - \mathrm { K L } ( q ( \mathbf { u } _ { k } | Z _ { k } ) | | p _ { \theta } ( \mathbf { u } _ { k } | Z _ { k } ) ) ,
370
+ $$
371
+
372
+ which is viewed purely as a function of $Z _ { k }$ while all remaining quantities are constant. This criterion tries to optimise over $Z _ { k }$ in order to approximate as best as possible the marginal likelihood on the training data and it is the one used by all variational sparse GP training methods (although there the ELBO is maximized jointly over both $Z _ { k }$ with the remaining parameters).
373
+
374
+ The last unsupervised criterion (also discussed in the main paper) expresses how well we reconstruct the full kernel matrix $K _ { X _ { k } }$ from the inducing set $Z _ { k }$ , which can be described by
375
+
376
+ $$
377
+ \mathrm { T r a c e \ t e r m } ( Z _ { k } ) = \left( K _ { X _ { k } } - K _ { X _ { k } Z _ { k } } K _ { Z _ { k } } ^ { - 1 } K _ { Z _ { k } X _ { k } } \right) = \sum _ { j = 1 } ^ { N _ { k } } \left[ k ( x _ { k , j } , x _ { k , j } ) - k _ { Z _ { K } , x _ { j , k } } ^ { \top } K _ { Z _ { k } } ^ { - 1 } k _ { Z _ { k } , x _ { i , k } } \right] ,
378
+ $$
379
+
380
+ where each k(xk,j , xk,j ) − k>ZK,xj,k K $\begin{array} { r } { k ( x _ { k , j } , x _ { k , j } ) - k _ { Z _ { K } , x _ { j , k } } ^ { \top } K _ { Z _ { k } } ^ { - 1 } k _ { Z _ { k } , x _ { i , k } } \ : \geq \ : 0 } \end{array}$ is a reconstruction error for an individual training point. The above quantity appears in the ELBO in (Titsias, 2009), is also used in (Csato & Opper, 2002) and it has deep connections with the Nystróm approximation (Williams & Seeger, 2001) and principal component analysis. The criterion in equation 6 promotes finding inducing points $Z _ { k }$ that are repulsive with one another and are spread evenly in the input space under a similarity/distance implied by the dot product of the feature vector $\phi ( x ; \theta _ { k } )$ (with $\theta _ { k }$ being the current parameter values after having trained with the $k$ -th task). An illustration of this is given in the Figure 4.
381
+
382
+ Figure 4 in the Experiments Section illustrates the optimisation of the inducing inputs in PermutedMNIST. Also, Figure 6(a) shows randomly chosen (3 examples per class) for the Greek alphabet/task in the Omniglot experiments, while Figure 6(b) shows the corresponding points after have been optimised by using the trace criterion above.
383
+
384
+ Figure 3 shows the evolution of the performance for all selection criteria on individual tasks for Split-MNIST and Permuted-MNIST.
385
+
386
+ ![](images/bd3fd4196442dde0a2f46968db13dfd8640a1fde485e7d66dfb715b1075342d1.jpg)
387
+ Figure 6: Inducing points for Greek alphabet of the Omniglot benchmark. The number of inducing points was limited to 3 per character.
388
+
389
+ # E TASK BOUNDARY DETECTION
390
+
391
+ In order to apply the task-boundary detection for multiple classes, we perform Welch’s t-test separately for each function. We consider mean, median and the maximum of those t-test results to make a decision. Furthermore, we also found that conducting the test in log-space significantly improved robustness of the test results and thus find that tests using the max over functions in log-space allow for higher thresholds and more robust results. In order to give justification to those conclusions we show our experiments on Permuted-MNIST in Figure 7, once again using 10 random task permutations.
392
+
393
+ Note also that after a task boundary was detected, we do not consider a new test for the next 10 iterations.
394
+
395
+ At this point it should be said that while the boundary detection method is simple, cheap to compute, unsupervised and general, it is not applicable when the Continual Learning faces a continuum of tasks without clear switches or when the input distribution is constant and different tasks merely correspond to varying labels.
396
+
397
+ ![](images/c77a041ac1adb156863420ace7927929f4117f328509bb7aee971b47617b4c25.jpg)
398
+ Figure 7: Ablation study comparing aggregation methods and whether tests should be conducted in log-space. Results are shown on Permuted MNIST, 10 random task permutations.
399
+
400
+ Table 4: Hyperparameters for the experiments on Split MNIST. Optimal values (in bold) were chosen on the validation set. Test set results were obtained by training on the union of training&validation set using those values.
401
+
402
+ <table><tr><td>Parameter</td><td>Considered range</td><td>Comment</td></tr><tr><td>Network size (#Layers × Units) Activation function</td><td>{2}×{256} {f(x) : max(0,x) (ReLu)}</td><td>Based on Zenke et al. (2017). 1</td></tr><tr><td>Learning rate</td><td>{5·10-4,10-4,5 · 10-5}</td><td></td></tr><tr><td>Batch size</td><td>{32,64,100,128}</td><td></td></tr><tr><td>#Training steps</td><td>{2500,3000,3500}</td><td></td></tr><tr><td>#Inducing points optimisation steps</td><td>{1000,2000}</td><td>No significant difference.</td></tr></table>
403
+
404
+ # F EXPERIMENTAL DETAILS
405
+
406
+ Experimental details for all experiments are shown in Tables 4, 5 and 6. Note that for the MNIST results, we obtain final results after optimising hyperparameters on the validation set and using those values to train on the union of training & validation set.
407
+
408
+ For Omniglot on the other hand, we report final test-set results only after training on the training set in order to remain consistent with the results in Schwarz et al. (2018)
409
+
410
+ Table 5: Hyperparameters for the experiments on Permuted MNIST. Optimal values (in bold) were chosen on the validation set. Test set results were obtained by training on the union of training&validation set using those values.
411
+
412
+ <table><tr><td>Parameter</td><td>Considered range</td><td>Comment</td></tr><tr><td>Network size (#Layers × Units) Activation function</td><td>{2}×{100} {f(x) :max(0,x) (ReLu)}</td><td>Based on Zenke et al. (2017).</td></tr><tr><td>Learning rate</td><td>{10-3,5:10-4,10-4,5.10-5}</td><td></td></tr><tr><td>Batch size</td><td>{32,64,128}</td><td></td></tr><tr><td>#Training steps</td><td>{2000,2500}</td><td>No significant difference.</td></tr><tr><td>#Inducing points optimisation steps</td><td>{1000,2000}</td><td>No significant difference.</td></tr></table>
413
+
414
+ Table 6: Hyperparameters for the experiments on Omniglot. Optimal values (in bold) were chosen on the validation set. Test set results were obtained by training on the union of training&validation set using those values.
415
+
416
+ <table><tr><td>Parameter</td><td>Considered range</td><td>Comment</td></tr><tr><td>Conv. filters</td><td>{[64,64,64,64]}</td><td>Based on Vinyals et al. (2016).</td></tr><tr><td>Conv. Kernel size</td><td>{3×3}</td><td>1</td></tr><tr><td>Conv. Padding</td><td>{SAME}</td><td>&quot;</td></tr><tr><td>Max Pool.Kernel size</td><td>{3×3}</td><td>1</td></tr><tr><td>Max Pool. stride</td><td>{2×2}</td><td>1</td></tr><tr><td>Max Pool. Padding</td><td>{VALID}</td><td>1</td></tr><tr><td>Activation function</td><td>{f(x) : max(0,x) (ReLu)}</td><td>1</td></tr><tr><td>Learning rate</td><td>{10-3,5:10-4,10-4}</td><td></td></tr><tr><td>Batch size</td><td>{32}</td><td></td></tr><tr><td>#Training steps</td><td>{2500}</td><td></td></tr><tr><td>#Inducing points optimisation steps</td><td>{1000,2000}</td><td>No significant difference.</td></tr></table>
417
+
418
+ # G COMPARISON TO VCL ON OMNIGLOT
419
+
420
+ To provide a further comparison to VCL (Nguyen et al., 2017), we show results on Omniglot using Multi-Layer Perceptrons (MLP). A comparison with MLPs is due to the fact that reliable variational inference methods for CNNs (which are usually used for Omniglot) are yet to be developed. All our results for VCL are obtained using code provided by the authors.
421
+
422
+ For all experiments, we used an MLP with 4 hidden layers of 256 units each and ReLU activations, a batch size of 100 and the Adam Optimiser (Step size of 0.001 for VCL and 0.0001 for FRCL). We optimised both types of algorithms independently and found the following parameters:
423
+
424
+ 1. VCL: 100 training epochs per task, 50 adaptation epochs to coreset, Multi-Head
425
+
426
+ 2. FRCL (TRACE): 1500 training steps per task, 2000 discrete optimization steps, inducing points initialised as a uniform distribution over classes.
427
+
428
+ Table 7: Results on sequential Omniglot using a MLP.
429
+
430
+ <table><tr><td>Algorithm VCL (NO CORESET)</td><td colspan="3">Test Accuracy 48.4 ± 0.7</td></tr><tr><td></td><td>1 point/char</td><td>2 points/char</td><td>3 points/char</td></tr><tr><td>VCL (RANDOM CORESET)</td><td>49.18 ± 2.1</td><td>50.5 ± 1.2</td><td>51.64 ± 1.0</td></tr><tr><td>VCL ( (K-CENTER CORESET)</td><td>48.89 ± 1.1</td><td>49.58 ± 1.4</td><td>49.61 ± 1.0</td></tr><tr><td>FRCL (TRACE)</td><td>48.84 ± 1.1</td><td>52.10 ± 1.2</td><td>53.86 ± 2.3</td></tr></table>
parse/train/HkxCzeHFDB/HkxCzeHFDB_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HkxCzeHFDB/HkxCzeHFDB_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HkxCzeHFDB/HkxCzeHFDB_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/SkeGvaEtPr/SkeGvaEtPr.md ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL MARKOV LOGIC NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We introduce Neural Markov Logic Networks (NMLNs), a statistical relational learning system that borrows ideas from Markov logic. Like Markov Logic Networks (MLNs), NMLNs are an exponential-family model for modelling distributions over possible worlds, but unlike MLNs, they do not rely on explicitly specified first-order logic rules. Instead, NMLNs learn an implicit representation of such rules as a neural network that acts as a potential function on fragments of the relational structure. Interestingly, any MLN can be represented as an NMLN. Similarly to recently proposed Neural theorem provers (Rocktaschel & Riedel, ¨ 2017), NMLNs can exploit embeddings of constants but, unlike NTPs, NMLNs work well also in their absence. This is extremely important for predicting in settings other than the transductive one. We showcase the potential of NMLNs on knowledge-base completion tasks and on generation of molecular (graph) data.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Parameters for a statistical relational model are typically estimated from one or more examples of relational structures that typically consist of a large number of ground facts. Examples of such structures are social networks (e.g. Facebook), protein-protein interaction networks, the Web, etc. A challenging task is to learn a probability distribution over such relational structures from one or few examples. One solution is based on the assumption that the relational structure has repeated regularities; this assumption is implicitly or explicitly used in most works on statistical relational learning. Then, statistics about these regularities can be computed for small substructures of the training examples and used to construct a distribution over the relational structures. Together with the maximum-entropy principle, this leads to distributions such as Markov logic networks (Richardson & Domingos, 2006; Kuzelka et al., 2018) ˇ
12
+
13
+ In this paper, we propose Neural Markov Logic Networks (NMLN). Here, the statistics which are used to model the probability distribution are not known in advance, but are modelled as neural networks trained together with the probability distribution model. This is very powerful when compared to classical MLNs, where either domain experts are required to design some useful statistics about the domain of interest by hand (i.e. logical rules) or structure learning based on combinatorial search needs to be performed. These requirements normally limit a wide application of these models as out-of-the box tools. It is worth noticing that overtaking the need of such “feature-engineering” is one of the reasons behind the massive adoption of deep learning techniques. However, not much has been done in the same direction by the statistical relational learning community. Moreover, designing statistics as neural networks allows a more fine-grained description of the data, opening the doors to applications of our model to the generative setting.
14
+
15
+ # CONTRIBUTIONS
16
+
17
+ The main contributions of this work are: (i) we introduce a new statistical relational model, which overcomes actual limitations of both classical and recent related models such as (Richardson & Domingos, 2006; Rocktaschel & Riedel, 2017; Sourek et al., 2018); ¨ (ii) we propose a theoretical justification of the model as naturally emerging from a principle of Min-Max-entropy; (iii) we provide a Tensorflow implementation of this model; and (iv) we showcase its effectiveness on two quite diverse problems: knowledge-base completion and generative modelling of small molecules.
18
+
19
+ # RELATED WORK
20
+
21
+ The need to extend relational models with neural components is a topic that has been receiving increasing attention in the last few years. An integration of logic reasoning and neural models was proposed based on fuzzy logic (Serafini & Garcez, 2016; Diligenti et al., 2017; Marra et al., 2019). Here, neural models implementing FOL relations are optimized in order to satisfy differentiable approximations of logical formulas obtained by means of fuzzy t-norm theory. However, the lack of probabilistic arguments allows a sound application of such fuzzy-logic based methods only to hard-constrained settings. In Manhaeve et al. (2018), the probabilistic logic programming language ProbLog (De Raedt et al., 2007) is extended to allow probabilities of atoms to be predicted by neural networks and to exploit differentiable algebraic generalizations of decision diagrams to train these networks. Lifted relational neural networks (Sourek et al., 2018) unfold neural networks with shared weights, as in convolutional networks, using forward chaining. A semantically very similar approach was the one in Rocktaschel & Riedel (2017), where the authors implemented the Prolog ¨ backward chaining with a soft unification scheme operating on constants and relations embeddings. The proposed Neural Theorem prover was able to exploit the geometry of the embedding space to improve its reasoning capabilities, but the need for embeddings prevents this model to be applicable to settings different from the transductive one. Most importantly, neither of these latter two works provides means for probabilistic modelling of relational structures.
22
+
23
+ The idea of exploiting neural networks to extract regularities in non-euclidean settings has been recently revisited by the deep learning community in the context of Graph Neural Networks (GNN) models (Scarselli et al., 2009; Defferrard et al., 2016; Xu et al., 2018). In GNNs, latent representations of nodes are obtained by an aggregation of neighboring nodes representation by means of an iterative diffusion mechanism. However, the inference is performed only on neighborhoods induced by the actual connections of the graph, preventing the exploitation of these models for modeling distributions of structural properties of the graph. Lippi & Frasconi (2009) was an early attempt to integrate MLNs with neural components. Here, an MLN was exploited to describe a conditional distribution over ground atoms, given some features of the constants. In particular, the MLN was reparametrized by a neural network evaluated on input features. However, this method still relied on hand-crafted logical rules for modelling the distribution.
24
+
25
+ # 2 PRELIMINARIES
26
+
27
+ This paper follows the setting of so-called Model A from Kuzelka et al. (2018). We consider a ˇ function-free first-order logic language $\mathcal { L }$ , which is built from a set of constants $\mathcal { C }$ and predicates $\textstyle { \mathcal { R } } = \bigcup _ { i } { \mathcal { R } } _ { i }$ , where $\mathcal { R } _ { i }$ contains the predicates of arity i. For $c _ { 1 } , c _ { 2 } , \ldots , c _ { m } \in { \mathcal { C } }$ and $R \in \mathcal { R } _ { m }$ , we call $R ( { \bar { c } } _ { 1 } , c _ { 2 } , \dots , c _ { m } )$ a ground atom. We define possible world $\omega \in \Omega$ as the pair $( C , A )$ , where $C \subseteq { \mathcal { C } }$ , $A$ is a subset of the set of all ground atoms that can be built from the constants in $C$ and any relation in $\mathcal { R }$ . We define the size of a possible world $n = | C |$ and $\Omega$ is the set of all possible worlds. A fragment $\omega \langle S \rangle$ is defined as the restriction of $\omega$ to the constants in $S$ . It is again a pair $\omega \langle S \rangle = ( S , B )$ , with $S$ the constants of the restriction and $B$ a set of ground atoms which only use constants from $S$ . Given a fragment $\omega \langle S \rangle$ and $k = | S |$ , we can anonymize it by mapping the constants in $S$ with a permutation $\widehat { S }$ of the integer set $\{ 1 , 2 , . . . , k \}$ . We call this an anonymized fragment $\gamma$ . Suppose we have a given world $\widehat { \omega }$ of size $n$ , we define $\Gamma _ { k } ( \widehat { \omega } )$ the collection of all the anonymized fragments of width $k$ of $\widehat { \omega }$ b. It is easy to verify that $\begin{array} { r } { | \Gamma _ { k } ( \widehat { \omega } ) | = { \binom { n } { k } } k ! } \end{array}$ . The collection $\Gamma _ { k } ( \widehat { \omega } )$ is a multiset, since, after anonymization, multiple fragments could be identical. An example bof the process of anonymization and of the identification of structural patterns among anonymized fragments is shown in Figure 1.
28
+
29
+ # 3 NEURAL MARKOV LOGIC NETWORKS
30
+
31
+ # 3.1 INTUITION AND FORMULATION
32
+
33
+ Given a world $\widehat { \omega } \in \Omega$ , we are interested in models of the probability $P _ { \omega }$ , for a generic $\omega \in { \Omega }$ . bTo this end, we want to compute statistics on fragments of the given $\widehat { \omega }$ and exploit them to conbstruct a distribution on (possibly larger and smaller) relational structures $\omega$ . Let us define $\phi ( \gamma )$ as a fragment potential function, which is simply a function from anonymized fragments of width $k$ to real numbers. We can search for a maximum-entropy distribution $p ( \omega )$ such that the following two expected values are the same: (i) the expected value of $\phi ( \gamma )$ where $\gamma$ is sampled uniformly from $\Gamma _ { k } ( \widehat { \omega } )$ and (ii) the expected value of $\phi ( \gamma ^ { \prime } )$ where $\gamma ^ { \prime }$ is sampled uniformly from $\Gamma _ { k } ( \omega )$ and $\omega$ bis sampled, in turn, from $p ( \omega )$ . The intuition here is that, at least on average, the fragments of the given training example should look similar to the fragments of possible worlds sampled from the distribution. It follows from (Kuzelka et al., 2018) that the resulting maximum-entropy distribution ˇ is an exponential-family distribution resembling Markov logic networks.
34
+
35
+ ![](images/caaa594011e82e2348e2adee3d7055a9f68f6f0c5fd29f627a9949169e13e3fa.jpg)
36
+ Figure 1: The process of individuating structural patterns in anonymized fragments. White circles represent constants, while the two relations are represented as solid and dashed arrows (absence of an arrow means that the relation is false). The given world is shown on the left. Two possible fragments are shown in the middle. All their possible anonymizations are shown on the right. Grey circles show two repeated anonymized fragments found in two different fragments. The model exploits these regularities on fragments to model the distribution of the larger structure.
37
+
38
+ The max-entropy setting provides us with a sound starting point for designing statistical relational models that generalize classical models such as Markov random fields. However, a necessary condition for these models to be designed is that one can provide a set of statistics $\phi ( \omega )$ describing the data. In this section, we show how to get rid of the need to provide statistics in advance and how to learn these statistics together with the probabilistic model in a differentiable manner.
39
+
40
+ Let us consider a fragment neural potential function $\phi ( \gamma ; { \mathbf { w } } )$ . It is a parametric function with parameters w. Let $\begin{array} { r } { \Phi ( \omega ; \bar { \mathbf { w } } ) = \frac { 1 } { | \Gamma _ { k } ( \omega ) | } \bar { \sum _ { \gamma \in \Gamma _ { k } ( \omega ) } } \phi ( \gamma ; \mathbf { w } ) } \end{array}$ be the corresponding global neural potential. We need a learning principle which would allow us to find a good $\phi ( \gamma ; { \mathbf { w } } )$ to describe our data. To this end, suppose we need to solve the maximum-entropy optimization problem, but without any constraint on the statistics. The maximum-entropy solution in this case is the uniform distribution, which assigns equal probability to all possble worlds $\omega$ . Now, suppose we add a single constraint on a potential $\tilde { \Phi } ( \omega )$ . If this potential is informative and makes some worlds more likely than others, then the solution moves from the uniform distribution to another distribution with lower entropy. Using this intuition, we can have a scheme where we maximize entropy by selecting the maximumentropy distribution and minimize it at the same time by choosing the most informative statistics.
41
+
42
+ The above considerations give rise to a Min-Max-Entropy model for the target probability distribution $P _ { \omega }$ , which we call Neural Markov Logic Network and which we describe in turn. Let us first define the Max-Entropy problem with the new neural potentials (stated here as minimization of negative entropy):
43
+
44
+ subject to
45
+
46
+ $$
47
+ \begin{array} { r l r } { \displaystyle \sum _ { \omega } P _ { \omega } \log P _ { \omega } } \\ { \displaystyle \sum _ { \omega } P _ { \omega } = 1 , \forall \omega : p _ { \omega } \geq 0 } \\ { \forall i : \mathbb { E } _ { P _ { \omega } } [ \Phi _ { i } ( \omega ; \mathbf { w } _ { i } ) ] = \Phi _ { i } ( \widehat { \omega } ; \mathbf { w } _ { i } ) } & { \quad } & { \mathrm { w i t h ~ } 0 < i \leq M } \end{array}
48
+ $$
49
+
50
+ For fixed $\mathbf { w } _ { i }$ ’s, we can use Lagrangian duality to obtain the following solution of the maximum
51
+ entropy rameters blem: are sol $\begin{array} { r } { P _ { \omega } = \frac { 1 } { Z } \exp \left( \sum _ { i } \beta _ { i } \Phi ( \omega ; \mathbf { \bar { w } } _ { i } ) \right) } \end{array}$ . $Z$ nstant and the pa-, which coincides $\beta _ { i }$ $\begin{array} { r } { \left\{ \sum _ { i = 1 } ^ { M } \beta _ { i } \Phi _ { i } ( \widehat { \omega } ; \mathbf { w } _ { i } ) - \log Z \right\} } \end{array}$ βi
52
+ with maximum-likelihood.1
53
+
54
+ Next we still need to incorporate the minimization of entropy by optimizing $\mathbf { w } _ { i }$ ’s. Let us denote by $H ( \beta _ { 1 } , \dots , \beta _ { M } , \mathbf { w } _ { 1 } , \dots , \mathbf { w } _ { M } )$ the entropy of the distribution $P _ { \omega }$ . Now, as previously introduced, the selection of the optimal values $\mathbf { w } _ { i }$ is governed by the principle of minimization of entropy, leading to the optimization problem: mi wi $\mathbf { \psi } _ { 1 } \operatorname* { m a x } _ { \beta _ { i } } H ( \beta _ { 1 } , \ldots , \beta _ { M } , \mathbf { \bar { w } } _ { 1 } , \ldots , \mathbf { w } _ { M } ) =$ $- \underset { \mathbf { w } _ { i } } { \operatorname* { m a x } } \ \underset { \beta _ { i } } { \operatorname* { m i n } } - H ( \beta _ { 1 } , \ldots , \beta _ { M } , \mathbf { w } _ { 1 } , \ldots , \mathbf { w } _ { M } )$ subject to the constraints (2) and (3). Plugging in the dual problem and using strong duality, we obtain the following unconstrained optimization problem which is equivalent to the maximization of log-likelihood: $\begin{array} { r } { \operatorname* { m a x } _ { \mathbf { w } _ { i } , \boldsymbol { \beta } _ { i } } \left\{ \sum _ { i = 1 } ^ { M } \beta _ { i } \bar { \Phi } _ { i } ( \boldsymbol { \widehat { \omega } } ; \mathbf { w } _ { i } ) - \mathrm { l o g } Z \right\} } \end{array}$ . The maximization of the log-likelihood will be carried out by a gradient-based optimization scheme. The gradients of the log-likelihood w.r.t. to both the parameters $w _ { i , j }$ , where $w _ { i , j }$ denotes the $j$ -th component of $\mathbf { w } _ { i }$ , and $\beta _ { i }$ are:
55
+
56
+ $$
57
+ \begin{array} { r l } & { \displaystyle \frac { \partial \log ( P _ { \widehat { \omega } } ) } { \partial w _ { i , j } } = \beta _ { i } \biggr ( \frac { \partial \Phi _ { i } ( \widehat { \omega } ; \mathbf { w } _ { i } ) } { \partial w _ { i , j } } - \mathbb { E } _ { \omega \sim P } \Big [ \frac { \partial \Phi ( \omega ; \mathbf { w } _ { i } ) } { \partial w _ { i , j } } \Big ] \biggr ) } \\ & { \displaystyle \frac { \partial \log ( P _ { \widehat { \omega } } ) } { \partial \beta _ { i } } = \biggr ( \Phi _ { i } ( \widehat { \omega } ; w _ { i } ) - \mathbb { E } _ { \omega \sim P } [ \Phi _ { i } ( \omega ; w _ { i } ) ] \biggr ) } \end{array}
58
+ $$
59
+
60
+ At a stationary point, Eq. 5 recovers the initial constraint on statistics imposed in the maximization of the entropy. However, the minimization of the entropy is mapped to a new requirement: at stationary conditions, the expected value of the gradients of the $\Phi _ { i }$ under the distribution must match the gradients of the $\Phi _ { i }$ evaluated at the data points.
61
+
62
+ # 3.2 VECTOR EMBEDDINGS OF DOMAIN ELEMENTS
63
+
64
+ By anonymizing a fragment, the model loses any trace of the identity of the constants involved in it, preserving only their structural behaviours. While this feature is essential to allow the identification of structural patterns also inside a single possible world, it prevents the model from having different behaviour on specific constants. This, instead, is a basic feature of many existing transductive models, like NTP (Rocktaschel & Riedel, 2017), which exploit the geometry of a latent representation ¨ space of constants to improve their prediction capabilities.
65
+
66
+ To this end, we define an embedding fragment neural potential $\phi _ { e } ( \gamma , \widehat { S } ; \mathbf { w } , \Theta )$ , which is function of the anonymized fragment but also of the specific constants involved in it (i.e. the list of constants $\widehat { S }$ ). In particular, in transductive settings, we always have a possible world $\widehat { \omega }$ and we use the same bconstant set $S$ both during learning and inference. Let $\boldsymbol { \Theta } \in \dot { \mathbb { R } } ^ { n \times d }$ bbe a variable embedding matrix. It can be considered a map from the constant set $S$ to a latent real domain $\mathbb { R } ^ { d }$ , i.e. the embedding space. Let $c ( \widehat { S } , \Theta )$ be a function that concatenates the $k$ rows of $\Theta$ corresponding to the $k$ constants in the restricted set $\widehat { S }$ . Thus, the embedding fragment neural potential $\phi _ { e }$ can be seen as a function of both $\gamma$ , which encodes the structural properties of the fragment and $c ( \widehat { S } , \Theta )$ , which encodes the identity of constants by providing a latent representation for them. In other words, $\phi _ { e } ( \gamma , \widehat { S } ; { \bf w } , \Theta ) =$ $f ( \gamma , c ( \widehat { S } , \Theta ) ; \mathbf { w } )$ for some neural function $f$ parameterized by w. This is inspired by works in the NLP community (Mikolov et al., 2013; Mnih & Kavukcuoglu, 2013), where the $c$ function can have different forms than concatenation. The components of the embedding vectors are treated as any other weights of the potential functions and are updated using gradients computed according to Eq. 4. Intuitively, the contrastive nature of the learning (Bordes et al., 2013; Trouillon et al., 2017), leads to the development of similar embeddings for similar constants. As we show in Section 4.2, the addition of embedding of constants helps improving the prediction capability of our model in transductive settings.
67
+
68
+ # 3.3 INFERENCE
69
+
70
+ In order to design an optimization procedure to learn Neural Markov Logic Networks, we need to rely on some methods to sample from the distribution. In this paper, we exploit MCMC methods, in particular approximate Gibbs Sampling (GS) (Robert & Casella, 2013), to sample from Neural Markov Logic Networks. The approximation comes from the fact that GS requires a large number of steps before converging to the target distribution. However, we run it only for a limited number of steps $t$ , which, in some cases, is restricted to $t = 1$ . When this happens, our method recovers a discrete version of the Contrastive Divergence (CD) algorithm (Hinton, 2002).
71
+
72
+ Gibbs sampling cannot effectively handle distributions with a lot of determinism. In normal Markov logic networks, sampling from such distributions may be tackled by an algorithm called MC-SAT (Poon & Domingos, 2006). However, MC-SAT requires an explicit logical encoding of the deterministic constraints, which is not available in Neural Markov Logic Networks where deterministic constraints are implicitly encoded by the potential functions. In fact, only constraints that are almost deterministic, i.e. having very large weights, can occur in Neural Markov Logic Networks but, at least for Gibbs sampling, the effect is the same. Such distributions would naturally be learned in our framework on most datasets. Our solution in this paper is to simply avoid learning distributions with determinism by adding noise during training. In particular, we set a parameter $\bar { \pi _ { n } } \in [ 0 , 1 ]$ and, at the beginning of each training epoch, we inverted each ground atom of the input possible worlds (T rue to F alse and vice versa) with probability $\pi _ { n }$ . Moreover, this added noise prevents the model to perfectly fit training data, acting as a regularizer (Bishop, 1995).
73
+
74
+ # 4 EXPERIMENTS
75
+
76
+ # 4.1 IMPLEMENTATION DETAILS
77
+
78
+ We implemented Neural Markov Logic Networks in Tensorflow. In order to maximally exploit the parallel computations capabilities of GPUs, multiple Markov chains are run in parallel. This is also useful because expected values of gradients (see Eq. 4 and 5) are computed on uncorrelated samples, while sequential samples sampled from a unique chain are known to be highly correlated.
79
+
80
+ In experiments, the different global neural potentials $\Phi _ { i }$ can rely on fragments of different sizes $k$ so that for small $k$ , the model can focus on learning very local statistics of the data, while, for large $k$ , the model can focus on learning statistics on larger substructures. For example, if we represent molecules as a relational structure (see Section 4.3), rings are inherently global statistics which cannot be captured by local properties. This example underlines the importance of the choice of $k$ for a correct modeling of the data distribution. However, since a single evaluation of $\Phi _ { i } ( w )$ requires a summation over $d = { \binom { n } { k } } k !$ number of terms, the number of elements of the sum grows exponentially with $k$ (and polynomially, but very fast, with $n$ ). So exploiting large $k$ is usually admissible only for small domain sizes $n$ .
81
+
82
+ # 4.2 KNOWLEDGE BASE COMPLETION
83
+
84
+ In Knowledge Base Completion (KBC), we are provided with an incomplete Knowledge Base (KB) and asked to complete the missing part.
85
+
86
+ The KBC task is inherently in the transductive setting, since all the constants are exploited both during the training and testing phase. Moreover, data are provided in a positive-only fashion: we only know what is true and we cannot distinguish between unknown and false facts. Kuzelka & ˇ Davis (2019) studied KBC tasks under the missing-completely-at-random assumption and showed consistency of learning by maximum-likelihood where both missing and false facts are treated in the same way as false. Hence, here we also provide both unknown and false facts as false facts during the training procedure.
87
+
88
+ ![](images/f933283831e815ddb8d67d7a4a800e554ff5cad3541f0b593cd20d0f2f0a10d7.jpg)
89
+ Figure 2: Knowledge Base Completion in the Smokers dataset. Circles represent constants. A grey circle means that the predicate smokes is True. A white circle means that the value of the predicate smokes is unknown. Links represent the relation friendOf (absence of an arrow means that the relation is False). The given world is shown on the top (2a), while the completed knowledge base is shown on the bottom (2b). The system learnt the symmetric nature of the friendship relation. It learnt that a friend of at least two smokers is also a smoker, and that two smokers, who are friends of the same person, are also friends.
90
+
91
+ Smokers. The “Smokers” dataset (Richardson & Domingos, 2006) is a classical example in statistical relational learning literature. Here, two relations are defined on a set of constants representing people: the unary predicate Smokes identifies those people who smoke, while the binary predicate friendOf maps people to their friend. This dataset is often used to show how a statistical relational learning algorithm can model a distribution by finding a correlation of smoking habits of friends. For example, in MLNs, one typically uses weighted logical rules such as: ∀x ∀y friendOf $\therefore y ) \to \operatorname { s m o k e s } ( x ) \operatorname { s m o k e s } ( y )$ . We learned a NMLN on the small smokers dataset. Since no prior knowledge about the type of rules that are relevant was used by NMLNs, the model itself had to identify which statistics are mostly informative of the provided data by learning the neural potential functions.
92
+
93
+ Here we use the Smokers dataset to define a Knowledge Base Completion task and to provide some basic intuitions about what kind of rules the model could have learned. In Figure 2, we show the setting before and after completion. In Figure 2b, we highlight only new facts whose marginal probability after training is significantly higher than the others, even though other facts have probabilities higher than the prior.
94
+
95
+ Nations. The Nations dataset (Kok & Domingos, 2007) provides information about properties and relations among countries as ground facts, like economicaid(usa,israel) or embassy(israel,poland). There are $n = 1 4$ constants (i.e. nations), 56 relations and 2565 true facts. This dataset has been recently exploited for a KBC task by Rocktaschel & Riedel (2017), ¨ where some facts were removed from the dataset and the task was to predict them. The authors compared the performances of the state-of-the-art ComplEx neural model (Trouillon et al., 2017) with their proposed differentiable end-to-end neural theorem prover, showing that the combination of the two was able to outperform both of the models. Unary predicates were removed since the ComplEx model cannot deal with them. In this section, we show how we can use NMLNs to tackle a KBC task on the Nations dataset.
96
+
97
+ We implemented the fragment neural potentials $\phi ( \gamma )$ as 2 hidden-layer neural networks, with sigmoidal hidden activations and linear output layer. The selection of the hyperparameters and the early-stopping epoch have been selected by means of a held-out validation set (the splits are same as the ones in Rocktaschel & Riedel (2017)). The size of layers has been selected from the interval ¨ [75, 100, 150] for the first layer and [30, 50, 100] for the second layer. The embedding size has been selected from the interval [2, 3, 5, 10]. The noise probability $\pi _ { n }$ has been selected from the interval $[ 0 , 0 . 0 1 , 0 . 0 2 , 0 . 0 3 ]$ . The number of parallel chains has been selected from the interval [10, 20, 30].
98
+
99
+ We followed the evaluation procedure in Rocktaschel & Riedel (2017). In particular, we took a test ¨ fact and corrupted its first and second argument in all possible ways such that the corrupted fact is not in the original KB. Subsequently, we predicted a ranking of every test fact and its corruptions to calculate MRR and $\mathrm { H I T S } @ \mathrm { m }$ . The ranking is based on marginal probabilities estimated by running Gibbs sampling on the Neural Markov Logic Network; while training the network, we also run a parallel Gibbs sampling chain on a state in which we fix the known part of the KB as true. Here, we compare the ComplEx model, the plain Neural Theorem Prover (NTP), the composition of the previous two $( N T P \lambda )$ , our plain model (NMLN) and our model when using potentials with embeddings (NMLN-Emb). In Table 1 we report the results of the KBC task on Nations. Both our models outperform competitors on the $\mathrm { H I T S } @ 1$ metric, with NMLN-Emb having a large gap over all the other models. It is interesting to note that the plain NMLN still performs better than differentiable provers, even if it is the only model which cannot exploit embeddings to perform reasoning and that has to rely only on the relational structure of fragments to make predictions. Finally, NMLN-Emb performs equally to or better than all the competitors in all the other metrics.
100
+
101
+ Table 1: MRR and HITS@m on Nations.
102
+
103
+ <table><tr><td rowspan="2">Metric</td><td colspan="5">Model</td></tr><tr><td>ComplEx</td><td>NTP</td><td>NTPX</td><td>NMLN</td><td>NMLN-Emb</td></tr><tr><td>MRR</td><td>0.75</td><td>0.75</td><td>0.74</td><td>0.77</td><td>0.81</td></tr><tr><td>HITS@1</td><td>0.62</td><td>0.62</td><td>0.59</td><td>0.64</td><td>0.71</td></tr><tr><td>HITS@3</td><td>0.84</td><td>0.86</td><td>0.89</td><td>0.86</td><td>0.89</td></tr><tr><td>HITS@10</td><td>0.99</td><td>0.99</td><td>0.99</td><td>0.99</td><td>0.99</td></tr></table>
104
+
105
+ # 4.3 GRAPH GENERATION
106
+
107
+ One of the main features differentiating our model from standard MLNs is that we learn the statistics $\phi ( \gamma )$ in a differentiable manner. The obtained probability distribution is then often far more fine grained than using predefined or hand-made statistics, that are limited to what the user considers important and do not search for other interesting regularities in the data. This opens the doors to the application of NMLNs to generative tasks in non-euclidean settings, which are receiving an increasing interest recently (You et al., 2018; Li et al., 2018).
108
+
109
+ In generation tasks, our model is asked to learn the probability distribution of the relational structures induced by a graph. Indeed, any FOL-description can be considered a multi-hyper graph; thus generating in the FOL setting is applicable to generating in any graph domain. In particular, to generate graphs, we can just use the same sampling technique used during training (i.e. Gibbs Sampling) to extract new samples.
110
+
111
+ In this section, we describe a molecule generation task. We used as training data the ChEMBL molecule database (Gaulton et al., 2016). We restricted the dataset to molecules with 8 heavy atoms. We used the RDKit framework 2 to get a FOL representation of the molecules from their SMILES encoding. In particular, we exploited only molecules having the most frequent atom types, i.e. C, N, O, S, Cl, F, P, and we encoded only two kinds of bonds: SINGLE and DOUBLE. A more detailed description of the data format is shown in the appendix.
112
+
113
+ We implemented the fragment neural potentials $\phi ( \gamma )$ as neural networks with sigmoidal hidden activations and linear output layer. The hyperparameters were selected from the following ranges: the number of layers in [1, 2]; the hidden sizes of the layers in [30, 100, 150, 200]; the number of fragment potentials in [1, 2], the size $k$ of potentials in [2, 3, 4, 5, 6]. The number of parallel chains was set to 5.
114
+
115
+ To qualitatively evaluate the results of this generative experiment, we follow Li et al. (2018), who designed an LSTM-based architecture for generative molecule modelling and applied it in a similar setting to ours. In Figure 3, we show a comparison between a sample of training data and a (random) sample of molecules generated by the proposed model. In particular, 20 generated samples are chosen randomly from the last 1000 samples extracted during the training procedure. By choosing them randomly, we avoided to have very correlated samples, which is inherent in the Gibbs sampling procedure. The generated samples resembles training data both in structural patterns and variety fairly well. Furthermore, in Figure 4, we compare the statistics, used in Li et al. (2018) for a similar task, on a sample of 1000 training and generated molecules. These statistics represent both general structural properties applicable to any graph as well as chemical structural properties of molecules (e.g. the topological polar surface area (TPSA) is a topological indicator of the capability of a molecule to permeate a membrane as a function of the number of polar atoms it contains). These statistics were computed using the RDkit framework.
116
+
117
+ ![](images/ea9bdbbe11f7b4bb089f5a26435feecd12cb2ca3f945e7c24fff10cfd9137b97.jpg)
118
+ Figure 3: Molecules generation. A comparison between a sample of training data and a (random) sample of molecules generated by the proposed model. The generated samples fairly resembles training data both in structural patterns and variety. Better viewed in color.
119
+
120
+ ![](images/92f9fa95ebcfac9f7bc7ec27ed99e6e67dc3bcfed8eb05071fb10990960705e1.jpg)
121
+ Figure 4: Molecules generation. Comparing the distributions of some chemical properties of the training data with the ones of generated data. The generated samples are capable of perfectly fitting structural properties and to very well resembling functional properties.
122
+
123
+ # 5 CONCLUSIONS
124
+
125
+ In this paper we have introduced Neural Markov Logic Networks, a statistical relational learning model combining representation learning power of neural networks with principled handling of uncertainty in the maximum-entropy framework. The proposed system works remarkably well on small domains. Although not explained in detail in this paper, it is also straightforward to add standard logical features as used in MLNs to NMLNs.
126
+
127
+ The main future challenge is making NMLNs scale to larger domains. At the moment NMLNs do not scale to large knowledge bases, which is not that surprising given that NMLNs can theoretically represent any distribution. A more work should therefore be done in the direction of identifying more tractable subclasses of NMLNs and exploiting insights from lifted inference literature (Braz et al., 2005; Gogate & Domingos, 2011; den Broeck et al., 2011).
128
+
129
+ # REFERENCES
130
+
131
+ Chris M Bishop. Training with noise is equivalent to tikhonov regularization. Neural computation, 7(1):108–116, 1995.
132
+
133
+ Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Advances in neural information processing systems, pp. 2787–2795, 2013.
134
+
135
+ Stephen Boyd and Lieven Vandenberghe. Convex optimization. Cambridge university press, 2004.
136
+
137
+ Rodrigo De Salvo Braz, Eyal Amir, and Dan Roth. Lifted first-order probabilistic inference. In Proceedings of the 19th international joint conference on Artificial intelligence, pp. 1319–1325, 2005.
138
+
139
+ David Buchman and David Poole. Representing aggregators in relational probabilistic models. In Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015.
140
+
141
+ Luc De Raedt, Angelika Kimmig, and Hannu Toivonen. Problog: A probabilistic prolog and its application in link discovery. In IJCAI, volume 7, pp. 2462–2467. Hyderabad, 2007.
142
+
143
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In Advances in neural information processing systems, pp. 3844–3852, 2016.
144
+
145
+ Guy Van den Broeck, Nima Taghipour, Wannes Meert, Jesse Davis, and Luc De Raedt. Lifted probabilistic inference by first-order knowledge compilation. In IJCAI 2011, Proceedings of the 22nd International Joint Conference on Artificial Intelligence, pp. 2178–2185, 2011.
146
+
147
+ Michelangelo Diligenti, Marco Gori, and Claudio Sacca. Semantic-based regularization for learning and inference. Artificial Intelligence, 244:143–165, 2017.
148
+
149
+ Anna Gaulton, Anne Hersey, Michał Nowotka, A Patr´ıcia Bento, Jon Chambers, David Mendez, Prudence Mutowo, Francis Atkinson, Louisa J Bellis, Elena Cibrian-Uhalte, et al. The chembl ´ database in 2017. Nucleic acids research, 45(D1):D945–D954, 2016.
150
+
151
+ Vibhav Gogate and Pedro M. Domingos. Probabilistic theorem proving. In UAI 2011, Proceedings of the Twenty-Seventh Conference on Uncertainty in Artificial Intelligence, pp. 256–265, 2011.
152
+
153
+ Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural computation, 14(8):1771–1800, 2002.
154
+
155
+ Stanley Kok and Pedro Domingos. Statistical predicate invention. In Proceedings of the 24th international conference on Machine learning, pp. 433–440. ACM, 2007.
156
+
157
+ Ondˇrej Kuzelka and Jesse Davis. Markov logic networks for knowledge base completion: A theo- ˇ retical analysis under the MCAR assumption. In Proceedings of the Thirty-Fifth Conference on Uncertainty in Artificial Intelligence, UAI 2019, 2019.
158
+
159
+ Ondˇrej Kuzelka, Yuyi Wang, Jesse Davis, and Steven Schockaert. Relational marginal problems: ˇ Theory and estimation. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
160
+
161
+ Yujia Li, Oriol Vinyals, Chris Dyer, Razvan Pascanu, and Peter Battaglia. Learning deep generative models of graphs. arXiv preprint arXiv:1803.03324, 2018.
162
+
163
+ Marco Lippi and Paolo Frasconi. Prediction of protein $\beta$ -residue contacts by markov logic networks with grounding-specific weights. Bioinformatics, 25(18):2326–2333, 2009.
164
+
165
+ Robin Manhaeve, Sebastijan Dumancic, Angelika Kimmig, Thomas Demeester, and Luc De Raedt. Deepproblog: Neural probabilistic logic programming. In Advances in Neural Information Processing Systems, pp. 3749–3759, 2018.
166
+
167
+ Giuseppe Marra, Francesco Giannini, Michelangelo Diligenti, and Marco Gori. Lyrics: a general interface layer to integrate ai and deep learning. arXiv preprint arXiv:1903.07534, 2019.
168
+
169
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013.
170
+
171
+ Andriy Mnih and Koray Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In Advances in neural information processing systems, pp. 2265–2273, 2013.
172
+
173
+ Hoifung Poon and Pedro Domingos. Sound and efficient inference with probabilistic and deterministic dependencies. In AAAI, volume 6, pp. 458–463, 2006.
174
+
175
+ Matthew Richardson and Pedro Domingos. Markov logic networks. Machine learning, 62(1-2): 107–136, 2006.
176
+
177
+ Christian Robert and George Casella. Monte Carlo statistical methods. Springer Science & Business Media, 2013.
178
+
179
+ Tim Rocktaschel and Sebastian Riedel. End-to-end differentiable proving. In ¨ Advances in Neural Information Processing Systems, pp. 3788–3800, 2017.
180
+
181
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009.
182
+
183
+ Luciano Serafini and Artur d’Avila Garcez. Logic tensor networks: Deep learning and logical reasoning from data and knowledge. arXiv preprint arXiv:1606.04422, 2016.
184
+
185
+ Gustav Sourek, Vojtech Aschenbrenner, Filip Zelezny, Steven Schockaert, and Ondrej Kuzelka. ´ Lifted relational neural networks: Efficient learning of latent relational structures. J. Artif. Intell. Res., 62:69–100, 2018.
186
+
187
+ Theo Trouillon, Christopher R Dance, ´ Eric Gaussier, Johannes Welbl, Sebastian Riedel, and Guil- ´ laume Bouchard. Knowledge graph completion via complex tensor factorization. The Journal of Machine Learning Research, 18(1):4735–4772, 2017.
188
+
189
+ Martin J Wainwright, Michael I Jordan, et al. Graphical models, exponential families, and variational inference. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 1(1–2):1–305, 2008.
190
+
191
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
192
+
193
+ Jiaxuan You, Rex Ying, Xiang Ren, William L Hamilton, and Jure Leskovec. Graphrnn: Generating realistic graphs with deep auto-regressive models. arXiv preprint arXiv:1802.08773, 2018.
194
+
195
+ # A TRANSLATING MARKOV LOGIC NETWORKS TO NEURAL MARKOV LOGIC NETWORKS
196
+
197
+ Markov logic networks are a popular statistical relational framework. It turns out that every Markov logic network can be represented as a Neural Markov Logic Network with a single carefully selected potential function. We give details of the translation between these two frameworks below. Essentially what we need to show is that Model B from (Kuzelka et al., 2018) can be translated to Model ˇ A from that same work, which is close enough to Neural Markov Logic Networks and so we can then easily encode the result to a Neural Markov Logic Network.
198
+
199
+ Kuzelka et al. (2018) studies two maximum-entropy models, Model A, which is close to the ˇ model that we study in this paper, and Model B, which is the same as Markov logic networks. Syntactically, both models are encoded as sets of weighted first order logic formulas, e.g. $\Phi =$ $\{ ( \alpha _ { 1 } , w _ { 1 } ) , \dotsc , ( \alpha _ { M } , w _ { m } ) \}$ . In particular, given a positive integer $k$ , Model A defines the following distribution:
200
+
201
+ $$
202
+ p _ { A } ( \omega ) = \frac { 1 } { Z } \exp \left( \sum _ { ( \alpha , w ) \in \Phi _ { A } } w \cdot \# _ { k } ( \alpha , \omega ) \right)
203
+ $$
204
+
205
+ where $Z$ is the normalization constant and $\# ( \alpha , \omega )$ is the fraction of size- $k$ subsets $s$ of constants in the possible world $\omega$ for which $\omega \langle S \rangle \models \alpha$ (i.e. the formula $\alpha$ is classically true in the fragment of $\omega$ induced by $s$ ). Let us first define
206
+
207
+ $$
208
+ \phi _ { \alpha , w } ( \gamma ) = { \left\{ \begin{array} { l l } { w } & { \gamma \Vdash \alpha } \\ { 0 } & { \gamma \Vdash \alpha } \end{array} \right. }
209
+ $$
210
+
211
+ It is then easy to see that the distribution $p _ { A } ( \omega )$ can also easily be encoded as a Neural Markov Logic Network by selecting the potential function $\begin{array} { r } { \dot { \phi ( \gamma ) } = \sum _ { ( \alpha , w ) \in \Phi _ { A } } \phi _ { \alpha , w } ( \gamma ) } \end{array}$ and by carefully selecting the weights $\beta _ { i }$ in the Neural Markov Logic Network.
212
+
213
+ Next we show that all distributions in Model $\mathbf { B }$ can be translated to distributions in Model A. First we will assume that the formulas $\alpha _ { i }$ do not contain any constants.
214
+
215
+ Model B is given by
216
+
217
+ $$
218
+ p _ { B } ( \omega ) = \frac { 1 } { Z } \exp \left( \sum _ { ( \beta , v ) \in \Phi _ { B } } v \cdot n ( \beta , \omega ) \right)
219
+ $$
220
+
221
+ where $n ( \beta , \omega )$ is the number3 of true injective groundings of the formula $\beta$ in the possible world $\omega$ . Hence, Model B is exactly the same as Markov logic networks up to the requirement on injectivity of the groundings. However, as shown in (Buchman & Poole, 2015), any Markov logic network can be translated into such modified Markov logic network with the injectivity requirement on the groundings.
222
+
223
+ Let $k$ be an integer greater or equal to the number of variables in any formula in $\Phi _ { B }$ . Now, let $\Gamma$ be the set of all size- $k$ fragments. For every formula $\beta$ in $\Phi _ { B }$ , we introduce a partition $\mathcal { P }$ on $\Gamma$ induced by the equivalence relation $\sim _ { \beta }$ defined by: $\gamma \sim _ { \beta } \gamma ^ { \prime }$ iff $n ( \beta , \gamma ) = n ( \beta , \gamma ^ { \prime } )$ . Since $\beta$ is assumed to not contain any constants, we can capture each of these equivalence classes $C$ by a (possibly quite big) first-order logic sentence without constants $\beta _ { C }$ . Let $C _ { i }$ be the equivalence class that contains fragments $\gamma$ such that $n ( \beta , \gamma ) = i$ . Let $\begin{array} { r } { m ( \beta , \omega ) = \sum _ { C _ { i } \in \mathcal { P } } \sum _ { \gamma \in \Gamma _ { k } ( \omega ) } \cdot \mathbb { 1 } ( \gamma \vdash \beta _ { C } ) } \end{array}$ . By construction, it holds $\begin{array} { r } { m ( \beta , \omega ) = \sum _ { \gamma \in \Gamma _ { k } ( \omega ) } n ( \beta , \gamma ) } \end{array}$ . Every true injective grounding of the formula $\beta$ , having $l$ variables, is contained in $\binom { n - l } { k - l }$ different size- $k$ fragments of $\omega$ , each of which gives rise to $k !$ anonymized fragments in the multi-set $\Gamma _ { k } ( \omega )$ . So $m ( \beta , \omega )$ is over-counting the number of true groundings $n ( \beta , \bar { \omega } )$ by a constant factor. It follows that, by carefully selecting the weights of the formulas $\beta _ { C }$ we can encode the distribution $p _ { B } ( \omega )$ also in Model A. Although this particular transformation that we have just sketched is not very efficient, it does show that Neural
224
+
225
+ Markov Logic Networks with potential functions of width $k$ can express all distributions that can be expressed by Markov logic networks containing formulas with at most $k$ variables.
226
+
227
+ First-order logic formulas defining Markov logic networks may also contain constants. In Neural Markov Logic Networks we may represent constants using vector-space embeddings as described in the main text. One can then easily extend the argument sketched above to the case covering Markov logic networks with constants.
228
+
229
+ # B ALGORITHMS
230
+
231
+ In the following, we will show a learning algorithm for NMLNs that relies on approximated Gibbs sampling.
232
+
233
+ The general learning algorithm for NMLN is described in Algorithm 1.
234
+
235
+ <table><tr><td colspan="2">Algorithm1 NMLN general learning algorithm</td></tr><tr><td colspan="2">Input: @: the given training world</td></tr><tr><td colspan="2">1: procedure LEARN(@)</td></tr><tr><td>2:</td><td>n: learning rate</td></tr><tr><td>3:</td><td>@:M randomly initialized Markov chain states</td></tr><tr><td>4:</td><td>while stopping criterion do</td></tr><tr><td>5:</td><td>while chains convergence criterion do</td></tr><tr><td>6:</td><td>ω ← SAMPLE-STEP(@,M,βi,Wi)</td></tr><tr><td>7:</td><td>0l0g(Pa)←β i(@;wi) -£ (@;wi) wi wi Wi</td></tr><tr><td>8:</td><td>alog(Pa) (重i(@;wi)-∑重i(w;wi)) 8β</td></tr><tr><td>9:</td><td>0log(Pa) Wi←Wi+n wi</td></tr><tr><td>10:</td><td>β←βi+n² alog(Po) 8β</td></tr></table>
236
+
237
+ A possible sampling procedure, implementing the generic SAMPLE-STEP and exploiting Gibbs Sampling, is described in Algorithm 2
238
+
239
+ <table><tr><td>Algorithm2 Sampling Procedure</td></tr><tr><td>Input:@: the current states of the chains</td></tr><tr><td>Input: M: the number of chains</td></tr><tr><td>Input:βi, Wi: current parameters</td></tr><tr><td>1:procedure SAMPLE-STEP(@,M,βi,Wi)</td></tr><tr><td>2: s ←1# sample index</td></tr><tr><td>3: i ←1# ground atom index</td></tr><tr><td>4: n number of ground atoms in w</td></tr><tr><td>5: while s≤Mdo</td></tr><tr><td>6: W=ωs # s-th chain</td></tr><tr><td>7: whilei≤ndo</td></tr><tr><td>8: p←Pwi=1lωj\i</td></tr><tr><td>9: r ∈[0,1] from a uniform distribution</td></tr><tr><td>10: if r&lt;p then</td></tr><tr><td>11: ε↑εi=1</td></tr><tr><td>12: else</td></tr><tr><td>13: ε↑εi=0</td></tr><tr><td>14: i←i+1</td></tr><tr><td>15: Ws=w</td></tr><tr><td>16: s↑s+1</td></tr><tr><td>17: return ω</td></tr></table>
240
+
241
+ ![](images/5c7cd4d3bba2686e7581b3c586e3a27bf10bdc2c80d62676a8f28c73c2f66ee8.jpg)
242
+ Figure 5: An example of molecule
243
+
244
+ # C GENERATING MOLECULES
245
+
246
+ Even though molecules can be described with a high level of precision, using both spatial features (i.e. atoms distances, bond length etc.) and chemical features (i.e. atom charge, atom mass, hybridization), in this work, we focused mainly on structural symbolic descriptions of molecules.
247
+
248
+ In particular, we described a molecule using two sets of FOL predicates:
249
+
250
+ • Atom-type unary predicates: these are C, N, O, S, Cl, F, P.
251
+ • Bond-type binary predicate: these are SINGLE and DOUBLE.
252
+
253
+ An example of a molecule FOL description can be:
254
+
255
+ O(0), C(1), C(2), C(3), N(4), C(5), C(6), C(7), O(8), O(9) SINGLE(0,1), SINGLE(1,0), SINGLE(1,2), SINGLE(2,1), SINGLE(2,3) SINGLE(3,2), SINGLE(3,4), SINGLE(4,3), SINGLE(4,5), SINGLE(5,4) SINGLE(5,6), SINGLE(6,5), SINGLE(5,7), SINGLE(7,5), DOUBLE(7,8) DOUBLE(8,7), SINGLE(7,9), SINGLE(9,7), SINGLE(6,1), SINGLE(1,6)
parse/train/SkeGvaEtPr/SkeGvaEtPr_content_list.json ADDED
@@ -0,0 +1,1404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "NEURAL MARKOV LOGIC NETWORKS ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 176,
8
+ 98,
9
+ 630,
10
+ 121
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous authors Paper under double-blind review ",
17
+ "bbox": [
18
+ 183,
19
+ 145,
20
+ 400,
21
+ 172
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 210,
32
+ 544,
33
+ 224
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "We introduce Neural Markov Logic Networks (NMLNs), a statistical relational learning system that borrows ideas from Markov logic. Like Markov Logic Networks (MLNs), NMLNs are an exponential-family model for modelling distributions over possible worlds, but unlike MLNs, they do not rely on explicitly specified first-order logic rules. Instead, NMLNs learn an implicit representation of such rules as a neural network that acts as a potential function on fragments of the relational structure. Interestingly, any MLN can be represented as an NMLN. Similarly to recently proposed Neural theorem provers (Rocktaschel & Riedel, ¨ 2017), NMLNs can exploit embeddings of constants but, unlike NTPs, NMLNs work well also in their absence. This is extremely important for predicting in settings other than the transductive one. We showcase the potential of NMLNs on knowledge-base completion tasks and on generation of molecular (graph) data. ",
40
+ "bbox": [
41
+ 233,
42
+ 246,
43
+ 764,
44
+ 412
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 176,
54
+ 452,
55
+ 334,
56
+ 468
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Parameters for a statistical relational model are typically estimated from one or more examples of relational structures that typically consist of a large number of ground facts. Examples of such structures are social networks (e.g. Facebook), protein-protein interaction networks, the Web, etc. A challenging task is to learn a probability distribution over such relational structures from one or few examples. One solution is based on the assumption that the relational structure has repeated regularities; this assumption is implicitly or explicitly used in most works on statistical relational learning. Then, statistics about these regularities can be computed for small substructures of the training examples and used to construct a distribution over the relational structures. Together with the maximum-entropy principle, this leads to distributions such as Markov logic networks (Richardson & Domingos, 2006; Kuzelka et al., 2018) ˇ ",
63
+ "bbox": [
64
+ 174,
65
+ 487,
66
+ 825,
67
+ 626
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "In this paper, we propose Neural Markov Logic Networks (NMLN). Here, the statistics which are used to model the probability distribution are not known in advance, but are modelled as neural networks trained together with the probability distribution model. This is very powerful when compared to classical MLNs, where either domain experts are required to design some useful statistics about the domain of interest by hand (i.e. logical rules) or structure learning based on combinatorial search needs to be performed. These requirements normally limit a wide application of these models as out-of-the box tools. It is worth noticing that overtaking the need of such “feature-engineering” is one of the reasons behind the massive adoption of deep learning techniques. However, not much has been done in the same direction by the statistical relational learning community. Moreover, designing statistics as neural networks allows a more fine-grained description of the data, opening the doors to applications of our model to the generative setting. ",
74
+ "bbox": [
75
+ 174,
76
+ 633,
77
+ 825,
78
+ 786
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "CONTRIBUTIONS ",
85
+ "text_level": 1,
86
+ "bbox": [
87
+ 174,
88
+ 811,
89
+ 292,
90
+ 825
91
+ ],
92
+ "page_idx": 0
93
+ },
94
+ {
95
+ "type": "text",
96
+ "text": "The main contributions of this work are: (i) we introduce a new statistical relational model, which overcomes actual limitations of both classical and recent related models such as (Richardson & Domingos, 2006; Rocktaschel & Riedel, 2017; Sourek et al., 2018); ¨ (ii) we propose a theoretical justification of the model as naturally emerging from a principle of Min-Max-entropy; (iii) we provide a Tensorflow implementation of this model; and (iv) we showcase its effectiveness on two quite diverse problems: knowledge-base completion and generative modelling of small molecules. ",
97
+ "bbox": [
98
+ 174,
99
+ 840,
100
+ 823,
101
+ 922
102
+ ],
103
+ "page_idx": 0
104
+ },
105
+ {
106
+ "type": "text",
107
+ "text": "RELATED WORK ",
108
+ "text_level": 1,
109
+ "bbox": [
110
+ 174,
111
+ 103,
112
+ 290,
113
+ 117
114
+ ],
115
+ "page_idx": 1
116
+ },
117
+ {
118
+ "type": "text",
119
+ "text": "The need to extend relational models with neural components is a topic that has been receiving increasing attention in the last few years. An integration of logic reasoning and neural models was proposed based on fuzzy logic (Serafini & Garcez, 2016; Diligenti et al., 2017; Marra et al., 2019). Here, neural models implementing FOL relations are optimized in order to satisfy differentiable approximations of logical formulas obtained by means of fuzzy t-norm theory. However, the lack of probabilistic arguments allows a sound application of such fuzzy-logic based methods only to hard-constrained settings. In Manhaeve et al. (2018), the probabilistic logic programming language ProbLog (De Raedt et al., 2007) is extended to allow probabilities of atoms to be predicted by neural networks and to exploit differentiable algebraic generalizations of decision diagrams to train these networks. Lifted relational neural networks (Sourek et al., 2018) unfold neural networks with shared weights, as in convolutional networks, using forward chaining. A semantically very similar approach was the one in Rocktaschel & Riedel (2017), where the authors implemented the Prolog ¨ backward chaining with a soft unification scheme operating on constants and relations embeddings. The proposed Neural Theorem prover was able to exploit the geometry of the embedding space to improve its reasoning capabilities, but the need for embeddings prevents this model to be applicable to settings different from the transductive one. Most importantly, neither of these latter two works provides means for probabilistic modelling of relational structures. ",
120
+ "bbox": [
121
+ 174,
122
+ 131,
123
+ 825,
124
+ 366
125
+ ],
126
+ "page_idx": 1
127
+ },
128
+ {
129
+ "type": "text",
130
+ "text": "The idea of exploiting neural networks to extract regularities in non-euclidean settings has been recently revisited by the deep learning community in the context of Graph Neural Networks (GNN) models (Scarselli et al., 2009; Defferrard et al., 2016; Xu et al., 2018). In GNNs, latent representations of nodes are obtained by an aggregation of neighboring nodes representation by means of an iterative diffusion mechanism. However, the inference is performed only on neighborhoods induced by the actual connections of the graph, preventing the exploitation of these models for modeling distributions of structural properties of the graph. Lippi & Frasconi (2009) was an early attempt to integrate MLNs with neural components. Here, an MLN was exploited to describe a conditional distribution over ground atoms, given some features of the constants. In particular, the MLN was reparametrized by a neural network evaluated on input features. However, this method still relied on hand-crafted logical rules for modelling the distribution. ",
131
+ "bbox": [
132
+ 174,
133
+ 372,
134
+ 825,
135
+ 525
136
+ ],
137
+ "page_idx": 1
138
+ },
139
+ {
140
+ "type": "text",
141
+ "text": "2 PRELIMINARIES ",
142
+ "text_level": 1,
143
+ "bbox": [
144
+ 176,
145
+ 545,
146
+ 338,
147
+ 560
148
+ ],
149
+ "page_idx": 1
150
+ },
151
+ {
152
+ "type": "text",
153
+ "text": "This paper follows the setting of so-called Model A from Kuzelka et al. (2018). We consider a ˇ function-free first-order logic language $\\mathcal { L }$ , which is built from a set of constants $\\mathcal { C }$ and predicates $\\textstyle { \\mathcal { R } } = \\bigcup _ { i } { \\mathcal { R } } _ { i }$ , where $\\mathcal { R } _ { i }$ contains the predicates of arity i. For $c _ { 1 } , c _ { 2 } , \\ldots , c _ { m } \\in { \\mathcal { C } }$ and $R \\in \\mathcal { R } _ { m }$ , we call $R ( { \\bar { c } } _ { 1 } , c _ { 2 } , \\dots , c _ { m } )$ a ground atom. We define possible world $\\omega \\in \\Omega$ as the pair $( C , A )$ , where $C \\subseteq { \\mathcal { C } }$ , $A$ is a subset of the set of all ground atoms that can be built from the constants in $C$ and any relation in $\\mathcal { R }$ . We define the size of a possible world $n = | C |$ and $\\Omega$ is the set of all possible worlds. A fragment $\\omega \\langle S \\rangle$ is defined as the restriction of $\\omega$ to the constants in $S$ . It is again a pair $\\omega \\langle S \\rangle = ( S , B )$ , with $S$ the constants of the restriction and $B$ a set of ground atoms which only use constants from $S$ . Given a fragment $\\omega \\langle S \\rangle$ and $k = | S |$ , we can anonymize it by mapping the constants in $S$ with a permutation $\\widehat { S }$ of the integer set $\\{ 1 , 2 , . . . , k \\}$ . We call this an anonymized fragment $\\gamma$ . Suppose we have a given world $\\widehat { \\omega }$ of size $n$ , we define $\\Gamma _ { k } ( \\widehat { \\omega } )$ the collection of all the anonymized fragments of width $k$ of $\\widehat { \\omega }$ b. It is easy to verify that $\\begin{array} { r } { | \\Gamma _ { k } ( \\widehat { \\omega } ) | = { \\binom { n } { k } } k ! } \\end{array}$ . The collection $\\Gamma _ { k } ( \\widehat { \\omega } )$ is a multiset, since, after anonymization, multiple fragments could be identical. An example bof the process of anonymization and of the identification of structural patterns among anonymized fragments is shown in Figure 1. ",
154
+ "bbox": [
155
+ 173,
156
+ 577,
157
+ 825,
158
+ 790
159
+ ],
160
+ "page_idx": 1
161
+ },
162
+ {
163
+ "type": "text",
164
+ "text": "3 NEURAL MARKOV LOGIC NETWORKS ",
165
+ "text_level": 1,
166
+ "bbox": [
167
+ 176,
168
+ 810,
169
+ 522,
170
+ 827
171
+ ],
172
+ "page_idx": 1
173
+ },
174
+ {
175
+ "type": "text",
176
+ "text": "3.1 INTUITION AND FORMULATION ",
177
+ "text_level": 1,
178
+ "bbox": [
179
+ 176,
180
+ 842,
181
+ 431,
182
+ 856
183
+ ],
184
+ "page_idx": 1
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "Given a world $\\widehat { \\omega } \\in \\Omega$ , we are interested in models of the probability $P _ { \\omega }$ , for a generic $\\omega \\in { \\Omega }$ . bTo this end, we want to compute statistics on fragments of the given $\\widehat { \\omega }$ and exploit them to conbstruct a distribution on (possibly larger and smaller) relational structures $\\omega$ . Let us define $\\phi ( \\gamma )$ as a fragment potential function, which is simply a function from anonymized fragments of width $k$ to real numbers. We can search for a maximum-entropy distribution $p ( \\omega )$ such that the following two expected values are the same: (i) the expected value of $\\phi ( \\gamma )$ where $\\gamma$ is sampled uniformly from $\\Gamma _ { k } ( \\widehat { \\omega } )$ and (ii) the expected value of $\\phi ( \\gamma ^ { \\prime } )$ where $\\gamma ^ { \\prime }$ is sampled uniformly from $\\Gamma _ { k } ( \\omega )$ and $\\omega$ bis sampled, in turn, from $p ( \\omega )$ . The intuition here is that, at least on average, the fragments of the given training example should look similar to the fragments of possible worlds sampled from the distribution. It follows from (Kuzelka et al., 2018) that the resulting maximum-entropy distribution ˇ is an exponential-family distribution resembling Markov logic networks. ",
189
+ "bbox": [
190
+ 174,
191
+ 867,
192
+ 823,
193
+ 924
194
+ ],
195
+ "page_idx": 1
196
+ },
197
+ {
198
+ "type": "image",
199
+ "img_path": "images/caaa594011e82e2348e2adee3d7055a9f68f6f0c5fd29f627a9949169e13e3fa.jpg",
200
+ "image_caption": [
201
+ "Figure 1: The process of individuating structural patterns in anonymized fragments. White circles represent constants, while the two relations are represented as solid and dashed arrows (absence of an arrow means that the relation is false). The given world is shown on the left. Two possible fragments are shown in the middle. All their possible anonymizations are shown on the right. Grey circles show two repeated anonymized fragments found in two different fragments. The model exploits these regularities on fragments to model the distribution of the larger structure. "
202
+ ],
203
+ "image_footnote": [],
204
+ "bbox": [
205
+ 192,
206
+ 99,
207
+ 782,
208
+ 282
209
+ ],
210
+ "page_idx": 2
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "",
215
+ "bbox": [
216
+ 174,
217
+ 414,
218
+ 825,
219
+ 512
220
+ ],
221
+ "page_idx": 2
222
+ },
223
+ {
224
+ "type": "text",
225
+ "text": "The max-entropy setting provides us with a sound starting point for designing statistical relational models that generalize classical models such as Markov random fields. However, a necessary condition for these models to be designed is that one can provide a set of statistics $\\phi ( \\omega )$ describing the data. In this section, we show how to get rid of the need to provide statistics in advance and how to learn these statistics together with the probabilistic model in a differentiable manner. ",
226
+ "bbox": [
227
+ 174,
228
+ 518,
229
+ 825,
230
+ 588
231
+ ],
232
+ "page_idx": 2
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "Let us consider a fragment neural potential function $\\phi ( \\gamma ; { \\mathbf { w } } )$ . It is a parametric function with parameters w. Let $\\begin{array} { r } { \\Phi ( \\omega ; \\bar { \\mathbf { w } } ) = \\frac { 1 } { | \\Gamma _ { k } ( \\omega ) | } \\bar { \\sum _ { \\gamma \\in \\Gamma _ { k } ( \\omega ) } } \\phi ( \\gamma ; \\mathbf { w } ) } \\end{array}$ be the corresponding global neural potential. We need a learning principle which would allow us to find a good $\\phi ( \\gamma ; { \\mathbf { w } } )$ to describe our data. To this end, suppose we need to solve the maximum-entropy optimization problem, but without any constraint on the statistics. The maximum-entropy solution in this case is the uniform distribution, which assigns equal probability to all possble worlds $\\omega$ . Now, suppose we add a single constraint on a potential $\\tilde { \\Phi } ( \\omega )$ . If this potential is informative and makes some worlds more likely than others, then the solution moves from the uniform distribution to another distribution with lower entropy. Using this intuition, we can have a scheme where we maximize entropy by selecting the maximumentropy distribution and minimize it at the same time by choosing the most informative statistics. ",
237
+ "bbox": [
238
+ 174,
239
+ 594,
240
+ 825,
241
+ 739
242
+ ],
243
+ "page_idx": 2
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "The above considerations give rise to a Min-Max-Entropy model for the target probability distribution $P _ { \\omega }$ , which we call Neural Markov Logic Network and which we describe in turn. Let us first define the Max-Entropy problem with the new neural potentials (stated here as minimization of negative entropy): ",
248
+ "bbox": [
249
+ 174,
250
+ 747,
251
+ 825,
252
+ 804
253
+ ],
254
+ "page_idx": 2
255
+ },
256
+ {
257
+ "type": "text",
258
+ "text": "subject to ",
259
+ "bbox": [
260
+ 238,
261
+ 876,
262
+ 303,
263
+ 890
264
+ ],
265
+ "page_idx": 2
266
+ },
267
+ {
268
+ "type": "equation",
269
+ "img_path": "images/8bd64f50e280009c7b03411fcf2f3acb4794ea958d85bc9d8ed7019aa9524d8a.jpg",
270
+ "text": "$$\n\\begin{array} { r l r } { \\displaystyle \\sum _ { \\omega } P _ { \\omega } \\log P _ { \\omega } } \\\\ { \\displaystyle \\sum _ { \\omega } P _ { \\omega } = 1 , \\forall \\omega : p _ { \\omega } \\geq 0 } \\\\ { \\forall i : \\mathbb { E } _ { P _ { \\omega } } [ \\Phi _ { i } ( \\omega ; \\mathbf { w } _ { i } ) ] = \\Phi _ { i } ( \\widehat { \\omega } ; \\mathbf { w } _ { i } ) } & { \\quad } & { \\mathrm { w i t h ~ } 0 < i \\leq M } \\end{array}\n$$",
271
+ "text_format": "latex",
272
+ "bbox": [
273
+ 362,
274
+ 834,
275
+ 761,
276
+ 922
277
+ ],
278
+ "page_idx": 2
279
+ },
280
+ {
281
+ "type": "text",
282
+ "text": "For fixed $\\mathbf { w } _ { i }$ ’s, we can use Lagrangian duality to obtain the following solution of the maximum \nentropy rameters blem: are sol $\\begin{array} { r } { P _ { \\omega } = \\frac { 1 } { Z } \\exp \\left( \\sum _ { i } \\beta _ { i } \\Phi ( \\omega ; \\mathbf { \\bar { w } } _ { i } ) \\right) } \\end{array}$ . $Z$ nstant and the pa-, which coincides $\\beta _ { i }$ $\\begin{array} { r } { \\left\\{ \\sum _ { i = 1 } ^ { M } \\beta _ { i } \\Phi _ { i } ( \\widehat { \\omega } ; \\mathbf { w } _ { i } ) - \\log Z \\right\\} } \\end{array}$ βi \nwith maximum-likelihood.1 ",
283
+ "bbox": [
284
+ 173,
285
+ 103,
286
+ 825,
287
+ 175
288
+ ],
289
+ "page_idx": 3
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "Next we still need to incorporate the minimization of entropy by optimizing $\\mathbf { w } _ { i }$ ’s. Let us denote by $H ( \\beta _ { 1 } , \\dots , \\beta _ { M } , \\mathbf { w } _ { 1 } , \\dots , \\mathbf { w } _ { M } )$ the entropy of the distribution $P _ { \\omega }$ . Now, as previously introduced, the selection of the optimal values $\\mathbf { w } _ { i }$ is governed by the principle of minimization of entropy, leading to the optimization problem: mi wi $\\mathbf { \\psi } _ { 1 } \\operatorname* { m a x } _ { \\beta _ { i } } H ( \\beta _ { 1 } , \\ldots , \\beta _ { M } , \\mathbf { \\bar { w } } _ { 1 } , \\ldots , \\mathbf { w } _ { M } ) =$ $- \\underset { \\mathbf { w } _ { i } } { \\operatorname* { m a x } } \\ \\underset { \\beta _ { i } } { \\operatorname* { m i n } } - H ( \\beta _ { 1 } , \\ldots , \\beta _ { M } , \\mathbf { w } _ { 1 } , \\ldots , \\mathbf { w } _ { M } )$ subject to the constraints (2) and (3). Plugging in the dual problem and using strong duality, we obtain the following unconstrained optimization problem which is equivalent to the maximization of log-likelihood: $\\begin{array} { r } { \\operatorname* { m a x } _ { \\mathbf { w } _ { i } , \\boldsymbol { \\beta } _ { i } } \\left\\{ \\sum _ { i = 1 } ^ { M } \\beta _ { i } \\bar { \\Phi } _ { i } ( \\boldsymbol { \\widehat { \\omega } } ; \\mathbf { w } _ { i } ) - \\mathrm { l o g } Z \\right\\} } \\end{array}$ . The maximization of the log-likelihood will be carried out by a gradient-based optimization scheme. The gradients of the log-likelihood w.r.t. to both the parameters $w _ { i , j }$ , where $w _ { i , j }$ denotes the $j$ -th component of $\\mathbf { w } _ { i }$ , and $\\beta _ { i }$ are: ",
294
+ "bbox": [
295
+ 173,
296
+ 181,
297
+ 825,
298
+ 345
299
+ ],
300
+ "page_idx": 3
301
+ },
302
+ {
303
+ "type": "equation",
304
+ "img_path": "images/4570f72eb32c89e94075217645a6d4f832ac80820fbd8b0091ac2bb7178c206e.jpg",
305
+ "text": "$$\n\\begin{array} { r l } & { \\displaystyle \\frac { \\partial \\log ( P _ { \\widehat { \\omega } } ) } { \\partial w _ { i , j } } = \\beta _ { i } \\biggr ( \\frac { \\partial \\Phi _ { i } ( \\widehat { \\omega } ; \\mathbf { w } _ { i } ) } { \\partial w _ { i , j } } - \\mathbb { E } _ { \\omega \\sim P } \\Big [ \\frac { \\partial \\Phi ( \\omega ; \\mathbf { w } _ { i } ) } { \\partial w _ { i , j } } \\Big ] \\biggr ) } \\\\ & { \\displaystyle \\frac { \\partial \\log ( P _ { \\widehat { \\omega } } ) } { \\partial \\beta _ { i } } = \\biggr ( \\Phi _ { i } ( \\widehat { \\omega } ; w _ { i } ) - \\mathbb { E } _ { \\omega \\sim P } [ \\Phi _ { i } ( \\omega ; w _ { i } ) ] \\biggr ) } \\end{array}\n$$",
306
+ "text_format": "latex",
307
+ "bbox": [
308
+ 315,
309
+ 371,
310
+ 681,
311
+ 444
312
+ ],
313
+ "page_idx": 3
314
+ },
315
+ {
316
+ "type": "text",
317
+ "text": "At a stationary point, Eq. 5 recovers the initial constraint on statistics imposed in the maximization of the entropy. However, the minimization of the entropy is mapped to a new requirement: at stationary conditions, the expected value of the gradients of the $\\Phi _ { i }$ under the distribution must match the gradients of the $\\Phi _ { i }$ evaluated at the data points. ",
318
+ "bbox": [
319
+ 174,
320
+ 455,
321
+ 825,
322
+ 512
323
+ ],
324
+ "page_idx": 3
325
+ },
326
+ {
327
+ "type": "text",
328
+ "text": "3.2 VECTOR EMBEDDINGS OF DOMAIN ELEMENTS ",
329
+ "text_level": 1,
330
+ "bbox": [
331
+ 174,
332
+ 530,
333
+ 542,
334
+ 545
335
+ ],
336
+ "page_idx": 3
337
+ },
338
+ {
339
+ "type": "text",
340
+ "text": "By anonymizing a fragment, the model loses any trace of the identity of the constants involved in it, preserving only their structural behaviours. While this feature is essential to allow the identification of structural patterns also inside a single possible world, it prevents the model from having different behaviour on specific constants. This, instead, is a basic feature of many existing transductive models, like NTP (Rocktaschel & Riedel, 2017), which exploit the geometry of a latent representation ¨ space of constants to improve their prediction capabilities. ",
341
+ "bbox": [
342
+ 174,
343
+ 556,
344
+ 825,
345
+ 640
346
+ ],
347
+ "page_idx": 3
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "To this end, we define an embedding fragment neural potential $\\phi _ { e } ( \\gamma , \\widehat { S } ; \\mathbf { w } , \\Theta )$ , which is function of the anonymized fragment but also of the specific constants involved in it (i.e. the list of constants $\\widehat { S }$ ). In particular, in transductive settings, we always have a possible world $\\widehat { \\omega }$ and we use the same bconstant set $S$ both during learning and inference. Let $\\boldsymbol { \\Theta } \\in \\dot { \\mathbb { R } } ^ { n \\times d }$ bbe a variable embedding matrix. It can be considered a map from the constant set $S$ to a latent real domain $\\mathbb { R } ^ { d }$ , i.e. the embedding space. Let $c ( \\widehat { S } , \\Theta )$ be a function that concatenates the $k$ rows of $\\Theta$ corresponding to the $k$ constants in the restricted set $\\widehat { S }$ . Thus, the embedding fragment neural potential $\\phi _ { e }$ can be seen as a function of both $\\gamma$ , which encodes the structural properties of the fragment and $c ( \\widehat { S } , \\Theta )$ , which encodes the identity of constants by providing a latent representation for them. In other words, $\\phi _ { e } ( \\gamma , \\widehat { S } ; { \\bf w } , \\Theta ) =$ $f ( \\gamma , c ( \\widehat { S } , \\Theta ) ; \\mathbf { w } )$ for some neural function $f$ parameterized by w. This is inspired by works in the NLP community (Mikolov et al., 2013; Mnih & Kavukcuoglu, 2013), where the $c$ function can have different forms than concatenation. The components of the embedding vectors are treated as any other weights of the potential functions and are updated using gradients computed according to Eq. 4. Intuitively, the contrastive nature of the learning (Bordes et al., 2013; Trouillon et al., 2017), leads to the development of similar embeddings for similar constants. As we show in Section 4.2, the addition of embedding of constants helps improving the prediction capability of our model in transductive settings. ",
352
+ "bbox": [
353
+ 173,
354
+ 648,
355
+ 825,
356
+ 861
357
+ ],
358
+ "page_idx": 3
359
+ },
360
+ {
361
+ "type": "text",
362
+ "text": "",
363
+ "bbox": [
364
+ 176,
365
+ 103,
366
+ 823,
367
+ 146
368
+ ],
369
+ "page_idx": 4
370
+ },
371
+ {
372
+ "type": "text",
373
+ "text": "3.3 INFERENCE ",
374
+ "text_level": 1,
375
+ "bbox": [
376
+ 174,
377
+ 166,
378
+ 294,
379
+ 181
380
+ ],
381
+ "page_idx": 4
382
+ },
383
+ {
384
+ "type": "text",
385
+ "text": "In order to design an optimization procedure to learn Neural Markov Logic Networks, we need to rely on some methods to sample from the distribution. In this paper, we exploit MCMC methods, in particular approximate Gibbs Sampling (GS) (Robert & Casella, 2013), to sample from Neural Markov Logic Networks. The approximation comes from the fact that GS requires a large number of steps before converging to the target distribution. However, we run it only for a limited number of steps $t$ , which, in some cases, is restricted to $t = 1$ . When this happens, our method recovers a discrete version of the Contrastive Divergence (CD) algorithm (Hinton, 2002). ",
386
+ "bbox": [
387
+ 174,
388
+ 195,
389
+ 825,
390
+ 292
391
+ ],
392
+ "page_idx": 4
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "Gibbs sampling cannot effectively handle distributions with a lot of determinism. In normal Markov logic networks, sampling from such distributions may be tackled by an algorithm called MC-SAT (Poon & Domingos, 2006). However, MC-SAT requires an explicit logical encoding of the deterministic constraints, which is not available in Neural Markov Logic Networks where deterministic constraints are implicitly encoded by the potential functions. In fact, only constraints that are almost deterministic, i.e. having very large weights, can occur in Neural Markov Logic Networks but, at least for Gibbs sampling, the effect is the same. Such distributions would naturally be learned in our framework on most datasets. Our solution in this paper is to simply avoid learning distributions with determinism by adding noise during training. In particular, we set a parameter $\\bar { \\pi _ { n } } \\in [ 0 , 1 ]$ and, at the beginning of each training epoch, we inverted each ground atom of the input possible worlds (T rue to F alse and vice versa) with probability $\\pi _ { n }$ . Moreover, this added noise prevents the model to perfectly fit training data, acting as a regularizer (Bishop, 1995). ",
397
+ "bbox": [
398
+ 174,
399
+ 299,
400
+ 825,
401
+ 465
402
+ ],
403
+ "page_idx": 4
404
+ },
405
+ {
406
+ "type": "text",
407
+ "text": "4 EXPERIMENTS ",
408
+ "text_level": 1,
409
+ "bbox": [
410
+ 176,
411
+ 491,
412
+ 326,
413
+ 507
414
+ ],
415
+ "page_idx": 4
416
+ },
417
+ {
418
+ "type": "text",
419
+ "text": "4.1 IMPLEMENTATION DETAILS ",
420
+ "text_level": 1,
421
+ "bbox": [
422
+ 176,
423
+ 525,
424
+ 405,
425
+ 539
426
+ ],
427
+ "page_idx": 4
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "We implemented Neural Markov Logic Networks in Tensorflow. In order to maximally exploit the parallel computations capabilities of GPUs, multiple Markov chains are run in parallel. This is also useful because expected values of gradients (see Eq. 4 and 5) are computed on uncorrelated samples, while sequential samples sampled from a unique chain are known to be highly correlated. ",
432
+ "bbox": [
433
+ 174,
434
+ 553,
435
+ 823,
436
+ 608
437
+ ],
438
+ "page_idx": 4
439
+ },
440
+ {
441
+ "type": "text",
442
+ "text": "In experiments, the different global neural potentials $\\Phi _ { i }$ can rely on fragments of different sizes $k$ so that for small $k$ , the model can focus on learning very local statistics of the data, while, for large $k$ , the model can focus on learning statistics on larger substructures. For example, if we represent molecules as a relational structure (see Section 4.3), rings are inherently global statistics which cannot be captured by local properties. This example underlines the importance of the choice of $k$ for a correct modeling of the data distribution. However, since a single evaluation of $\\Phi _ { i } ( w )$ requires a summation over $d = { \\binom { n } { k } } k !$ number of terms, the number of elements of the sum grows exponentially with $k$ (and polynomially, but very fast, with $n$ ). So exploiting large $k$ is usually admissible only for small domain sizes $n$ . ",
443
+ "bbox": [
444
+ 174,
445
+ 616,
446
+ 825,
447
+ 741
448
+ ],
449
+ "page_idx": 4
450
+ },
451
+ {
452
+ "type": "text",
453
+ "text": "4.2 KNOWLEDGE BASE COMPLETION ",
454
+ "text_level": 1,
455
+ "bbox": [
456
+ 176,
457
+ 763,
458
+ 446,
459
+ 777
460
+ ],
461
+ "page_idx": 4
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "In Knowledge Base Completion (KBC), we are provided with an incomplete Knowledge Base (KB) and asked to complete the missing part. ",
466
+ "bbox": [
467
+ 173,
468
+ 790,
469
+ 821,
470
+ 820
471
+ ],
472
+ "page_idx": 4
473
+ },
474
+ {
475
+ "type": "text",
476
+ "text": "The KBC task is inherently in the transductive setting, since all the constants are exploited both during the training and testing phase. Moreover, data are provided in a positive-only fashion: we only know what is true and we cannot distinguish between unknown and false facts. Kuzelka & ˇ Davis (2019) studied KBC tasks under the missing-completely-at-random assumption and showed consistency of learning by maximum-likelihood where both missing and false facts are treated in the same way as false. Hence, here we also provide both unknown and false facts as false facts during the training procedure. ",
477
+ "bbox": [
478
+ 174,
479
+ 825,
480
+ 823,
481
+ 924
482
+ ],
483
+ "page_idx": 4
484
+ },
485
+ {
486
+ "type": "image",
487
+ "img_path": "images/f933283831e815ddb8d67d7a4a800e554ff5cad3541f0b593cd20d0f2f0a10d7.jpg",
488
+ "image_caption": [
489
+ "Figure 2: Knowledge Base Completion in the Smokers dataset. Circles represent constants. A grey circle means that the predicate smokes is True. A white circle means that the value of the predicate smokes is unknown. Links represent the relation friendOf (absence of an arrow means that the relation is False). The given world is shown on the top (2a), while the completed knowledge base is shown on the bottom (2b). The system learnt the symmetric nature of the friendship relation. It learnt that a friend of at least two smokers is also a smoker, and that two smokers, who are friends of the same person, are also friends. "
490
+ ],
491
+ "image_footnote": [],
492
+ "bbox": [
493
+ 174,
494
+ 98,
495
+ 821,
496
+ 231
497
+ ],
498
+ "page_idx": 5
499
+ },
500
+ {
501
+ "type": "text",
502
+ "text": "Smokers. The “Smokers” dataset (Richardson & Domingos, 2006) is a classical example in statistical relational learning literature. Here, two relations are defined on a set of constants representing people: the unary predicate Smokes identifies those people who smoke, while the binary predicate friendOf maps people to their friend. This dataset is often used to show how a statistical relational learning algorithm can model a distribution by finding a correlation of smoking habits of friends. For example, in MLNs, one typically uses weighted logical rules such as: ∀x ∀y friendOf $\\therefore y ) \\to \\operatorname { s m o k e s } ( x ) \\operatorname { s m o k e s } ( y )$ . We learned a NMLN on the small smokers dataset. Since no prior knowledge about the type of rules that are relevant was used by NMLNs, the model itself had to identify which statistics are mostly informative of the provided data by learning the neural potential functions. ",
503
+ "bbox": [
504
+ 173,
505
+ 369,
506
+ 825,
507
+ 508
508
+ ],
509
+ "page_idx": 5
510
+ },
511
+ {
512
+ "type": "text",
513
+ "text": "Here we use the Smokers dataset to define a Knowledge Base Completion task and to provide some basic intuitions about what kind of rules the model could have learned. In Figure 2, we show the setting before and after completion. In Figure 2b, we highlight only new facts whose marginal probability after training is significantly higher than the others, even though other facts have probabilities higher than the prior. ",
514
+ "bbox": [
515
+ 174,
516
+ 515,
517
+ 825,
518
+ 585
519
+ ],
520
+ "page_idx": 5
521
+ },
522
+ {
523
+ "type": "text",
524
+ "text": "Nations. The Nations dataset (Kok & Domingos, 2007) provides information about properties and relations among countries as ground facts, like economicaid(usa,israel) or embassy(israel,poland). There are $n = 1 4$ constants (i.e. nations), 56 relations and 2565 true facts. This dataset has been recently exploited for a KBC task by Rocktaschel & Riedel (2017), ¨ where some facts were removed from the dataset and the task was to predict them. The authors compared the performances of the state-of-the-art ComplEx neural model (Trouillon et al., 2017) with their proposed differentiable end-to-end neural theorem prover, showing that the combination of the two was able to outperform both of the models. Unary predicates were removed since the ComplEx model cannot deal with them. In this section, we show how we can use NMLNs to tackle a KBC task on the Nations dataset. ",
525
+ "bbox": [
526
+ 173,
527
+ 603,
528
+ 825,
529
+ 742
530
+ ],
531
+ "page_idx": 5
532
+ },
533
+ {
534
+ "type": "text",
535
+ "text": "We implemented the fragment neural potentials $\\phi ( \\gamma )$ as 2 hidden-layer neural networks, with sigmoidal hidden activations and linear output layer. The selection of the hyperparameters and the early-stopping epoch have been selected by means of a held-out validation set (the splits are same as the ones in Rocktaschel & Riedel (2017)). The size of layers has been selected from the interval ¨ [75, 100, 150] for the first layer and [30, 50, 100] for the second layer. The embedding size has been selected from the interval [2, 3, 5, 10]. The noise probability $\\pi _ { n }$ has been selected from the interval $[ 0 , 0 . 0 1 , 0 . 0 2 , 0 . 0 3 ]$ . The number of parallel chains has been selected from the interval [10, 20, 30]. ",
536
+ "bbox": [
537
+ 174,
538
+ 750,
539
+ 825,
540
+ 848
541
+ ],
542
+ "page_idx": 5
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "We followed the evaluation procedure in Rocktaschel & Riedel (2017). In particular, we took a test ¨ fact and corrupted its first and second argument in all possible ways such that the corrupted fact is not in the original KB. Subsequently, we predicted a ranking of every test fact and its corruptions to calculate MRR and $\\mathrm { H I T S } @ \\mathrm { m }$ . The ranking is based on marginal probabilities estimated by running Gibbs sampling on the Neural Markov Logic Network; while training the network, we also run a parallel Gibbs sampling chain on a state in which we fix the known part of the KB as true. Here, we compare the ComplEx model, the plain Neural Theorem Prover (NTP), the composition of the previous two $( N T P \\lambda )$ , our plain model (NMLN) and our model when using potentials with embeddings (NMLN-Emb). In Table 1 we report the results of the KBC task on Nations. Both our models outperform competitors on the $\\mathrm { H I T S } @ 1$ metric, with NMLN-Emb having a large gap over all the other models. It is interesting to note that the plain NMLN still performs better than differentiable provers, even if it is the only model which cannot exploit embeddings to perform reasoning and that has to rely only on the relational structure of fragments to make predictions. Finally, NMLN-Emb performs equally to or better than all the competitors in all the other metrics. ",
547
+ "bbox": [
548
+ 174,
549
+ 853,
550
+ 823,
551
+ 924
552
+ ],
553
+ "page_idx": 5
554
+ },
555
+ {
556
+ "type": "table",
557
+ "img_path": "images/10830a1bd6d5b966cf998a46dd70ae0752b24d768811e17f85d9dcb789b94021.jpg",
558
+ "table_caption": [
559
+ "Table 1: MRR and HITS@m on Nations. "
560
+ ],
561
+ "table_footnote": [],
562
+ "table_body": "<table><tr><td rowspan=\"2\">Metric</td><td colspan=\"5\">Model</td></tr><tr><td>ComplEx</td><td>NTP</td><td>NTPX</td><td>NMLN</td><td>NMLN-Emb</td></tr><tr><td>MRR</td><td>0.75</td><td>0.75</td><td>0.74</td><td>0.77</td><td>0.81</td></tr><tr><td>HITS@1</td><td>0.62</td><td>0.62</td><td>0.59</td><td>0.64</td><td>0.71</td></tr><tr><td>HITS@3</td><td>0.84</td><td>0.86</td><td>0.89</td><td>0.86</td><td>0.89</td></tr><tr><td>HITS@10</td><td>0.99</td><td>0.99</td><td>0.99</td><td>0.99</td><td>0.99</td></tr></table>",
563
+ "bbox": [
564
+ 264,
565
+ 126,
566
+ 728,
567
+ 233
568
+ ],
569
+ "page_idx": 6
570
+ },
571
+ {
572
+ "type": "text",
573
+ "text": "",
574
+ "bbox": [
575
+ 174,
576
+ 257,
577
+ 825,
578
+ 383
579
+ ],
580
+ "page_idx": 6
581
+ },
582
+ {
583
+ "type": "text",
584
+ "text": "4.3 GRAPH GENERATION ",
585
+ "text_level": 1,
586
+ "bbox": [
587
+ 176,
588
+ 400,
589
+ 359,
590
+ 414
591
+ ],
592
+ "page_idx": 6
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "One of the main features differentiating our model from standard MLNs is that we learn the statistics $\\phi ( \\gamma )$ in a differentiable manner. The obtained probability distribution is then often far more fine grained than using predefined or hand-made statistics, that are limited to what the user considers important and do not search for other interesting regularities in the data. This opens the doors to the application of NMLNs to generative tasks in non-euclidean settings, which are receiving an increasing interest recently (You et al., 2018; Li et al., 2018). ",
597
+ "bbox": [
598
+ 174,
599
+ 426,
600
+ 825,
601
+ 510
602
+ ],
603
+ "page_idx": 6
604
+ },
605
+ {
606
+ "type": "text",
607
+ "text": "In generation tasks, our model is asked to learn the probability distribution of the relational structures induced by a graph. Indeed, any FOL-description can be considered a multi-hyper graph; thus generating in the FOL setting is applicable to generating in any graph domain. In particular, to generate graphs, we can just use the same sampling technique used during training (i.e. Gibbs Sampling) to extract new samples. ",
608
+ "bbox": [
609
+ 174,
610
+ 517,
611
+ 825,
612
+ 587
613
+ ],
614
+ "page_idx": 6
615
+ },
616
+ {
617
+ "type": "text",
618
+ "text": "In this section, we describe a molecule generation task. We used as training data the ChEMBL molecule database (Gaulton et al., 2016). We restricted the dataset to molecules with 8 heavy atoms. We used the RDKit framework 2 to get a FOL representation of the molecules from their SMILES encoding. In particular, we exploited only molecules having the most frequent atom types, i.e. C, N, O, S, Cl, F, P, and we encoded only two kinds of bonds: SINGLE and DOUBLE. A more detailed description of the data format is shown in the appendix. ",
619
+ "bbox": [
620
+ 174,
621
+ 593,
622
+ 825,
623
+ 678
624
+ ],
625
+ "page_idx": 6
626
+ },
627
+ {
628
+ "type": "text",
629
+ "text": "We implemented the fragment neural potentials $\\phi ( \\gamma )$ as neural networks with sigmoidal hidden activations and linear output layer. The hyperparameters were selected from the following ranges: the number of layers in [1, 2]; the hidden sizes of the layers in [30, 100, 150, 200]; the number of fragment potentials in [1, 2], the size $k$ of potentials in [2, 3, 4, 5, 6]. The number of parallel chains was set to 5. ",
630
+ "bbox": [
631
+ 174,
632
+ 684,
633
+ 825,
634
+ 753
635
+ ],
636
+ "page_idx": 6
637
+ },
638
+ {
639
+ "type": "text",
640
+ "text": "To qualitatively evaluate the results of this generative experiment, we follow Li et al. (2018), who designed an LSTM-based architecture for generative molecule modelling and applied it in a similar setting to ours. In Figure 3, we show a comparison between a sample of training data and a (random) sample of molecules generated by the proposed model. In particular, 20 generated samples are chosen randomly from the last 1000 samples extracted during the training procedure. By choosing them randomly, we avoided to have very correlated samples, which is inherent in the Gibbs sampling procedure. The generated samples resembles training data both in structural patterns and variety fairly well. Furthermore, in Figure 4, we compare the statistics, used in Li et al. (2018) for a similar task, on a sample of 1000 training and generated molecules. These statistics represent both general structural properties applicable to any graph as well as chemical structural properties of molecules (e.g. the topological polar surface area (TPSA) is a topological indicator of the capability of a molecule to permeate a membrane as a function of the number of polar atoms it contains). These statistics were computed using the RDkit framework. ",
641
+ "bbox": [
642
+ 174,
643
+ 761,
644
+ 825,
645
+ 900
646
+ ],
647
+ "page_idx": 6
648
+ },
649
+ {
650
+ "type": "image",
651
+ "img_path": "images/ea9bdbbe11f7b4bb089f5a26435feecd12cb2ca3f945e7c24fff10cfd9137b97.jpg",
652
+ "image_caption": [
653
+ "Figure 3: Molecules generation. A comparison between a sample of training data and a (random) sample of molecules generated by the proposed model. The generated samples fairly resembles training data both in structural patterns and variety. Better viewed in color. "
654
+ ],
655
+ "image_footnote": [],
656
+ "bbox": [
657
+ 192,
658
+ 108,
659
+ 805,
660
+ 303
661
+ ],
662
+ "page_idx": 7
663
+ },
664
+ {
665
+ "type": "image",
666
+ "img_path": "images/92f9fa95ebcfac9f7bc7ec27ed99e6e67dc3bcfed8eb05071fb10990960705e1.jpg",
667
+ "image_caption": [
668
+ "Figure 4: Molecules generation. Comparing the distributions of some chemical properties of the training data with the ones of generated data. The generated samples are capable of perfectly fitting structural properties and to very well resembling functional properties. "
669
+ ],
670
+ "image_footnote": [],
671
+ "bbox": [
672
+ 274,
673
+ 388,
674
+ 720,
675
+ 559
676
+ ],
677
+ "page_idx": 7
678
+ },
679
+ {
680
+ "type": "text",
681
+ "text": "",
682
+ "bbox": [
683
+ 174,
684
+ 656,
685
+ 825,
686
+ 699
687
+ ],
688
+ "page_idx": 7
689
+ },
690
+ {
691
+ "type": "text",
692
+ "text": "5 CONCLUSIONS ",
693
+ "text_level": 1,
694
+ "bbox": [
695
+ 176,
696
+ 736,
697
+ 328,
698
+ 751
699
+ ],
700
+ "page_idx": 7
701
+ },
702
+ {
703
+ "type": "text",
704
+ "text": "In this paper we have introduced Neural Markov Logic Networks, a statistical relational learning model combining representation learning power of neural networks with principled handling of uncertainty in the maximum-entropy framework. The proposed system works remarkably well on small domains. Although not explained in detail in this paper, it is also straightforward to add standard logical features as used in MLNs to NMLNs. ",
705
+ "bbox": [
706
+ 174,
707
+ 776,
708
+ 825,
709
+ 847
710
+ ],
711
+ "page_idx": 7
712
+ },
713
+ {
714
+ "type": "text",
715
+ "text": "The main future challenge is making NMLNs scale to larger domains. At the moment NMLNs do not scale to large knowledge bases, which is not that surprising given that NMLNs can theoretically represent any distribution. A more work should therefore be done in the direction of identifying more tractable subclasses of NMLNs and exploiting insights from lifted inference literature (Braz et al., 2005; Gogate & Domingos, 2011; den Broeck et al., 2011). ",
716
+ "bbox": [
717
+ 174,
718
+ 853,
719
+ 825,
720
+ 924
721
+ ],
722
+ "page_idx": 7
723
+ },
724
+ {
725
+ "type": "text",
726
+ "text": "REFERENCES ",
727
+ "text_level": 1,
728
+ "bbox": [
729
+ 174,
730
+ 102,
731
+ 287,
732
+ 118
733
+ ],
734
+ "page_idx": 8
735
+ },
736
+ {
737
+ "type": "text",
738
+ "text": "Chris M Bishop. Training with noise is equivalent to tikhonov regularization. Neural computation, 7(1):108–116, 1995. ",
739
+ "bbox": [
740
+ 173,
741
+ 126,
742
+ 823,
743
+ 155
744
+ ],
745
+ "page_idx": 8
746
+ },
747
+ {
748
+ "type": "text",
749
+ "text": "Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Advances in neural information processing systems, pp. 2787–2795, 2013. ",
750
+ "bbox": [
751
+ 176,
752
+ 164,
753
+ 823,
754
+ 207
755
+ ],
756
+ "page_idx": 8
757
+ },
758
+ {
759
+ "type": "text",
760
+ "text": "Stephen Boyd and Lieven Vandenberghe. Convex optimization. Cambridge university press, 2004. ",
761
+ "bbox": [
762
+ 171,
763
+ 215,
764
+ 820,
765
+ 232
766
+ ],
767
+ "page_idx": 8
768
+ },
769
+ {
770
+ "type": "text",
771
+ "text": "Rodrigo De Salvo Braz, Eyal Amir, and Dan Roth. Lifted first-order probabilistic inference. In Proceedings of the 19th international joint conference on Artificial intelligence, pp. 1319–1325, 2005. ",
772
+ "bbox": [
773
+ 174,
774
+ 239,
775
+ 823,
776
+ 282
777
+ ],
778
+ "page_idx": 8
779
+ },
780
+ {
781
+ "type": "text",
782
+ "text": "David Buchman and David Poole. Representing aggregators in relational probabilistic models. In Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015. ",
783
+ "bbox": [
784
+ 173,
785
+ 291,
786
+ 825,
787
+ 321
788
+ ],
789
+ "page_idx": 8
790
+ },
791
+ {
792
+ "type": "text",
793
+ "text": "Luc De Raedt, Angelika Kimmig, and Hannu Toivonen. Problog: A probabilistic prolog and its application in link discovery. In IJCAI, volume 7, pp. 2462–2467. Hyderabad, 2007. ",
794
+ "bbox": [
795
+ 173,
796
+ 329,
797
+ 825,
798
+ 359
799
+ ],
800
+ "page_idx": 8
801
+ },
802
+ {
803
+ "type": "text",
804
+ "text": "Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In Advances in neural information processing systems, pp. 3844–3852, 2016. ",
805
+ "bbox": [
806
+ 173,
807
+ 367,
808
+ 825,
809
+ 411
810
+ ],
811
+ "page_idx": 8
812
+ },
813
+ {
814
+ "type": "text",
815
+ "text": "Guy Van den Broeck, Nima Taghipour, Wannes Meert, Jesse Davis, and Luc De Raedt. Lifted probabilistic inference by first-order knowledge compilation. In IJCAI 2011, Proceedings of the 22nd International Joint Conference on Artificial Intelligence, pp. 2178–2185, 2011. ",
816
+ "bbox": [
817
+ 173,
818
+ 420,
819
+ 825,
820
+ 463
821
+ ],
822
+ "page_idx": 8
823
+ },
824
+ {
825
+ "type": "text",
826
+ "text": "Michelangelo Diligenti, Marco Gori, and Claudio Sacca. Semantic-based regularization for learning and inference. Artificial Intelligence, 244:143–165, 2017. ",
827
+ "bbox": [
828
+ 173,
829
+ 472,
830
+ 823,
831
+ 501
832
+ ],
833
+ "page_idx": 8
834
+ },
835
+ {
836
+ "type": "text",
837
+ "text": "Anna Gaulton, Anne Hersey, Michał Nowotka, A Patr´ıcia Bento, Jon Chambers, David Mendez, Prudence Mutowo, Francis Atkinson, Louisa J Bellis, Elena Cibrian-Uhalte, et al. The chembl ´ database in 2017. Nucleic acids research, 45(D1):D945–D954, 2016. ",
838
+ "bbox": [
839
+ 174,
840
+ 510,
841
+ 825,
842
+ 554
843
+ ],
844
+ "page_idx": 8
845
+ },
846
+ {
847
+ "type": "text",
848
+ "text": "Vibhav Gogate and Pedro M. Domingos. Probabilistic theorem proving. In UAI 2011, Proceedings of the Twenty-Seventh Conference on Uncertainty in Artificial Intelligence, pp. 256–265, 2011. ",
849
+ "bbox": [
850
+ 173,
851
+ 561,
852
+ 823,
853
+ 592
854
+ ],
855
+ "page_idx": 8
856
+ },
857
+ {
858
+ "type": "text",
859
+ "text": "Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural computation, 14(8):1771–1800, 2002. ",
860
+ "bbox": [
861
+ 174,
862
+ 601,
863
+ 825,
864
+ 628
865
+ ],
866
+ "page_idx": 8
867
+ },
868
+ {
869
+ "type": "text",
870
+ "text": "Stanley Kok and Pedro Domingos. Statistical predicate invention. In Proceedings of the 24th international conference on Machine learning, pp. 433–440. ACM, 2007. ",
871
+ "bbox": [
872
+ 171,
873
+ 638,
874
+ 823,
875
+ 667
876
+ ],
877
+ "page_idx": 8
878
+ },
879
+ {
880
+ "type": "text",
881
+ "text": "Ondˇrej Kuzelka and Jesse Davis. Markov logic networks for knowledge base completion: A theo- ˇ retical analysis under the MCAR assumption. In Proceedings of the Thirty-Fifth Conference on Uncertainty in Artificial Intelligence, UAI 2019, 2019. ",
882
+ "bbox": [
883
+ 176,
884
+ 676,
885
+ 823,
886
+ 719
887
+ ],
888
+ "page_idx": 8
889
+ },
890
+ {
891
+ "type": "text",
892
+ "text": "Ondˇrej Kuzelka, Yuyi Wang, Jesse Davis, and Steven Schockaert. Relational marginal problems: ˇ Theory and estimation. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018. ",
893
+ "bbox": [
894
+ 171,
895
+ 728,
896
+ 823,
897
+ 758
898
+ ],
899
+ "page_idx": 8
900
+ },
901
+ {
902
+ "type": "text",
903
+ "text": "Yujia Li, Oriol Vinyals, Chris Dyer, Razvan Pascanu, and Peter Battaglia. Learning deep generative models of graphs. arXiv preprint arXiv:1803.03324, 2018. ",
904
+ "bbox": [
905
+ 171,
906
+ 767,
907
+ 823,
908
+ 796
909
+ ],
910
+ "page_idx": 8
911
+ },
912
+ {
913
+ "type": "text",
914
+ "text": "Marco Lippi and Paolo Frasconi. Prediction of protein $\\beta$ -residue contacts by markov logic networks with grounding-specific weights. Bioinformatics, 25(18):2326–2333, 2009. ",
915
+ "bbox": [
916
+ 169,
917
+ 805,
918
+ 823,
919
+ 834
920
+ ],
921
+ "page_idx": 8
922
+ },
923
+ {
924
+ "type": "text",
925
+ "text": "Robin Manhaeve, Sebastijan Dumancic, Angelika Kimmig, Thomas Demeester, and Luc De Raedt. Deepproblog: Neural probabilistic logic programming. In Advances in Neural Information Processing Systems, pp. 3749–3759, 2018. ",
926
+ "bbox": [
927
+ 174,
928
+ 843,
929
+ 823,
930
+ 886
931
+ ],
932
+ "page_idx": 8
933
+ },
934
+ {
935
+ "type": "text",
936
+ "text": "Giuseppe Marra, Francesco Giannini, Michelangelo Diligenti, and Marco Gori. Lyrics: a general interface layer to integrate ai and deep learning. arXiv preprint arXiv:1903.07534, 2019. ",
937
+ "bbox": [
938
+ 174,
939
+ 895,
940
+ 821,
941
+ 924
942
+ ],
943
+ "page_idx": 8
944
+ },
945
+ {
946
+ "type": "text",
947
+ "text": "Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013. ",
948
+ "bbox": [
949
+ 176,
950
+ 103,
951
+ 820,
952
+ 146
953
+ ],
954
+ "page_idx": 9
955
+ },
956
+ {
957
+ "type": "text",
958
+ "text": "Andriy Mnih and Koray Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In Advances in neural information processing systems, pp. 2265–2273, 2013. ",
959
+ "bbox": [
960
+ 173,
961
+ 155,
962
+ 823,
963
+ 184
964
+ ],
965
+ "page_idx": 9
966
+ },
967
+ {
968
+ "type": "text",
969
+ "text": "Hoifung Poon and Pedro Domingos. Sound and efficient inference with probabilistic and deterministic dependencies. In AAAI, volume 6, pp. 458–463, 2006. ",
970
+ "bbox": [
971
+ 173,
972
+ 193,
973
+ 823,
974
+ 222
975
+ ],
976
+ "page_idx": 9
977
+ },
978
+ {
979
+ "type": "text",
980
+ "text": "Matthew Richardson and Pedro Domingos. Markov logic networks. Machine learning, 62(1-2): 107–136, 2006. ",
981
+ "bbox": [
982
+ 173,
983
+ 231,
984
+ 823,
985
+ 258
986
+ ],
987
+ "page_idx": 9
988
+ },
989
+ {
990
+ "type": "text",
991
+ "text": "Christian Robert and George Casella. Monte Carlo statistical methods. Springer Science & Business Media, 2013. ",
992
+ "bbox": [
993
+ 173,
994
+ 267,
995
+ 825,
996
+ 297
997
+ ],
998
+ "page_idx": 9
999
+ },
1000
+ {
1001
+ "type": "text",
1002
+ "text": "Tim Rocktaschel and Sebastian Riedel. End-to-end differentiable proving. In ¨ Advances in Neural Information Processing Systems, pp. 3788–3800, 2017. ",
1003
+ "bbox": [
1004
+ 173,
1005
+ 306,
1006
+ 823,
1007
+ 335
1008
+ ],
1009
+ "page_idx": 9
1010
+ },
1011
+ {
1012
+ "type": "text",
1013
+ "text": "Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009. ",
1014
+ "bbox": [
1015
+ 173,
1016
+ 343,
1017
+ 820,
1018
+ 372
1019
+ ],
1020
+ "page_idx": 9
1021
+ },
1022
+ {
1023
+ "type": "text",
1024
+ "text": "Luciano Serafini and Artur d’Avila Garcez. Logic tensor networks: Deep learning and logical reasoning from data and knowledge. arXiv preprint arXiv:1606.04422, 2016. ",
1025
+ "bbox": [
1026
+ 173,
1027
+ 381,
1028
+ 820,
1029
+ 410
1030
+ ],
1031
+ "page_idx": 9
1032
+ },
1033
+ {
1034
+ "type": "text",
1035
+ "text": "Gustav Sourek, Vojtech Aschenbrenner, Filip Zelezny, Steven Schockaert, and Ondrej Kuzelka. ´ Lifted relational neural networks: Efficient learning of latent relational structures. J. Artif. Intell. Res., 62:69–100, 2018. ",
1036
+ "bbox": [
1037
+ 174,
1038
+ 419,
1039
+ 821,
1040
+ 462
1041
+ ],
1042
+ "page_idx": 9
1043
+ },
1044
+ {
1045
+ "type": "text",
1046
+ "text": "Theo Trouillon, Christopher R Dance, ´ Eric Gaussier, Johannes Welbl, Sebastian Riedel, and Guil- ´ laume Bouchard. Knowledge graph completion via complex tensor factorization. The Journal of Machine Learning Research, 18(1):4735–4772, 2017. ",
1047
+ "bbox": [
1048
+ 171,
1049
+ 469,
1050
+ 823,
1051
+ 513
1052
+ ],
1053
+ "page_idx": 9
1054
+ },
1055
+ {
1056
+ "type": "text",
1057
+ "text": "Martin J Wainwright, Michael I Jordan, et al. Graphical models, exponential families, and variational inference. Foundations and Trends $\\textsuperscript { \\textregistered }$ in Machine Learning, 1(1–2):1–305, 2008. ",
1058
+ "bbox": [
1059
+ 173,
1060
+ 522,
1061
+ 821,
1062
+ 551
1063
+ ],
1064
+ "page_idx": 9
1065
+ },
1066
+ {
1067
+ "type": "text",
1068
+ "text": "Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018. ",
1069
+ "bbox": [
1070
+ 174,
1071
+ 560,
1072
+ 823,
1073
+ 589
1074
+ ],
1075
+ "page_idx": 9
1076
+ },
1077
+ {
1078
+ "type": "text",
1079
+ "text": "Jiaxuan You, Rex Ying, Xiang Ren, William L Hamilton, and Jure Leskovec. Graphrnn: Generating realistic graphs with deep auto-regressive models. arXiv preprint arXiv:1802.08773, 2018. ",
1080
+ "bbox": [
1081
+ 173,
1082
+ 598,
1083
+ 823,
1084
+ 627
1085
+ ],
1086
+ "page_idx": 9
1087
+ },
1088
+ {
1089
+ "type": "text",
1090
+ "text": "A TRANSLATING MARKOV LOGIC NETWORKS TO NEURAL MARKOV LOGIC NETWORKS ",
1091
+ "text_level": 1,
1092
+ "bbox": [
1093
+ 173,
1094
+ 102,
1095
+ 823,
1096
+ 135
1097
+ ],
1098
+ "page_idx": 10
1099
+ },
1100
+ {
1101
+ "type": "text",
1102
+ "text": "Markov logic networks are a popular statistical relational framework. It turns out that every Markov logic network can be represented as a Neural Markov Logic Network with a single carefully selected potential function. We give details of the translation between these two frameworks below. Essentially what we need to show is that Model B from (Kuzelka et al., 2018) can be translated to Model ˇ A from that same work, which is close enough to Neural Markov Logic Networks and so we can then easily encode the result to a Neural Markov Logic Network. ",
1103
+ "bbox": [
1104
+ 173,
1105
+ 151,
1106
+ 825,
1107
+ 236
1108
+ ],
1109
+ "page_idx": 10
1110
+ },
1111
+ {
1112
+ "type": "text",
1113
+ "text": "Kuzelka et al. (2018) studies two maximum-entropy models, Model A, which is close to the ˇ model that we study in this paper, and Model B, which is the same as Markov logic networks. Syntactically, both models are encoded as sets of weighted first order logic formulas, e.g. $\\Phi =$ $\\{ ( \\alpha _ { 1 } , w _ { 1 } ) , \\dotsc , ( \\alpha _ { M } , w _ { m } ) \\}$ . In particular, given a positive integer $k$ , Model A defines the following distribution: ",
1114
+ "bbox": [
1115
+ 174,
1116
+ 241,
1117
+ 825,
1118
+ 310
1119
+ ],
1120
+ "page_idx": 10
1121
+ },
1122
+ {
1123
+ "type": "equation",
1124
+ "img_path": "images/c05a25f93ff73b05d90654a3acb323ded992ed4bc0d40e2457ae8b28e3b791e1.jpg",
1125
+ "text": "$$\np _ { A } ( \\omega ) = \\frac { 1 } { Z } \\exp \\left( \\sum _ { ( \\alpha , w ) \\in \\Phi _ { A } } w \\cdot \\# _ { k } ( \\alpha , \\omega ) \\right)\n$$",
1126
+ "text_format": "latex",
1127
+ "bbox": [
1128
+ 352,
1129
+ 306,
1130
+ 643,
1131
+ 357
1132
+ ],
1133
+ "page_idx": 10
1134
+ },
1135
+ {
1136
+ "type": "text",
1137
+ "text": "where $Z$ is the normalization constant and $\\# ( \\alpha , \\omega )$ is the fraction of size- $k$ subsets $s$ of constants in the possible world $\\omega$ for which $\\omega \\langle S \\rangle \\models \\alpha$ (i.e. the formula $\\alpha$ is classically true in the fragment of $\\omega$ induced by $s$ ). Let us first define ",
1138
+ "bbox": [
1139
+ 174,
1140
+ 359,
1141
+ 825,
1142
+ 402
1143
+ ],
1144
+ "page_idx": 10
1145
+ },
1146
+ {
1147
+ "type": "equation",
1148
+ "img_path": "images/8365adadacc9dac06cfbca38a608c97b3f2c77c03a14ff4b47290c2238560831.jpg",
1149
+ "text": "$$\n\\phi _ { \\alpha , w } ( \\gamma ) = { \\left\\{ \\begin{array} { l l } { w } & { \\gamma \\Vdash \\alpha } \\\\ { 0 } & { \\gamma \\Vdash \\alpha } \\end{array} \\right. }\n$$",
1150
+ "text_format": "latex",
1151
+ "bbox": [
1152
+ 415,
1153
+ 410,
1154
+ 583,
1155
+ 446
1156
+ ],
1157
+ "page_idx": 10
1158
+ },
1159
+ {
1160
+ "type": "text",
1161
+ "text": "It is then easy to see that the distribution $p _ { A } ( \\omega )$ can also easily be encoded as a Neural Markov Logic Network by selecting the potential function $\\begin{array} { r } { \\dot { \\phi ( \\gamma ) } = \\sum _ { ( \\alpha , w ) \\in \\Phi _ { A } } \\phi _ { \\alpha , w } ( \\gamma ) } \\end{array}$ and by carefully selecting the weights $\\beta _ { i }$ in the Neural Markov Logic Network. ",
1162
+ "bbox": [
1163
+ 174,
1164
+ 454,
1165
+ 826,
1166
+ 500
1167
+ ],
1168
+ "page_idx": 10
1169
+ },
1170
+ {
1171
+ "type": "text",
1172
+ "text": "Next we show that all distributions in Model $\\mathbf { B }$ can be translated to distributions in Model A. First we will assume that the formulas $\\alpha _ { i }$ do not contain any constants. ",
1173
+ "bbox": [
1174
+ 173,
1175
+ 505,
1176
+ 823,
1177
+ 535
1178
+ ],
1179
+ "page_idx": 10
1180
+ },
1181
+ {
1182
+ "type": "text",
1183
+ "text": "Model B is given by ",
1184
+ "bbox": [
1185
+ 174,
1186
+ 540,
1187
+ 308,
1188
+ 555
1189
+ ],
1190
+ "page_idx": 10
1191
+ },
1192
+ {
1193
+ "type": "equation",
1194
+ "img_path": "images/6d3ab25685dd86c95b27cb979436f5bab6509dd6d83725f2573fe2d347498f22.jpg",
1195
+ "text": "$$\np _ { B } ( \\omega ) = \\frac { 1 } { Z } \\exp \\left( \\sum _ { ( \\beta , v ) \\in \\Phi _ { B } } v \\cdot n ( \\beta , \\omega ) \\right)\n$$",
1196
+ "text_format": "latex",
1197
+ "bbox": [
1198
+ 361,
1199
+ 553,
1200
+ 635,
1201
+ 603
1202
+ ],
1203
+ "page_idx": 10
1204
+ },
1205
+ {
1206
+ "type": "text",
1207
+ "text": "where $n ( \\beta , \\omega )$ is the number3 of true injective groundings of the formula $\\beta$ in the possible world $\\omega$ . Hence, Model B is exactly the same as Markov logic networks up to the requirement on injectivity of the groundings. However, as shown in (Buchman & Poole, 2015), any Markov logic network can be translated into such modified Markov logic network with the injectivity requirement on the groundings. ",
1208
+ "bbox": [
1209
+ 173,
1210
+ 606,
1211
+ 825,
1212
+ 679
1213
+ ],
1214
+ "page_idx": 10
1215
+ },
1216
+ {
1217
+ "type": "text",
1218
+ "text": "Let $k$ be an integer greater or equal to the number of variables in any formula in $\\Phi _ { B }$ . Now, let $\\Gamma$ be the set of all size- $k$ fragments. For every formula $\\beta$ in $\\Phi _ { B }$ , we introduce a partition $\\mathcal { P }$ on $\\Gamma$ induced by the equivalence relation $\\sim _ { \\beta }$ defined by: $\\gamma \\sim _ { \\beta } \\gamma ^ { \\prime }$ iff $n ( \\beta , \\gamma ) = n ( \\beta , \\gamma ^ { \\prime } )$ . Since $\\beta$ is assumed to not contain any constants, we can capture each of these equivalence classes $C$ by a (possibly quite big) first-order logic sentence without constants $\\beta _ { C }$ . Let $C _ { i }$ be the equivalence class that contains fragments $\\gamma$ such that $n ( \\beta , \\gamma ) = i$ . Let $\\begin{array} { r } { m ( \\beta , \\omega ) = \\sum _ { C _ { i } \\in \\mathcal { P } } \\sum _ { \\gamma \\in \\Gamma _ { k } ( \\omega ) } \\cdot \\mathbb { 1 } ( \\gamma \\vdash \\beta _ { C } ) } \\end{array}$ . By construction, it holds $\\begin{array} { r } { m ( \\beta , \\omega ) = \\sum _ { \\gamma \\in \\Gamma _ { k } ( \\omega ) } n ( \\beta , \\gamma ) } \\end{array}$ . Every true injective grounding of the formula $\\beta$ , having $l$ variables, is contained in $\\binom { n - l } { k - l }$ different size- $k$ fragments of $\\omega$ , each of which gives rise to $k !$ anonymized fragments in the multi-set $\\Gamma _ { k } ( \\omega )$ . So $m ( \\beta , \\omega )$ is over-counting the number of true groundings $n ( \\beta , \\bar { \\omega } )$ by a constant factor. It follows that, by carefully selecting the weights of the formulas $\\beta _ { C }$ we can encode the distribution $p _ { B } ( \\omega )$ also in Model A. Although this particular transformation that we have just sketched is not very efficient, it does show that Neural ",
1219
+ "bbox": [
1220
+ 173,
1221
+ 684,
1222
+ 826,
1223
+ 862
1224
+ ],
1225
+ "page_idx": 10
1226
+ },
1227
+ {
1228
+ "type": "text",
1229
+ "text": "Markov Logic Networks with potential functions of width $k$ can express all distributions that can be expressed by Markov logic networks containing formulas with at most $k$ variables. ",
1230
+ "bbox": [
1231
+ 171,
1232
+ 103,
1233
+ 823,
1234
+ 132
1235
+ ],
1236
+ "page_idx": 11
1237
+ },
1238
+ {
1239
+ "type": "text",
1240
+ "text": "First-order logic formulas defining Markov logic networks may also contain constants. In Neural Markov Logic Networks we may represent constants using vector-space embeddings as described in the main text. One can then easily extend the argument sketched above to the case covering Markov logic networks with constants. ",
1241
+ "bbox": [
1242
+ 174,
1243
+ 138,
1244
+ 823,
1245
+ 194
1246
+ ],
1247
+ "page_idx": 11
1248
+ },
1249
+ {
1250
+ "type": "text",
1251
+ "text": "B ALGORITHMS ",
1252
+ "text_level": 1,
1253
+ "bbox": [
1254
+ 176,
1255
+ 217,
1256
+ 325,
1257
+ 233
1258
+ ],
1259
+ "page_idx": 11
1260
+ },
1261
+ {
1262
+ "type": "text",
1263
+ "text": "In the following, we will show a learning algorithm for NMLNs that relies on approximated Gibbs sampling. ",
1264
+ "bbox": [
1265
+ 174,
1266
+ 248,
1267
+ 823,
1268
+ 279
1269
+ ],
1270
+ "page_idx": 11
1271
+ },
1272
+ {
1273
+ "type": "text",
1274
+ "text": "The general learning algorithm for NMLN is described in Algorithm 1. ",
1275
+ "bbox": [
1276
+ 174,
1277
+ 284,
1278
+ 638,
1279
+ 299
1280
+ ],
1281
+ "page_idx": 11
1282
+ },
1283
+ {
1284
+ "type": "table",
1285
+ "img_path": "images/52e6f1f6aa38823d73ad3dd9a2dc5d0a80ce14cabd399a06bad9d30f4fdfe4b7.jpg",
1286
+ "table_caption": [],
1287
+ "table_footnote": [],
1288
+ "table_body": "<table><tr><td colspan=\"2\">Algorithm1 NMLN general learning algorithm</td></tr><tr><td colspan=\"2\">Input: @: the given training world</td></tr><tr><td colspan=\"2\">1: procedure LEARN(@)</td></tr><tr><td>2:</td><td>n: learning rate</td></tr><tr><td>3:</td><td>@:M randomly initialized Markov chain states</td></tr><tr><td>4:</td><td>while stopping criterion do</td></tr><tr><td>5:</td><td>while chains convergence criterion do</td></tr><tr><td>6:</td><td>ω ← SAMPLE-STEP(@,M,βi,Wi)</td></tr><tr><td>7:</td><td>0l0g(Pa)←β i(@;wi) -£ (@;wi) wi wi Wi</td></tr><tr><td>8:</td><td>alog(Pa) (重i(@;wi)-∑重i(w;wi)) 8β</td></tr><tr><td>9:</td><td>0log(Pa) Wi←Wi+n wi</td></tr><tr><td>10:</td><td>β←βi+n² alog(Po) 8β</td></tr></table>",
1289
+ "bbox": [
1290
+ 178,
1291
+ 315,
1292
+ 821,
1293
+ 541
1294
+ ],
1295
+ "page_idx": 11
1296
+ },
1297
+ {
1298
+ "type": "text",
1299
+ "text": "A possible sampling procedure, implementing the generic SAMPLE-STEP and exploiting Gibbs Sampling, is described in Algorithm 2 ",
1300
+ "bbox": [
1301
+ 174,
1302
+ 568,
1303
+ 823,
1304
+ 597
1305
+ ],
1306
+ "page_idx": 11
1307
+ },
1308
+ {
1309
+ "type": "table",
1310
+ "img_path": "images/9fb8faafbb48d2d455001833fcb530e81ea58a9d71c1dedd40595faf8a464984.jpg",
1311
+ "table_caption": [],
1312
+ "table_footnote": [],
1313
+ "table_body": "<table><tr><td>Algorithm2 Sampling Procedure</td></tr><tr><td>Input:@: the current states of the chains</td></tr><tr><td>Input: M: the number of chains</td></tr><tr><td>Input:βi, Wi: current parameters</td></tr><tr><td>1:procedure SAMPLE-STEP(@,M,βi,Wi)</td></tr><tr><td>2: s ←1# sample index</td></tr><tr><td>3: i ←1# ground atom index</td></tr><tr><td>4: n number of ground atoms in w</td></tr><tr><td>5: while s≤Mdo</td></tr><tr><td>6: W=ωs # s-th chain</td></tr><tr><td>7: whilei≤ndo</td></tr><tr><td>8: p←Pwi=1lωj\\i</td></tr><tr><td>9: r ∈[0,1] from a uniform distribution</td></tr><tr><td>10: if r&lt;p then</td></tr><tr><td>11: ε↑εi=1</td></tr><tr><td>12: else</td></tr><tr><td>13: ε↑εi=0</td></tr><tr><td>14: i←i+1</td></tr><tr><td>15: Ws=w</td></tr><tr><td>16: s↑s+1</td></tr><tr><td>17: return ω</td></tr></table>",
1314
+ "bbox": [
1315
+ 174,
1316
+ 612,
1317
+ 825,
1318
+ 921
1319
+ ],
1320
+ "page_idx": 11
1321
+ },
1322
+ {
1323
+ "type": "image",
1324
+ "img_path": "images/5c7cd4d3bba2686e7581b3c586e3a27bf10bdc2c80d62676a8f28c73c2f66ee8.jpg",
1325
+ "image_caption": [
1326
+ "Figure 5: An example of molecule "
1327
+ ],
1328
+ "image_footnote": [],
1329
+ "bbox": [
1330
+ 421,
1331
+ 75,
1332
+ 575,
1333
+ 229
1334
+ ],
1335
+ "page_idx": 12
1336
+ },
1337
+ {
1338
+ "type": "text",
1339
+ "text": "C GENERATING MOLECULES ",
1340
+ "text_level": 1,
1341
+ "bbox": [
1342
+ 176,
1343
+ 305,
1344
+ 431,
1345
+ 321
1346
+ ],
1347
+ "page_idx": 12
1348
+ },
1349
+ {
1350
+ "type": "text",
1351
+ "text": "Even though molecules can be described with a high level of precision, using both spatial features (i.e. atoms distances, bond length etc.) and chemical features (i.e. atom charge, atom mass, hybridization), in this work, we focused mainly on structural symbolic descriptions of molecules. ",
1352
+ "bbox": [
1353
+ 174,
1354
+ 337,
1355
+ 825,
1356
+ 380
1357
+ ],
1358
+ "page_idx": 12
1359
+ },
1360
+ {
1361
+ "type": "text",
1362
+ "text": "In particular, we described a molecule using two sets of FOL predicates: ",
1363
+ "bbox": [
1364
+ 174,
1365
+ 386,
1366
+ 647,
1367
+ 401
1368
+ ],
1369
+ "page_idx": 12
1370
+ },
1371
+ {
1372
+ "type": "text",
1373
+ "text": "• Atom-type unary predicates: these are C, N, O, S, Cl, F, P. \n• Bond-type binary predicate: these are SINGLE and DOUBLE. ",
1374
+ "bbox": [
1375
+ 215,
1376
+ 412,
1377
+ 635,
1378
+ 446
1379
+ ],
1380
+ "page_idx": 12
1381
+ },
1382
+ {
1383
+ "type": "text",
1384
+ "text": "An example of a molecule FOL description can be: ",
1385
+ "bbox": [
1386
+ 174,
1387
+ 458,
1388
+ 509,
1389
+ 473
1390
+ ],
1391
+ "page_idx": 12
1392
+ },
1393
+ {
1394
+ "type": "text",
1395
+ "text": "O(0), C(1), C(2), C(3), N(4), C(5), C(6), C(7), O(8), O(9) SINGLE(0,1), SINGLE(1,0), SINGLE(1,2), SINGLE(2,1), SINGLE(2,3) SINGLE(3,2), SINGLE(3,4), SINGLE(4,3), SINGLE(4,5), SINGLE(5,4) SINGLE(5,6), SINGLE(6,5), SINGLE(5,7), SINGLE(7,5), DOUBLE(7,8) DOUBLE(8,7), SINGLE(7,9), SINGLE(9,7), SINGLE(6,1), SINGLE(1,6) ",
1396
+ "bbox": [
1397
+ 174,
1398
+ 484,
1399
+ 790,
1400
+ 555
1401
+ ],
1402
+ "page_idx": 12
1403
+ }
1404
+ ]
parse/train/SkeGvaEtPr/SkeGvaEtPr_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/SkeGvaEtPr/SkeGvaEtPr_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/YWtLZvLmud7/YWtLZvLmud7.md ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BERTOLOGY MEETS BIOLOGY: INTERPRETING ATTENTION IN PROTEIN LANGUAGE MODELS
2
+
3
+ Jesse Vig1 Ali Madani1 Lav R. Varshney1,2 Caiming Xiong1
4
+ Richard Socher1 Nazneen Fatema Rajani1
5
+ 1Salesforce Research, 2University of Illinois at Urbana-Champaign
6
+ {jvig,amadani,cxiong,rsocher,nazneen.rajani}@salesforce.com
7
+ varshney@illinois.edu
8
+
9
+ # ABSTRACT
10
+
11
+ Transformer architectures have proven to learn useful representations for protein classification and generation tasks. However, these representations present challenges in interpretability. In this work, we demonstrate a set of methods for analyzing protein Transformer models through the lens of attention. We show that attention: (1) captures the folding structure of proteins, connecting amino acids that are far apart in the underlying sequence, but spatially close in the three-dimensional structure, (2) targets binding sites, a key functional component of proteins, and (3) focuses on progressively more complex biophysical properties with increasing layer depth. We find this behavior to be consistent across three Transformer architectures (BERT, ALBERT, XLNet) and two distinct protein datasets. We also present a three-dimensional visualization of the interaction between attention and protein structure. Code for visualization and analysis is available at https://github.com/salesforce/provis.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ The study of proteins, the fundamental macromolecules governing biology and life itself, has led to remarkable advances in understanding human health and the development of disease therapies. The decreasing cost of sequencing technology has enabled vast databases of naturally occurring proteins (El-Gebali et al., 2019a), which are rich in information for developing powerful machine learning models of protein sequences. For example, sequence models leveraging principles of co-evolution, whether modeling pairwise or higher-order interactions, have enabled prediction of structure or function (Rollins et al., 2019).
16
+
17
+ Proteins, as a sequence of amino acids, can be viewed precisely as a language and therefore modeled using neural architectures developed for natural language. In particular, the Transformer (Vaswani et al., 2017), which has revolutionized unsupervised learning for text, shows promise for similar impact on protein sequence modeling. However, the strong performance of the Transformer comes at the cost of interpretability, and this lack of transparency can hide underlying problems such as model bias and spurious correlations (Niven & Kao, 2019; Tan & Celis, 2019; Kurita et al., 2019). In response, much NLP research now focuses on interpreting the Transformer, e.g., the subspecialty of “BERTology” (Rogers et al., 2020), which specifically studies the BERT model (Devlin et al., 2019).
18
+
19
+ In this work, we adapt and extend this line of interpretability research to protein sequences. We analyze Transformer protein models through the lens of attention, and present a set of interpretability methods that capture the unique functional and structural characteristics of proteins. We also compare the knowledge encoded in attention weights to that captured by hidden-state representations. Finally, we present a visualization of attention contextualized within three-dimensional protein structure.
20
+
21
+ Our analysis reveals that attention captures high-level structural properties of proteins, connecting amino acids that are spatially close in three-dimensional structure, but apart in the underlying sequence (Figure 1a). We also find that attention targets binding sites, a key functional component of proteins (Figure 1b). Further, we show how attention is consistent with a classic measure of similarity between amino acids—the substitution matrix. Finally, we demonstrate that attention captures progressively higher-level representations of structure and function with increasing layer depth.
22
+
23
+ ![](images/76c14d8398a7b9f1fe2596951d718e93df55a3d10bc8fddfd5f328089af1f8ba.jpg)
24
+
25
+ (a) Attention in head 12-4, which targets amino acid pairs that are close in physical space (see inset subsequence 117D-157I) but lie apart in the sequence. Example is a de novo designed TIMbarrel (5BVL) with characteristic symmetry.
26
+
27
+ ![](images/970466158182c095666d593fa922bd5a5dc7a329a456f71ebead3ee2b25f03a8.jpg)
28
+ (b) Attention in head 7-1, which targets binding sites, a key functional component of proteins. Example is HIV-1 protease (7HVP). The primary location receiving attention is 27G, a binding site for protease inhibitor small-molecule drugs.
29
+
30
+ Figure 1: Examples of how specialized attention heads in a Transformer recover protein structure and function, based solely on language model pre-training. Orange lines depict attention between amino acids (line width proportional to attention weight; values below 0.1 hidden). Heads were selected based on correlation with ground-truth annotations of contact maps and binding sites. Visualizations based on the NGL Viewer (Rose et al., 2018; Rose & Hildebrand, 2015; Nguyen et al., 2017).
31
+
32
+ In contrast to NLP, which aims to automate a capability that humans already have—understanding natural language—protein modeling also seeks to shed light on biological processes that are not fully understood. Thus we also discuss how interpretability can aid scientific discovery.
33
+
34
+ # 2 BACKGROUND: PROTEINS
35
+
36
+ In this section we provide background on the biological concepts discussed in later sections.
37
+
38
+ Amino acids. Just as language is composed of words from a shared lexicon, every protein sequence is formed from a vocabulary of amino acids, of which 20 are commonly observed. Amino acids may be denoted by their full name (e.g., Proline), a 3-letter abbreviation $( P r o )$ , or a single-letter code $( P )$
39
+
40
+ Substitution matrix. While word synonyms are encoded in a thesaurus, proteins that are similar in structure or function are captured in a substitution matrix, which scores pairs of amino acids on how readily they may be substituted for one another while maintaining protein viability. One common substitution matrix is BLOSUM (Henikoff & Henikoff, 1992), which is derived from co-occurrence statistics of amino acids in aligned protein sequences.
41
+
42
+ Protein structure. Though a protein may be abstracted as a sequence of amino acids, it represents a physical entity with a well-defined three-dimensional structure (Figure 1). Secondary structure describes the local segments of proteins; two commonly observed types are the alpha helix and beta sheet. Tertiary structure encompasses the large-scale formations that determine the overall shape and function of the protein. One way to characterize tertiary structure is by a contact map, which describes the pairs of amino acids that are in contact (within 8 angstroms of one another) in the folded protein structure but lie apart (by at least 6 positions) in the underlying sequence (Rao et al., 2019).
43
+
44
+ Binding sites. Proteins may also be characterized by their functional properties. Binding sites are protein regions that bind with other molecules (proteins, natural ligands, and small-molecule drugs) to carry out a specific function. For example, the HIV-1 protease is an enzyme responsible for a critical process in replication of HIV (Brik & Wong, 2003). It has a binding site, shown in Figure 1b, that is a target for drug development to ensure inhibition.
45
+
46
+ Post-translational modifications. After a protein is translated from RNA, it may undergo additional modifications, e.g. phosphorylation, which play a key role in protein structure and function.
47
+
48
+ # 3 METHODOLOGY
49
+
50
+ Model. We demonstrate our interpretability methods on five Transformer models that were pretrained through language modeling of amino acid sequences. We primarily focus on the BERT-Base model from TAPE (Rao et al., 2019), which was pretrained on Pfam, a dataset of 31M protein sequences (ElGebali et al., 2019b). We refer to this model as TapeBert. We also analyze 4 pre-trained Transformer models from ProtTrans (Elnaggar et al., 2020): ProtBert and ProtBert-BFD, which are 30-layer, 16-head BERT models; ProtAlbert, a 12-layer, 64-head ALBERT (Lan et al., 2020) model; and ProtXLNet, a 30-layer, 16-head XLNet (Yang et al., 2019) model. ProtBert-BFD was pretrained on BFD (Steinegger & Söding, 2018), a dataset of 2.1B protein sequences, while the other ProtTrans models were pretrained on UniRef100 (Suzek et al., 2014), which includes 216M protein sequences. A summary of these 5 models is presented in Appendix A.1.
51
+
52
+ Here we present an overview of BERT, with additional details on all models in Appendix A.2. BERT inputs a sequence of amino acids $\pmb { x } = ( x _ { 1 } , \dots , x _ { n } )$ and applies a series of encoders. Each encoder layer $\ell$ outputs a sequence of continuous embeddings $( \mathbf { h } _ { 1 } ^ { ( \ell ) } , \ldots , \mathbf { h } _ { n } ^ { ( \ell ) } )$ using a multi-headed attention mechanism. Each attention head in a layer produces a set of attention weights $\alpha$ for an input, where $\alpha _ { i , j } > 0$ is the attention from token $i$ to token $j$ , such that $\textstyle \sum _ { j } \alpha _ { i , j } = 1$ . Intuitively, attention weights define the influence of every token on the next layer’s representation for the current token. We denote a particular head by <layer>-<head_index>, e.g. head 3-7 for the 3rd layer’s 7th head.
53
+
54
+ Attention analysis. We analyze how attention aligns with various protein properties. For properties of token pairs, e.g. contact maps, we define an indicator function $f ( i , j )$ that returns 1 if the property is present in token pair $( i , j )$ (e.g., if amino acids $i$ and $j$ are in contact), and 0 otherwise. We then compute the proportion of high-attention token pairs $( \alpha _ { i , j } > \theta$ ) where the property is present, aggregated over a dataset $\boldsymbol { X }$ :
55
+
56
+ $$
57
+ p _ { \alpha } ( f ) = \sum _ { \mathbf { x } \in \mathbf { X } } \sum _ { i = 1 } ^ { | \mathbf { x } | } \sum _ { j = 1 } ^ { | \mathbf { x } | } f ( i , j ) \cdot \mathbb { 1 } _ { \alpha _ { i , j } > \theta } \Bigg / \sum _ { \mathbf { x } \in \mathbf { X } } \sum _ { i = 1 } ^ { | \mathbf { x } | } \sum _ { j = 1 } ^ { | \mathbf { x } | } \mathbb { 1 } _ { \alpha _ { i , j } > \theta }
58
+ $$
59
+
60
+ where $\theta$ is a threshold to select for high-confidence attention weights. We also present an alternative, continuous version of this metric in Appendix B.1.
61
+
62
+ For properties of individual tokens, e.g. binding sites, we define $f ( i , j )$ to return 1 if the property is present in token $j$ (e.g. if $j$ is a binding site). In this case, $p _ { \alpha } ( f )$ equals the proportion of attention that is directed to the property (e.g. the proportion of attention focused on binding sites).
63
+
64
+ When applying these metrics, we include two types of checks to ensure that the results are not due to chance. First, we test that the proportion of attention that aligns with particular properties is significantly higher than the background frequency of these properties, taking into account the Bonferroni correction for multiple hypotheses corresponding to multiple attention heads. Second, we compare the results to a null model, which is an instance of the model with randomly shuffled attention weights. We describe these methods in detail in Appendix B.2.
65
+
66
+ Probing tasks. We also perform probing tasks on the model, which test the knowledge contained in model representations by using them as inputs to a classifier that predicts a property of interest (Veldhoen et al., 2016; Conneau et al., 2018; Adi et al., 2016). The performance of the probing classifier serves as a measure of the knowledge of the property that is encoded in the representation. We run both embedding probes, which assess the knowledge encoded in the output embeddings of each layer, and attention probes (Reif et al., 2019; Clark et al., 2019), which measure the knowledge contained in the attention weights for pairwise features. Details are provided in Appendix B.3.
67
+
68
+ Datasets. For our analyses of amino acids and contact maps, we use a curated dataset from TAPE based on ProteinNet (AlQuraishi, 2019; Fox et al., 2013; Berman et al., 2000; Moult et al., 2018), which contains amino acid sequences annotated with spatial coordinates (used for the contact map analysis). For the analysis of secondary structure and binding sites we use the Secondary Structure dataset (Rao et al., 2019; Berman et al., 2000; Moult et al., 2018; Klausen et al., 2019) from TAPE. We employed a taxonomy of secondary structure with three categories: Helix, Strand, and Turn/Bend, with the last two belonging to the higher-level beta sheet category (Sec. 2). We used this taxonomy to study how the model understood structurally distinct regions of beta sheets. We obtained token-level binding site and protein modification labels from the Protein Data Bank (Berman et al., 2000). For analyzing attention, we used a random subset of 5000 sequences from the training split of the respective datasets (note that none of the aforementioned annotations were used in model training). For the diagnostic classifier, we used the respective training splits for training and the validation splits for evaluation. See Appendix B.4 for additional details.
69
+
70
+ ![](images/bf824e1bb0f918d84f0f9de1448fbd6db9a1f8c1de1134225d81434f41c5a38f.jpg)
71
+ Figure 2: Agreement between attention and contact maps across five pretrained Transformer models from TAPE (a) and ProtTrans (b–e). The heatmaps show the proportion of high-confidence attention weights $( \alpha _ { i , j } > \theta )$ from each head that connects pairs of amino acids that are in contact with one another. In TapeBert (a), for example, we can see that $45 \%$ of attention in head 12-4 (the 12th layer’s 4th head) maps to contacts. The bar plots show the maximum value from each layer. Note that the vertical striping in ProtAlbert (b) is likely due to cross-layer parameter sharing (see Appendix A.3).
72
+
73
+ Experimental details We exclude attention to the [SEP] delimiter token, as it has been shown to be a “no-op” attention token (Clark et al., 2019), as well as attention to the [CLS] token, which is not explicitly used in language modeling. We only include results for attention heads where at least 100 high-confidence attention arcs are available for analysis. We set the attention threshold $\theta$ to 0.3 to select for high-confidence attention while retaining sufficient data for analysis. We truncate all protein sequences to a length of 512 to reduce memory requirements.1
74
+
75
+ We note that all of the above analyses are purely associative and do not attempt to establish a causal link between attention and model behavior (Vig et al., 2020; Grimsley et al., 2020), nor to explain model predictions (Jain & Wallace, 2019; Wiegreffe & Pinter, 2019).
76
+
77
+ # 4 WHAT DOES ATTENTION UNDERSTAND ABOUT PROTEINS?
78
+
79
+ # 4.1 PROTEIN STRUCTURE
80
+
81
+ Here we explore the relationship between attention and tertiary structure, as characterized by contact maps (see Section 2). Secondary structure results are included in Appendix C.1.
82
+
83
+ Attention aligns strongly with contact maps in the deepest layers. Figure 2 shows how attention aligns with contact maps across the heads of the five models evaluated2, based on the metric defined in Equation 1. The most aligned heads are found in the deepest layers and focus up to $4 4 . 7 \%$ (TapeBert), $5 5 . 7 \%$ (ProtAlbert), $5 8 . 5 \%$ (ProtBert), $6 3 . 2 \%$ (ProtBert-BFD), and $4 4 . 5 \%$ (ProtXLNet) of attention on contacts, whereas the background frequency of contacts among all amino acid pairs in the dataset is $1 . 3 \%$ . Figure 1a shows an example of the induced attention from the top head in TapeBert. We note that the model with the single most aligned head—ProtBert-BFD—is the largest model (same size as ProteinBert) at 420M parameters (Appendix A.1) and it was also the only model pre-trained on the largest dataset, BFD. It’s possible that both factors helped the model learn more structurally-aligned attention patterns. Statistical significance tests and null models are reported in Appendix C.2.
84
+
85
+ ![](images/666374f6e2c0e0372517f4f84605266288e21fca12b249819a7d67d15d508d93.jpg)
86
+ Figure 3: Proportion of attention focused on binding sites across five pretrained models. The heatmaps show the proportion of high-confidence attention $( \alpha _ { i , j } > \theta )$ from each head that is directed to binding sites. In TapeBert (a), for example, we can see that $49 \%$ of attention in head 11-6 (the 11th layer’s 6th head) is directed to binding sites. The bar plots show the maximum value from each layer.
87
+
88
+ Considering the models were trained on language modeling tasks without any spatial information, the presence of these structurally-aware attention heads is intriguing. One possible reason for this emergent behavior is that contacts are more likely to biochemically interact with one another, creating statistical dependencies between the amino acids in contact. By focusing attention on the contacts of a masked position, the language models may acquire valuable context for token prediction.
89
+
90
+ While there seems to be a strong correlation between the attention head output and classically-defined contacts, there are also differences. The models may have learned differing contextualized or nuanced formulations that describe amino acid interactions. These learned interactions could then be used for further discovery and investigation or repurposed for prediction tasks similar to how principles of coevolution enabled a powerful representation for structure prediction.
91
+
92
+ # 4.2 BINDING SITES AND POST-TRANSLATIONAL MODIFICATIONS
93
+
94
+ We also analyze how attention interacts with binding sites and post-translational modifications (PTMs), which both play a key role in protein function.
95
+
96
+ Attention targets binding sites throughout most layers of the models. Figure 3 shows the proportion of attention focused on binding sites (Eq. 1) across the heads of the 5 models studied. Attention to binding sites is most pronounced in the ProtAlbert model (Figure 3b), which has 22 heads that focus over $50 \%$ of attention on bindings sites, whereas the background frequency of binding sites in the dataset is $4 . 8 \%$ . The three BERT models (Figures 3a, 3c, and 3d) also attend strongly to binding sites, with attention heads focusing up to $4 8 . 2 \%$ , $5 0 . 7 \%$ , and $4 5 . 6 \%$ of attention on binding sites, respectively. Figure 1b visualizes the attention in one strongly-aligned head from the TapeBert model. Statistical significance tests and a comparison to a null model are provided in Appendix C.3.
97
+
98
+ ProtXLNet (Figure 3e) also targets binding sites, but not as strongly as the other models: the most aligned head focuses $1 5 . 1 \%$ of attention on binding sites, and the average head directs just $6 . 2 \%$ of attention to binding sites, compared to $1 3 . 2 \%$ , $1 9 . 8 \%$ , $1 6 . 0 \%$ , and $1 5 . 1 \%$ for the first four models in Figure 3. It’s unclear whether this disparity is due to differences in architectures or pre-training objectives; for example, ProtXLNet uses a bidirectional auto-regressive pretraining method (see Appendix A.2), whereas the other 4 models all use masked language modeling objectives.
99
+
100
+ ![](images/d4783f7e96a0924d1ea4ba70a7ffae208de117da37e556fa2ab90babcef91580.jpg)
101
+ Figure 4: Each plot shows the percentage of attention focused on the given property, averaged over all heads within each layer. The plots, sorted by center of gravity (red dashed line), show that heads in deeper layers focus relatively more attention on binding sites and contacts, whereas attention toward specific secondary structures is more even across layers.
102
+
103
+ ![](images/d08796d34db0ec66c1011288607c44f11432d3c085365220d5387129c7cd6844.jpg)
104
+ Figure 5: Performance of probing classifiers by layer, sorted by task order in Figure 4. The embedding probes (orange) quantify the knowledge of the given property that is encoded in each layer’s output embeddings. The attention probe (blue), show the amount of information encoded in attention weights for the (pairwise) contact feature. Additional details are provided in Appendix B.3.
105
+
106
+ Why does attention target binding sites? In contrast to contact maps, which reveal relationships within proteins, binding sites describe how a protein interacts with other molecules. These external interactions ultimately define the high-level function of the protein, and thus binding sites remain conserved even when the sequence as a whole evolves (Kinjo & Nakamura, 2009). Further, structural motifs in binding sites are mainly restricted to specific families or superfamilies of proteins (Kinjo & Nakamura, 2009), and binding sites can reveal evolutionary relationships among proteins (Lee et al., 2017). Thus binding sites may provide the model with a high-level characterization of the protein that is robust to individual sequence variation. By attending to these regions, the model can leverage this higher-level context when predicting masked tokens throughout the sequence.
107
+
108
+ Attention targets PTMs in a small number of heads. A small number of heads in each model concentrate their attention very strongly on amino acids associated with post-translational modifications (PTMs). For example, Head 11-6 in TapeBert focused $64 \%$ of attention on PTM positions, though these occur at only $0 . 8 \%$ of sequence positions in the dataset.3 Similar to our discussion on binding sites, PTMs are critical to protein function (Rubin & Rosen, 1975) and thereby are likely to exhibit behavior that is conserved across the sequence space. See Appendix C.4 for full results.
109
+
110
+ # 4.3 CROSS-LAYER ANALYSIS
111
+
112
+ We analyze how attention captures properties of varying complexity across different layers of TapeBert, and compare this to a probing analysis of embeddings and attention weights (see Section 3).
113
+
114
+ Attention targets higher-level properties in deeper layers. As shown in Figure 4, deeper layers focus relatively more attention on binding sites and contacts (high-level concept), whereas secondary structure (low- to mid-level concept) is targeted more evenly across layers. The probing analysis of attention (Figure 5, blue) similarly shows that knowledge of contact maps (a pairwise feature)
115
+
116
+ ![](images/ed4212796a7bfa10402aa4af93a32033f41cc3a55172b9ef0fe73ab0ffbd7ff3.jpg)
117
+ Figure 6: Percentage of each head’s attention focused on amino acids Pro (left) and Phe (right).
118
+
119
+ ![](images/370ce6922298a4a002abc1dfb3ad7e50f8b9c590a10c397dc4cb697d800897b9.jpg)
120
+
121
+ ![](images/4a3a8af33206d4c4522642e00889182aff134a80a8cb55a7e11cc93611093e62.jpg)
122
+ Figure 7: Pairwise attention similarity (left) vs. substitution matrix (right) (codes in App. C.5)
123
+
124
+ is encoded in attention weights primarily in the last 1-2 layers. These results are consistent with prior work in NLP that suggests deeper layers in text-based Transformers attend to more complex properties (Vig & Belinkov, 2019) and encode higher-level representations (Raganato & Tiedemann, 2018; Peters et al., 2018; Tenney et al., 2019; Jawahar et al., 2019).
125
+
126
+ The embedding probes (Figure 5, orange) also show that the model first builds representations of local secondary structure in lower layers before fully encoding binding sites and contact maps in deeper layers. However, this analysis also reveals stark differences in how knowledge of contact maps is accrued in embeddings, which accumulate this knowledge gradually over many layers, compared to attention weights, which acquire this knowledge only in the final layers in this case. This example points out limitations of common layerwise probing approaches that only consider embeddings, which, intuitively, represent what the model knows but not necessarily how it operationalizes that knowledge.
127
+
128
+ # 4.4 AMINO ACIDS AND THE SUBSTITUTION MATRIX
129
+
130
+ In addition to high-level structural and functional properties, we also performed a fine-grained analysis of the interaction between attention and particular amino acids.
131
+
132
+ Attention heads specialize in particular amino acids. We computed the proportion of TapeBert’s attention to each of the 20 standard amino acids, as shown in Figure 6 for two example amino acids. For 16 of the amino acids, there exists an attention head that focuses over $2 5 \%$ of attention on that amino acid, significantly greater than the background frequencies of the corresponding amino acids, which range from $1 . 3 \%$ to $9 . 4 \%$ . Similar behavior was observed for ProtBert, ProtBert-BFD, ProtAlbert, and ProtXLNet models, with 17, 15, 16, and 18 amino acids, respectively, receiving greater than $2 5 \%$ of the attention from at least one attention head. Detailed results for TapeBert including statistical significance tests and comparison to a null model are presented in Appendix C.5.
133
+
134
+ Attention is consistent with substitution relationships. A natural follow-up question from the above analysis is whether each head has “memorized” specific amino acids to target, or whether it has actually learned meaningful properties that correlate with particular amino acids. To test the latter hypothesis, we analyze whether amino acids with similar structural and functional properties are attended to similarly across heads. Specifically, we compute the Pearson correlation between the distribution of attention across heads between all pairs of distinct amino acids, as shown in Figure 7 (left) for TapeBert. For example, the entry for $P r o$ (P) and Phe (F) is the correlation between the two heatmaps in Figure 6. We compare these scores to the BLOSUM62 substitution scores (Sec. 2) in Figure 7 (right), and find a Pearson correlation of 0.73, suggesting that attention is moderately consistent with substitution relationships. Similar correlations are observed for the ProtTrans models: 0.68 (ProtBert), 0.75 (ProtBert-BFD), 0.60 (ProtAlbert), and 0.71 (ProtXLNet). As a baseline, the randomized versions of these models (Appendix B.2) yielded correlations of -0.02 (TapeBert), 0.02 (ProtBert), -0.03 (ProtBert-BFD), -0.05 (ProtAlbert), and 0.21 (ProtXLNet).
135
+
136
+ # 5 RELATED WORK
137
+
138
+ # 5.1 PROTEIN LANGUAGE MODELS
139
+
140
+ Deep neural networks for protein language modeling have received broad interest. Early work applied the Skip-gram model (Mikolov et al., 2013) to construct continuous embeddings from protein sequences (Asgari & Mofrad, 2015). Sequence-only language models have since been trained through autoregressive or autoencoding self-supervision objectives for discriminative and generative tasks, for example, using LSTMs or Transformer-based architectures (Alley et al., 2019; Bepler & Berger, 2019; Rao et al., 2019; Rives et al., 2019). TAPE created a benchmark of five tasks to assess protein sequence models, and ProtTrans also released several large-scale pretrained protein Transformer models (Elnaggar et al., 2020). Riesselman et al. (2019); Madani et al. (2020) trained autoregressive generative models to predict the functional effect of mutations and generate natural-like proteins.
141
+
142
+ From an interpretability perspective, Rives et al. (2019) showed that the output embeddings from a pretrained Transformer can recapitulate structural and functional properties of proteins through learned linear transformations. Various works have analyzed output embeddings of protein models through dimensionality reduction techniques such as PCA or t-SNE (Elnaggar et al., 2020; Biswas et al., 2020). In our work, we take an interpretability-first perspective to focus on the internal model representations, specifically attention and intermediate hidden states, across multiple protein language models. We also explore novel biological properties including binding sites and post-translational modifications.
143
+
144
+ # 5.2 INTERPRETING MODELS IN NLP
145
+
146
+ The rise of deep neural networks in ML has also led to much work on interpreting these so-called black-box models. This section reviews the NLP interpretability literature on the Transformer model, which is directly comparable to our work on interpreting Transformer models of protein sequences.
147
+
148
+ Interpreting Transformers. The Transformer is a neural architecture that uses attention to accelerate learning (Vaswani et al., 2017). In NLP, transformers are the backbone of state-of-the-art pre-trained language models such as BERT (Devlin et al., 2019). BERTology focuses on interpreting what the BERT model learns about language using a suite of probes and interventions (Rogers et al., 2020). So-called diagnostic classifiers are used to interpret the outputs from BERT’s layers (Veldhoen et al., 2016). At a high level, mechanisms for interpreting BERT can be placed into three main categories: interpreting the learned embeddings (Ethayarajh, 2019; Wiedemann et al., 2019; Mickus et al., 2020; Adi et al., 2016; Conneau et al., 2018), BERT’s learned knowledge of syntax (Lin et al., 2019; Liu et al., 2019; Tenney et al., 2019; Htut et al., 2019; Hewitt & Manning, 2019; Goldberg, 2019), and BERT’s learned knowledge of semantics (Tenney et al., 2019; Ettinger, 2020).
149
+
150
+ Interpreting attention specifically. Interpreting attention on textual sequences is a wellestablished area of research (Wiegreffe & Pinter, 2019; Zhong et al., 2019; Brunner et al., 2020; Hewitt & Manning, 2019). Past work has been shown that attention correlates with syntactic and semantic relationships in natural language in some cases (Clark et al., 2019; Vig & Belinkov, 2019; Htut et al., 2019). Depending on the task and model architecture, attention may have less or more explanatory power for model predictions (Jain & Wallace, 2019; Serrano & Smith, 2019; Pruthi et al., 2020; Moradi et al., 2019; Vashishth et al., 2019). Visualization techniques have been used to convey the structure and properties of attention in Transformers (Vaswani et al., 2017; Kovaleva et al., 2019; Hoover et al., 2020; Vig, 2019). Recent work has begun to analyze attention in Transformer models outside of the domain of natural language (Schwaller et al., 2020; Payne et al., 2020).
151
+
152
+ Our work extends these methods to protein sequence models by considering particular biophysical properties and relationships. We also present a joint cross-layer probing analysis of attention weights and layer embeddings. While past work in NLP has analyzed attention and embeddings across layers, we believe we are the first to do so in any domain using a single, unified metric, which enables us to directly compare the relative information content of the two representations. Finally, we present a novel tool for visualizing attention embedded in three-dimensional structure.
153
+
154
+ # 6 CONCLUSIONS AND FUTURE WORK
155
+
156
+ This paper builds on the synergy between NLP and computational biology by adapting and extending NLP interpretability methods to protein sequence modeling. We show how a Transformer language model recovers structural and functional properties of proteins and integrates this knowledge directly into its attention mechanism. While this paper focuses on reconciling attention with known properties of proteins, one might also leverage attention to uncover novel relationships or more nuanced forms of existing measures such as contact maps, as discussed in Section 4.1. In this way, language models have the potential to serve as tools for scientific discovery. But in order for learned representations to be accessible to domain experts, they must be presented in an appropriate context to facilitate discovery. Visualizing attention in the context of protein structure (Figure 1) is one attempt to do so. We believe there is the potential to develop such contextual visualizations of learned representations in a range of scientific domains.
157
+
158
+ # ACKNOWLEDGMENTS
159
+
160
+ We would like to thank Xi Victoria Lin, Stephan Zheng, Melvin Gruesbeck, and the anonymous reviewers for their valuable feedback.
161
+
162
+ # REFERENCES
163
+
164
+ Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. arXiv:1608.04207 [cs.CL]., 2016.
165
+
166
+ Ethan C Alley, Grigory Khimulya, Surojit Biswas, Mohammed AlQuraishi, and George M Church. Unified rational protein engineering with sequence-based deep representation learning. Nature Methods, 16(12):1315–1322, 2019.
167
+
168
+ Mohammed AlQuraishi. ProteinNet: a standardized data set for machine learning of protein structure. BMC Bioinformatics, 20, 2019.
169
+
170
+ Ehsaneddin Asgari and Mohammad RK Mofrad. Continuous distributed representation of biological sequences for deep proteomics and genomics. PLOS One, 10(11), 2015.
171
+
172
+ Tristan Bepler and Bonnie Berger. Learning protein sequence embeddings using information from structure. In International Conference on Learning Representations, 2019.
173
+
174
+ Helen M Berman, John Westbrook, Zukang Feng, Gary Gilliland, Talapady N Bhat, Helge Weissig, Ilya N Shindyalov, and Philip E Bourne. The protein data bank. Nucleic Acids Research, 28(1): 235–242, 2000.
175
+
176
+ Surojit Biswas, Grigory Khimulya, Ethan C. Alley, Kevin M. Esvelt, and George M. Church. Low-n protein engineering with data-efficient deep learning. bioRxiv, 2020. doi: 10.1101/ 2020.01.23.917682. URL https://www.biorxiv.org/content/early/2020/08/ 31/2020.01.23.917682.
177
+
178
+ Ashraf Brik and Chi-Huey Wong. HIV-1 protease: Mechanism and drug discovery. Organic & Biomolecular Chemistry, 1(1):5–14, 2003.
179
+
180
+ Gino Brunner, Yang Liu, Damian Pascual, Oliver Richter, Massimiliano Ciaramita, and Roger Wattenhofer. On identifiability in Transformers. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id ${ . } = { }$ BJg1f6EFDB.
181
+
182
+ Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. What does BERT look at? An analysis of BERT’s attention. In BlackBoxNLP@ACL, 2019.
183
+
184
+ Alexis Conneau, German Kruszewski, Guillaume Lample, Loïc Barrault, and Marco Baroni. What you can cram into a single $\$ 1$ &!#\* vector: Probing sentence embeddings for linguistic properties. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pp. 2126–2136, 2018.
185
+
186
+ 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), pp. 4171–4186, Minneapolis, Minnesota, 2019. Association for Computational Linguistics.
187
+
188
+ Sara El-Gebali, Jaina Mistry, Alex Bateman, Sean R. Eddy, Aurélien Luciani, Simon C. Potter, Matloob Qureshi, Lorna J. Richardson, Gustavo A. Salazar, Alfredo Smart, Erik L. L. Sonnhammer, Layla Hirsh, Lisanna Paladin, Damiano Piovesan, Silvio C. E. Tosatto, and Robert D. Finn. The Pfam protein families database in 2019. Nucleic Acids Research, 47(D1):D427–D432, January 2019a. doi: 10.1093/nar/gky995.
189
+
190
+ Sara El-Gebali, Jaina Mistry, Alex Bateman, Sean R Eddy, Aurélien Luciani, Simon C Potter, Matloob Qureshi, Lorna J Richardson, Gustavo A Salazar, Alfredo Smart, Erik L L Sonnhammer, Layla Hirsh, Lisanna Paladin, Damiano Piovesan, Silvio C E Tosatto, and Robert D Finn. The Pfam protein families database in 2019. Nucleic Acids Research, 47(D1):D427–D432, 2019b. ISSN 0305-1048. doi: 10.1093/nar/gky995.
191
+
192
+ Ahmed Elnaggar, Michael Heinzinger, Christian Dallago, Ghalia Rihawi, Yu Wang, Llion Jones, Tom Gibbs, Tamas Feher, Christoph Angerer, Martin Steinegger, Debsindhu Bhowmik, and Burkhard Rost. ProtTrans: Towards cracking the language of life’s code through self-supervised deep learning and high performance computing. arXiv preprint arXiv:2007.06225, 2020.
193
+
194
+ Kawin Ethayarajh. How contextual are contextualized word representations? Comparing the geometry of BERT, ELMo, and GPT-2 embeddings. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 55–65, Hong Kong, China, 2019. Association for Computational Linguistics.
195
+
196
+ Allyson Ettinger. What BERT is not: Lessons from a new suite of psycholinguistic diagnostics for language models. Transactions of the Association for Computational Linguistics, 8:34–48, 2020.
197
+
198
+ Naomi K Fox, Steven E Brenner, and John-Marc Chandonia. SCOPe: Structural classification of proteins—extended, integrating scop and astral data and classification of new structures. Nucleic Acids Research, 42(D1):D304–D309, 2013.
199
+
200
+ Yoav Goldberg. Assessing BERT’s syntactic abilities. arXiv preprint arXiv:1901.05287, 2019.
201
+
202
+ Christopher Grimsley, Elijah Mayfield, and Julia R.S. Bursten. Why attention is not explanation: Surgical intervention and causal reasoning about neural models. In Proceedings of The 12th Language Resources and Evaluation Conference, pp. 1780–1790, Marseille, France, May 2020. European Language Resources Association. ISBN 979-10-95546-34-4. URL https://www. aclweb.org/anthology/2020.lrec-1.220.
203
+
204
+ S Henikoff and J G Henikoff. Amino acid substitution matrices from protein blocks. Proceedings of the National Academy of Sciences, 89(22):10915–10919, 1992. ISSN 0027-8424. doi: 10.1073/ pnas.89.22.10915. URL https://www.pnas.org/content/89/22/10915.
205
+
206
+ John Hewitt and Christopher D Manning. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4129–4138, 2019.
207
+
208
+ Benjamin Hoover, Hendrik Strobelt, and Sebastian Gehrmann. exBERT: A Visual Analysis Tool to Explore Learned Representations in Transformer Models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 187–196. Association for Computational Linguistics, 2020.
209
+
210
+ Phu Mon Htut, Jason Phang, Shikha Bordia, and Samuel R Bowman. Do attention heads in BERT track syntactic dependencies? arXiv preprint arXiv:1911.12246, 2019.
211
+
212
+ Sarthak Jain and Byron C. Wallace. Attention is not Explanation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 3543–3556, June 2019.
213
+
214
+ Ganesh Jawahar, Benoît Sagot, and Djamé Seddah. What does BERT learn about the structure of language? In ACL 2019 - 57th Annual Meeting of the Association for Computational Linguistics, Florence, Italy, July 2019. URL https://hal.inria.fr/hal-02131630.
215
+
216
+ Akira Kinjo and Haruki Nakamura. Comprehensive structural classification of ligand-binding motifs in proteins. Structure, 17(2), 2009.
217
+
218
+ Michael Schantz Klausen, Martin Closter Jespersen, Henrik Nielsen, Kamilla Kjaergaard Jensen, Vanessa Isabell Jurtz, Casper Kaae Soenderby, Morten Otto Alexander Sommer, Ole Winther, Morten Nielsen, Bent Petersen, et al. NetSurfP-2.0: Improved prediction of protein structural features by integrated deep learning. Proteins: Structure, Function, and Bioinformatics, 2019.
219
+
220
+ Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. Revealing the dark secrets of BERT. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pp. 4365–4374, Hong Kong, China, 2019. Association for Computational Linguistics.
221
+
222
+ Keita Kurita, Nidhi Vyas, Ayush Pareek, Alan W Black, and Yulia Tsvetkov. Measuring bias in contextualized word representations. In Proceedings of the First Workshop on Gender Bias in Natural Language Processing, pp. 166–172, Florence, Italy, 2019. Association for Computational Linguistics.
223
+
224
+ Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. Albert: A lite bert for self-supervised learning of language representations. In International Conference on Learning Representations, 2020.
225
+
226
+ Juyong Lee, Janez Konc, Dusanka Janezic, and Bernard Brooks. Global organization of a binding site network gives insight into evolution and structure-function relationships of proteins. Sci Rep, 7 (11652), 2017.
227
+
228
+ Yongjie Lin, Yi Chern Tan, and Robert Frank. Open sesame: Getting inside BERT’s linguistic knowledge. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 241–253, Florence, Italy, 2019. Association for Computational Linguistics.
229
+
230
+ Nelson F. Liu, Matt Gardner, Yonatan Belinkov, Matthew E. Peters, and Noah A. Smith. Linguistic knowledge and transferability of contextual representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 1073–1094. Association for Computational Linguistics, 2019.
231
+
232
+ Ali Madani, Bryan McCann, Nikhil Naik, Nitish Shirish Keskar, Namrata Anand, Raphael R. Eguchi, Po-Ssu Huang, and Richard Socher. Progen: Language modeling for protein generation. arXiv preprint arXiv:2004.03497, 2020.
233
+
234
+ Timothee Mickus, Mathieu Constant, Denis Paperno, and Kees Van Deemter. What do you mean, BERT? Assessing BERT as a Distributional Semantics Model. Proceedings of the Society for Computation in Linguistics, 3, 2020.
235
+
236
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In C. J. C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 26, pp. 3111–3119. Curran Associates, Inc., 2013.
237
+
238
+ Pooya Moradi, Nishant Kambhatla, and Anoop Sarkar. Interrogating the explanatory power of attention in neural machine translation. In Proceedings of the 3rd Workshop on Neural Generation and Translation, pp. 221–230, Hong Kong, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-5624. URL https://www.aclweb.org/anthology/ D19-5624.
239
+
240
+ John Moult, Krzysztof Fidelis, Andriy Kryshtafovych, Torsten Schwede, and Anna Tramontano. Critical assessment of methods of protein structure prediction (CASP)-Round XII. Proteins: Structure, Function, and Bioinformatics, 86:7–15, 2018. ISSN 08873585. doi: 10.1002/prot.25415. URL http://doi.wiley.com/10.1002/prot.25415.
241
+
242
+ Hai Nguyen, David A Case, and Alexander S Rose. NGLview–interactive molecular graphics for Jupyter notebooks. Bioinformatics, 34(7):1241–1242, 12 2017. ISSN 1367-4803. doi: 10.1093/ bioinformatics/btx789. URL https://doi.org/10.1093/bioinformatics/btx789.
243
+
244
+ Timothy Niven and Hung-Yu Kao. Probing neural network comprehension of natural language arguments. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4658–4664, Florence, Italy, 2019. Association for Computational Linguistics.
245
+
246
+ Josh Payne, Mario Srouji, Dian Ang Yap, and Vineet Kosaraju. Bert learns (and teaches) chemistry. arXiv preprint arXiv:2007.16012, 2020.
247
+
248
+ Matthew Peters, Mark Neumann, Luke Zettlemoyer, and Wen-tau Yih. Dissecting contextual word embeddings: Architecture and representation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 1499–1509, Brussels, Belgium, OctoberNovember 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1179. URL https://www.aclweb.org/anthology/D18-1179.
249
+
250
+ Danish Pruthi, Mansi Gupta, Bhuwan Dhingra, Graham Neubig, and Zachary C. Lipton. Learning to deceive with attention-based explanations. In Annual Conference of the Association for Computational Linguistics (ACL), July 2020. URL https://arxiv.org/abs/1909.07913.
251
+
252
+ Alessandro Raganato and Jörg Tiedemann. An analysis of encoder representations in Transformerbased machine translation. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 287–297, Brussels, Belgium, November 2018. Association for Computational Linguistics. doi: 10.18653/v1/W18-5431. URL https://www. aclweb.org/anthology/W18-5431.
253
+
254
+ Roshan Rao, Nicholas Bhattacharya, Neil Thomas, Yan Duan, Xi Chen, John Canny, Pieter Abbeel, and Yun S Song. Evaluating protein transfer learning with TAPE. In Advances in Neural Information Processing Systems, 2019.
255
+
256
+ Emily Reif, Ann Yuan, Martin Wattenberg, Fernanda B Viegas, Andy Coenen, Adam Pearce, and Been Kim. Visualizing and measuring the geometry of BERT. In H. Wallach, H. Larochelle, A. Beygelzimer, F. dAlché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32, pp. 8594–8603. Curran Associates, Inc., 2019.
257
+
258
+ Adam J Riesselman, Jung-Eun Shin, Aaron W Kollasch, Conor McMahon, Elana Simon, Chris Sander, Aashish Manglik, Andrew C Kruse, and Debora S Marks. Accelerating protein design using autoregressive generative models. bioRxiv, pp. 757252, 2019.
259
+
260
+ Alexander Rives, Siddharth Goyal, Joshua Meier, Demi Guo, Myle Ott, C Lawrence Zitnick, Jerry Ma, and Rob Fergus. Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences. bioRxiv, pp. 622803, 2019.
261
+
262
+ Anna Rogers, Olga Kovaleva, and Anna Rumshisky. A primer in BERTology: What we know about how BERT works. Transactions of the Association for Computational Linguistics, 8:842–866, 2020.
263
+
264
+ Nathan J Rollins, Kelly P Brock, Frank J Poelwijk, Michael A Stiffler, Nicholas P Gauthier, Chris Sander, and Debora S Marks. Inferring protein 3D structure from deep mutation scans. Nature Genetics, 51(7):1170, 2019.
265
+
266
+ Alexander S. Rose and Peter W. Hildebrand. NGL Viewer: a web application for molecular visualization. Nucleic Acids Research, 43(W1):W576–W579, 04 2015. ISSN 0305-1048. doi: 10.1093/nar/gkv402. URL https://doi.org/10.1093/nar/gkv402.
267
+
268
+ Alexander S Rose, Anthony R Bradley, Yana Valasatava, Jose M Duarte, Andreas Prlic, and Peter W ´ Rose. NGL viewer: web-based molecular graphics for large complexes. Bioinformatics, 34(21): 3755–3758, 05 2018. ISSN 1367-4803. doi: 10.1093/bioinformatics/bty419. URL https: //doi.org/10.1093/bioinformatics/bty419.
269
+
270
+ Charles Rubin and Ora Rosen. Protein phosphorylation. Annual Review of Biochemistry, 44:831–887, 1975. URL https://doi.org/10.1146/annurev.bi.44.070175.004151.
271
+
272
+ Philippe Schwaller, Benjamin Hoover, Jean-Louis Reymond, Hendrik Strobelt, and Teodoro Laino. Unsupervised attention-guided atom-mapping. ChemRxiv, 5 2020. doi: 10.26434/ chemrxiv.12298559.v1. URL https://chemrxiv.org/articles/Unsupervised_ Attention-Guided_Atom-Mapping/12298559.
273
+
274
+ Sofia Serrano and Noah A. Smith. Is attention interpretable? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2931–2951, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1282. URL https: //www.aclweb.org/anthology/P19-1282.
275
+
276
+ Martin Steinegger and Johannes Söding. Clustering huge protein sequence sets in linear time. Nature Communications, 9(2542), 2018. doi: 10.1038/s41467-018-04964-5.
277
+
278
+ Baris E. Suzek, Yuqi Wang, Hongzhan Huang, Peter B. McGarvey, Cathy H. Wu, and the UniProt Consortium. UniRef clusters: a comprehensive and scalable alternative for improving sequence similarity searches. Bioinformatics, 31(6):926–932, 11 2014. ISSN 1367-4803. doi: 10.1093/ bioinformatics/btu739. URL https://doi.org/10.1093/bioinformatics/btu739.
279
+
280
+ Yi Chern Tan and L. Elisa Celis. Assessing social and intersectional biases in contextualized word representations. In Advances in Neural Information Processing Systems 32, pp. 13230–13241. Curran Associates, Inc., 2019.
281
+
282
+ Ian Tenney, Dipanjan Das, and Ellie Pavlick. BERT rediscovers the classical NLP pipeline. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4593–4601, Florence, Italy, 2019. Association for Computational Linguistics.
283
+
284
+ Shikhar Vashishth, Shyam Upadhyay, Gaurav Singh Tomar, and Manaal Faruqui. Attention interpretability across NLP tasks. arXiv preprint arXiv:1909.11218, 2019.
285
+
286
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008, 2017.
287
+
288
+ Sara Veldhoen, Dieuwke Hupkes, and Willem H. Zuidema. Diagnostic classifiers revealing how neural networks process hierarchical structure. In CoCo@NIPS, 2016.
289
+
290
+ Jesse Vig. A multiscale visualization of attention in the Transformer model. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 37–42, Florence, Italy, 2019. Association for Computational Linguistics.
291
+
292
+ Jesse Vig and Yonatan Belinkov. Analyzing the structure of attention in a Transformer language model. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 63–76, Florence, Italy, 2019. Association for Computational Linguistics.
293
+
294
+ Jesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian, Daniel Nevo, Yaron Singer, and Stuart Shieber. Investigating gender bias in language models using causal mediation analysis. In Advances in Neural Information Processing Systems, volume 33, pp. 12388–12401, 2020.
295
+
296
+ Gregor Wiedemann, Steffen Remus, Avi Chawla, and Chris Biemann. Does BERT make any sense? Interpretable word sense disambiguation with contextualized embeddings. arXiv preprint arXiv:1909.10430, 2019.
297
+
298
+ Sarah Wiegreffe and Yuval Pinter. Attention is not not explanation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 11–20, November 2019.
299
+
300
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. XLNet: Generalized autoregressive pretraining for language understanding. In H. Wallach, H. Larochelle, A. Beygelzimer, F. dAlché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32, pp. 5753–5763. Curran Associates, Inc., 2019.
301
+
302
+ Ruiqi Zhong, Steven Shao, and Kathleen McKeown. Fine-grained sentiment analysis with faithful attention. arXiv preprint arXiv:1908.06870, 2019.
303
+
304
+ A MODEL OVERVIEW
305
+
306
+ # A.1 PRE-TRAINED MODELS
307
+
308
+ Table 1 provides an overview of the five pre-trained Transformer models studied in this work. The models originate from the TAPE and ProtTrans repositories, spanning three model architectures: BERT, ALBERT, and XLNet.
309
+
310
+ Table 1: Summary of pre-trained models analyzed, including the source of the model, the type of Transformer used, the number of layers and heads, the total number of model parameters, the source of the pre-training dataset, and the number of protein sequences in the pre-training dataset.
311
+
312
+ <table><tr><td>Source</td><td>Name</td><td>Type</td><td>Layers</td><td>Heads</td><td>Params</td><td>Train Dataset</td><td>#Seq</td></tr><tr><td>TAPE</td><td>TapeBert</td><td>BERT</td><td>12</td><td>12</td><td>94M</td><td>Pfam</td><td>31M</td></tr><tr><td>ProtTrans</td><td>ProtBert</td><td>BERT</td><td>30</td><td>16</td><td>420M</td><td>Uniref100</td><td>216M</td></tr><tr><td>ProtTrans</td><td>ProtBert-BFD</td><td>BERT</td><td>30</td><td>16</td><td>420M</td><td>BFD</td><td>2.1B</td></tr><tr><td>ProtTrans</td><td>ProtAlbert</td><td>ALBERT</td><td>12</td><td>64</td><td>224M</td><td>Uniref100</td><td>216M</td></tr><tr><td>ProtTrans</td><td>ProtXLNet</td><td>XLNet</td><td>30</td><td>16</td><td>409M</td><td>Uniref100</td><td>216M</td></tr></table>
313
+
314
+ # A.2 BERT TRANSFORMER ARCHITECTURE
315
+
316
+ Stacked Encoder: BERT uses a stacked-encoder architecture, which inputs a sequence of tokens $\pmb { x } = ( x _ { 1 } , . . . , x _ { n } )$ and applies position and token embeddings followed by a series of encoder layers. Each layer applies multi-head self-attention (see below) in combination with a feedforward network, layer normalization, and residual connections. The output of each layer $\ell$ is a sequence of contextualized embeddings $( \mathbf { h } _ { 1 } ^ { ( \ell ) } , \ldots , \mathbf { h } _ { n } ^ { ( \ell ) } )$ .
317
+
318
+ Self-Attention: Given an input $\pmb { x } = ( x _ { 1 } , \ldots , x _ { n } ) ,$ , the self-attention mechanism assigns to each token pair $i , j$ an attention weight $\alpha _ { i , j } > 0$ where $\begin{array} { r } { \sum _ { j } \alpha _ { i , j } = 1 } \end{array}$ . Attention in BERT is bidirectional. In the multi-layer, multi-head setting, $\alpha$ is specific to a layer and head. The BERT-Base model has 12 layers and 12 heads. Each attention head learns a distinct set of weights, resulting in $1 2 \times 1 2 = 1 4 4$ distinct attention mechanisms in this case.
319
+
320
+ The attention weights $\alpha _ { i , j }$ are computed from the scaled dot-product of the query vector of $i$ and the key vector of $j$ , followed by a softmax operation. The attention weights are then used to produce a weighted sum of value vectors:
321
+
322
+ $$
323
+ { \mathrm { A t t e n t i o n } } ( Q , K , V ) = { \mathrm { s o f t m a x } } \left( { \frac { Q K ^ { T } } { \sqrt { d _ { k } } } } \right) V
324
+ $$
325
+
326
+ using query matrix $Q$ , key matrix $K$ , and value matrix $V$ , where $d _ { k }$ is the dimension of $K$ . In a multi-head setting, the queries, keys, and values are linearly projected $h$ times, and the attention operation is performed in parallel for each representation, with the results concatenated.
327
+
328
+ # A.3 OTHER TRANSFORMER VARIANTS
329
+
330
+ ALBERT: The architecture of ALBERT differs from BERT in two ways: (1) It shares parameters across layers, unlike BERT which learns distinct parameters for every layer and (2) It uses factorized embeddings, which allows the input token embeddings to be of a different (smaller) size than the hidden states. The original version of ALBERT designed for text also employed a sentence-order prediction pretraining task, but this was not used on the models studied in this paper.
331
+
332
+ XLNet: Instead of the masked-language modeling pretraining objective use for BERT, XLNet uses a bidirectional auto-regressive pretraining method that considers all possible orderings of the input factorization. The architecture also adds a segment recurrence mechanism to process long sequences, as well as a relative rather than absolute encoding scheme.
333
+
334
+ # B ADDITIONAL EXPERIMENTAL DETAILS
335
+
336
+ # B.1 ALTERNATIVE ATTENTION AGREEMENT METRIC
337
+
338
+ Here we present an alternative formulation to Eq. 1 based on an attention-weighted average. We define an indicator function $f ( i , j )$ for property $f$ that returns 1 if the property is present in token pair $( i , j )$ (i.e., if amino acids $i$ and $j$ are in contact), and zero otherwise. We then compute the proportion of attention that matches with $f$ over a dataset $\boldsymbol { X }$ as follows:
339
+
340
+ $$
341
+ p _ { \alpha } ( f ) = \sum _ { x \in X } \sum _ { i = 1 } ^ { | x | } \sum _ { j = 1 } ^ { | x | } f ( i , j ) \alpha _ { i , j } ( x ) \bigg / \sum _ { x \in X } \sum _ { i = 1 } ^ { | x | } \sum _ { j = 1 } ^ { | x | } \alpha _ { i , j } ( x )
342
+ $$
343
+
344
+ where $\alpha _ { i , j } ( x )$ denotes the attention from $i$ to $j$ for input sequence $x$
345
+
346
+ # B.2 STATISTICAL SIGNIFICANCE TESTING AND NULL MODELS
347
+
348
+ We perform statistical significance tests to determine whether any results based on the metric defined in Equation 1 are due to chance. Given a property $f$ , as defined in Section 3, we perform a twoproportion z-test comparing (1) the proportion of high-confidence attention arcs $( \alpha _ { i , j } > \theta )$ for which $f ( i , j ) = 1$ , and (2) the proportion of all possible pairs $i , j$ for which $f ( i , j ) = 1$ . Note that the first proportion is exactly the metric $p _ { \alpha } ( f )$ defined in Equation 1 (e.g. the proportion of attention aligned with contact maps). The second proportion is simply the background frequency of the property (e.g. the background frequency of contacts). Since we extract the maximum scores over all of the heads in the model, we treat this as a case of multiple hypothesis testing and apply the Bonferroni correction, with the number of hypotheses $m$ equal to the number of attention heads.
349
+
350
+ As an additional check that the results did not occur by chance, we also report results on baseline (null) models. We initially considered using two forms of null models: (1) a model with randomly initialized weights. and (2) a model trained on randomly shuffled sequences. However, in both cases, none of the sequences in the dataset yielded attention weights greater than the attention threshold $\theta$ . This suggests that the mere existence of the high-confidence attention weights used in the analysis could not have occurred by chance, but it does not shed light on the particular analyses performed. Therefore, we implemented an alternative randomization scheme in which we randomly shuffle attention weights from the original models as a post-processing step. Specifically, we permute the sequence of attention weights from each token for every attention head. To illustrate, let’s say that the original model produced attention weights of (0.3, 0.2, 0.1, 0.4, 0.0) from position $i$ in protein sequence $x$ from head $h$ , where $| x | = 5$ . In the null model, the attention weights from position $i$ in sequence $x$ in head $h$ would be a random permutation of those weights, e.g., (0.2, 0.0, 0.4, 0.3, 0.1). Note that these are still valid attention weights as they would sum to 1 (since the original weights would sum to 1 by definition). We report results using this form of baseline model.
351
+
352
+ # B.3 PROBING METHODOLOGY
353
+
354
+ Embedding probe. We probe the embedding vectors output from each layer using a linear probing classifier. For token-level probing tasks (binding sites, secondary structure) we feed each token’s output vector directly to the classifier. For token-pair probing tasks (contact map) we construct a pairwise feature vector by concatenating the elementwise differences and products of the two tokens’ output vectors, following the $\mathrm { T A P E ^ { 4 } }$ implementation.
355
+
356
+ We use task-specific evaluation metrics for the probing classifier: for secondary structure prediction, we measure F1 score; for contact prediction, we measure precision $\ @ L / 5$ , where $L$ is the length of the protein sequence, following standard practice (Moult et al., 2018); for binding site prediction, we measure precision $\textcircled { a } L / 2 0$ , since approximately one in twenty amino acids in each sequence is a binding site ( $4 . 8 \%$ in the dataset).
357
+
358
+ Attention probe. Just as the attention weight $\alpha _ { i , j }$ is defined for a pair of amino acids $( i , j )$ , so is the contact property $f ( i , j )$ , which returns true if amino acids $i$ and $j$ are in contact. Treating the attention weight as a feature of a token-pair $( i , j )$ , we can train a probing classifier that predicts the contact property based on this feature, thereby quantifying the attention mechanism’s knowledge of that property. In our multi-head setting, we treat the attention weights across all heads in a given layer as a feature vector, and use a probing classifier to assess the knowledge of a given property in the attention weights across the entire layer. As with the embedding probe, we measure performance of the probing classifier using precision $\textcircled { \omega } L / 5$ , where $L$ is the length of the protein sequence, following standard practice for contact prediction.
359
+
360
+ # B.4 DATASETS
361
+
362
+ We used two protein sequence datasets from the TAPE repository for the analysis: the ProteinNet dataset (AlQuraishi, 2019; Fox et al., 2013; Berman et al., 2000; Moult et al., 2018) and the Secondary Structure dataset (Rao et al., 2019; Berman et al., 2000; Moult et al., 2018; Klausen et al., 2019). The former was used for analysis of amino acids and contact maps, and the latter was used for analysis of secondary structure. We additionally created a third dataset for binding site and post-translational modification (PTM) analysis from the Secondary Structure dataset, which was augmented with binding site and PTM annotations obtained from the Protein Data Bank’s Web API.5 We excluded any sequences for which annotations were not available. The resulting dataset sizes are shown in Table 2. For the analysis of attention, a random subset of 5000 sequences from the training split of each dataset was used, as the analysis was purely evaluative. For training and evaluating the diagnostic classifier, the full training and validation splits were used.
363
+
364
+ Table 2: Datasets used in analysis
365
+
366
+ <table><tr><td>Dataset</td><td>Train size</td><td>Validation size</td></tr><tr><td>ProteinNet</td><td>25299</td><td>224</td></tr><tr><td>Secondary Structure</td><td>8678</td><td>2170</td></tr><tr><td>Binding Sites /PTM</td><td>5734</td><td>1418</td></tr></table>
367
+
368
+ # C ADDITIONAL RESULTS OF ATTENTION ANALYSIS
369
+
370
+ # C.1 SECONDARY STRUCTURE
371
+
372
+ ![](images/874da91833e7cc020b102bfcf36014b580a6efa39cd887dd7410e8629f85b8bd.jpg)
373
+ Figure 8: Percentage of each head’s attention that is focused on Helix secondary structure.
374
+
375
+ ![](images/6fe39d626b595b4e8fca6c45de47abc7eb38c8556636c3491df8bb46dbd240db.jpg)
376
+ Figure 9: Percentage of each head’s attention that is focused on Strand secondary structure.
377
+
378
+ ![](images/efd3f3018d144a602b30f08dca9364b698bd6b901f2c036a5bbf5403c15403bc.jpg)
379
+ Figure 10: Percentage of each head’s attention that is focused on Turn/Bend secondary structure.
380
+
381
+ ![](images/9efbd046404b595b20e34a6e9d5208fcb6be242938b5cba867f24aed3effd9fc.jpg)
382
+ Figure 11: Top 10 heads (denoted by <layer>-<head>) for each model based on the proportion of attention aligned with contact maps $[ 9 5 \%$ conf. intervals]. The differences between the attention proportions and the background frequency of contacts (orange dashed line) are statistically significant $( p < 0 . 0 0 0 0 1 )$ . Bonferroni correction applied for both confidence intervals and tests (see App. B.2).
383
+
384
+ ![](images/12e66356a4a9e06fb4819de569b0df7c41f5639388d34a9db10a73e9168d974a.jpg)
385
+ Figure 12: Top-10 contact-aligned heads for null models. See Appendix B.2 for details.
386
+
387
+ ![](images/b9a79ce547775c36353996fc2378f4e9974152012f388477ea658cfb0a9aaa38.jpg)
388
+ Figure 13: Top 10 heads (denoted by <layer>-<head>) for each model based on the proportion of attention focused on binding sites $[ 9 5 \%$ conf. intervals]. Differences between attention proportions and the background frequency of binding sites (orange dashed line) are all statistically significant $( p < 0 . 0 0 0 0 1 )$ . Bonferroni correction applied for both confidence intervals and tests (see App. B.2).
389
+
390
+ ![](images/b0d5822f094e125234a0ac227f429ce561a858dd94e46c451044f3a9fb79af00.jpg)
391
+ Figure 14: Top-10 heads most focused on binding sites for null models. See Appendix B.2 for details.
392
+
393
+ ![](images/ac5ace74358f80d3ec55a056dd0204e36b844402bff5afc802a3fd5ec121f981.jpg)
394
+ Figure 15: Percentage of each head’s attention that is focused on post-translational modifications.
395
+
396
+ ![](images/94ef239e9fe963381214c352988a2ce1e815cef4311e9c21da08c3fbfc6c7a67.jpg)
397
+ Figure 16: Top 10 heads (denoted by <layer>-<head>) for each model based on the proportion of attention focused on PTM positions $[ 9 5 \%$ conf. intervals]. The differences between the attention proportions and the background frequency of PTMs (orange dashed line) are statistically significant $( p < 0 . 0 0 0 0 1 )$ . Bonferroni correction applied for both confidence intervals and tests (see App. B.2).
398
+
399
+ ![](images/4b338567f3dcc68912449f9fb1a15d2dcce562a7d382dc0bcc3ed98c169c2e20.jpg)
400
+ Figure 17: Top-10 heads most focused on PTMs for null models. See Appendix B.2 for details.
401
+
402
+ ![](images/deb1ab3bef65c9a42602eb50873917e534236dafd7860dfc99a423b6ff43f753.jpg)
403
+ Figure 18: Percentage of each head’s attention that is focused on the given amino acid, averaged over a dataset (TapeBert).
404
+
405
+ ![](images/f7ede4617c28af1651d283ad4b8fef91c99024ad888c0346642e8a0fea62ca28.jpg)
406
+ Figure 19: Percentage of each head’s attention that is focused on the given amino acid, averaged over a dataset (cont.)
407
+
408
+ Table 3: Amino acids and the corresponding maximally attentive heads in the standard and randomized versions of TapeBert. The differences between the attention percentages for TapeBert and the background frequencies of each amino acid are all statistically significant $( p < 0 . 0 0 0 0 1 )$ ) taking into account the Bonferroni correction. See Appendix B.2 for details. The bolded numbers represent the higher of the two values between the standard and random models. In all cases except for Glutamine, which was the amino acid with the lowest top attention proportion in the standard model (7.1), the standard TapeBert model has higher values than the randomized version.
409
+
410
+ <table><tr><td colspan="4"></td><td colspan="2">TapeBert</td><td colspan="2">TapeBert-Random</td></tr><tr><td>Abbrev</td><td>Code</td><td>Name</td><td>Background %</td><td>Top Head</td><td>Attn %</td><td>Top Head</td><td>Attn %</td></tr><tr><td>Ala</td><td>A</td><td>Alanine</td><td>7.9</td><td>12-11</td><td>25.5</td><td>11-12</td><td>12.1</td></tr><tr><td>Arg</td><td>R</td><td>Arginine</td><td>5.2</td><td>12-8</td><td>63.2</td><td>12-7</td><td>8.4</td></tr><tr><td>Asn</td><td>N</td><td>Asparagine</td><td>4.3</td><td>8-2</td><td>44.8</td><td>8-2</td><td>6.7</td></tr><tr><td>Asp</td><td>D</td><td>Aspartic acid</td><td>5.8</td><td>12-6</td><td>79.9</td><td>5-4</td><td>10.7</td></tr><tr><td>Cys</td><td>C</td><td>Cysteine</td><td>1.3</td><td>11-6</td><td>83.2</td><td>11-6</td><td>9.3</td></tr><tr><td>Gln</td><td>Q</td><td>Glutamine</td><td>3.8</td><td>11-7</td><td>7.1</td><td>12-1</td><td>9.2</td></tr><tr><td>Glu</td><td>E</td><td>Glutamic acid</td><td>6.9</td><td>11-7</td><td>16.2</td><td>11-4</td><td>11.8</td></tr><tr><td>Gly</td><td>G</td><td>Glycine</td><td>7.1</td><td>2-11</td><td>98.1</td><td>11-8</td><td>14.6</td></tr><tr><td>His</td><td>H</td><td>Histidine</td><td>2.7</td><td>9-10</td><td>56.7</td><td>11-6</td><td>5.4</td></tr><tr><td>Ile</td><td>I</td><td>Isoleucine</td><td>5.6</td><td>11-10</td><td>27.0</td><td>9-5</td><td>10.6</td></tr><tr><td>Leu</td><td>L</td><td>Leucine</td><td>9.4</td><td>2-12</td><td>44.1</td><td>12-11</td><td>13.9</td></tr><tr><td>Lys</td><td>K</td><td>Lysine</td><td>6.0</td><td>12-8</td><td>29.4</td><td>6-11</td><td>12.9</td></tr><tr><td>Met</td><td>M</td><td>Methionine</td><td>2.3</td><td>3-10</td><td>73.5</td><td>9-3</td><td>6.2</td></tr><tr><td>Phe</td><td>F</td><td>Phenylalanine</td><td>3.9</td><td>12-3</td><td>22.7</td><td>12-1</td><td>6.7</td></tr><tr><td>Pro</td><td>P</td><td>Proline</td><td>4.6</td><td>1-11</td><td>98.3</td><td>10-6</td><td>7.6</td></tr><tr><td>Ser</td><td>S</td><td>Serine</td><td>6.4</td><td>12-7</td><td>36.1</td><td>11-12</td><td>11.0</td></tr><tr><td>Thr</td><td>T</td><td>Threonine</td><td>5.4</td><td>12-7</td><td>19.0</td><td>10-4</td><td>9.0</td></tr><tr><td>Trp</td><td>W</td><td>Tryptophan</td><td>1.3</td><td>11-4</td><td>68.1</td><td>9-2</td><td>3.0</td></tr><tr><td>Tyr</td><td>Y</td><td>Tyrosine</td><td>3.4</td><td>12-3</td><td>51.6</td><td>12-11</td><td>6.6</td></tr><tr><td>Val</td><td>V</td><td>Valine</td><td>6.8</td><td>12-11</td><td>34.0</td><td>8-2</td><td>15.0</td></tr></table>
parse/train/YWtLZvLmud7/YWtLZvLmud7_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/YWtLZvLmud7/YWtLZvLmud7_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/YWtLZvLmud7/YWtLZvLmud7_model.json ADDED
The diff for this file is too large to render. See raw diff