ZHANGYUXUAN-zR commited on
Commit
de2b39e
·
verified ·
1 Parent(s): b977179

Add files using upload-large-folder tool

Browse files
parse/train/BtZhsSGNRNi/BtZhsSGNRNi.md ADDED
@@ -0,0 +1,616 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # COPING WITH LABEL SHIFT VIA DISTRIBUTIONALLY ROBUST OPTIMISATION
2
+
3
+ Jingzhao Zhang
4
+ Massachusetts Institute of Technology
5
+ jzhzhang@mit.edu
6
+
7
+ Aditya Krishna Menon & Andreas Veit & Srinadh Bhojanapalli & Sanjiv Kumar Google Research {adityakmenon, aveit, bsrinadh, sanjivk}@mit.edu
8
+
9
+ # Suvrit Sra
10
+
11
+ Massachusetts Institute of Technology suvrit@mit.edu
12
+
13
+ # ABSTRACT
14
+
15
+ The label shift problem refers to the supervised learning setting where the train and test label distributions do not match. Existing work addressing label shift usually assumes access to an unlabelled test sample. This sample may be used to estimate the test label distribution, and to then train a suitably re-weighted classifier. While approaches using this idea have proven effective, their scope is limited as it is not always feasible to access the target domain; further, they require repeated retraining if the model is to be deployed in multiple test environments. Can one instead learn a single classifier that is robust to arbitrary label shifts from a broad family? In this paper, we answer this question by proposing a model that minimises an objective based on distributionally robust optimisation (DRO). We then design and analyse a gradient descent-proximal mirror ascent algorithm tailored for large-scale problems to optimise the proposed objective. Finally, through experiments on CIFAR-100 and ImageNet, we show that our technique can significantly improve performance over a number of baselines in settings where label shift is present.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Classical supervised learning involves learning a model from a training distribution that generalises well on test samples drawn from the same distribution. While the assumption of identical train and test distributions has given rise to useful methods, it is often violated in many practical settings (Kouw & Loog, 2018). The label shift problem is one such important setting, wherein the training distribution over the labels does not reflect what is observed during testing (Saerens et al., 2002). For example, consider the problem of object detection in self-driving cars: a model trained in one city may see a vastly different distribution of pedestrians and cars when deployed in a different city. Such shifts in label distribution can significantly degrade model performance. As a concrete example, consider the performance of a ResNet-50 model on ImageNet. While the overall error rate is $\bar { \sim } 2 4 \%$ , Figure 1 reveals that certain classes suffer an error as high as $\sim 8 0 \%$ . Consequently, a label shift that increases the prevalence of the more erroneous classes in the test set can significantly degrade performance.
20
+
21
+ Most existing work on label shift operates in the setting where one has an unlabelled test sample that can be used to estimate the shifted label probabilities (du Plessis & Sugiyama, 2014; Lipton et al., 2018; Azizzadenesheli et al., 2019). Subsequently, one can retrain a classifier using these probabilities in place of the training label probabilities. While such techniques have proven effective, it is not always feasible to access an unlabelled set. Further, one may wish to deploy a learned model in multiple test environments, each one of which has its own label distribution. For example, the label distribution for a vehicle detection camera may change continuously while driving across the city. Instead of simply deploying a separate model for each scenario, deploying a single model that is robust to shifts may be more efficient and practical. Hence, we address the following question in this work: can we learn a single classifier that is robust to a family of arbitrary shifts?
22
+
23
+ ![](images/d5231af0b56246bc7a94d2537570ed911eb95f9facbe659051a1b1d7d0c020da.jpg)
24
+ Figure 1: Distribution of per-class test errors of a ResNet-50 on ImageNet (left). While the average error rate is $\sim 2 4 \%$ , some classes achieve an error as high as $\sim 8 0 \%$ . An adversary can thus significantly degrade test performance (right) by choosing $p _ { \mathrm { t e } } ( y )$ with more weight on these classes.
25
+
26
+ We answer the above question by modeling label shift via distributionally robust optimisation (DRO) (Shapiro et al., 2014; Rahimian & Mehrotra, 2019). DRO offers a convenient way of coping with distribution shift, and have lead to successful applications (e.g. Faury et al. (2020)). Intuitively, by seeking a model that performs well on all label distributions that are “close” to the training data label distribution, this task can be cast as a game between the learner and an adversary, with the latter allowed to pick label distributions that maximise the learner’s loss. We remark that while adversarial perspectives have informed popular paradigms such as GANs, these pursue fundamentally different objectives from DRO (see Appendix A for details).
27
+
28
+ Although several previous works have explored DRO for tackling the problem of example shift (e.g., adversarial examples) (Namkoong & Duchi, 2016; 2017; Duchi & Namkoong, 2018), an application of DRO to the label shift setting poses several challenges: (a) updating the adversary’s distribution na¨ıvely requires solving a nontrivial convex optimisation subproblem with limited tractability, and also needs careful parameter tuning; and (b) na¨ıvely estimating gradients under the adversarial distribution on a randomly sampled minibatch can lead to unstable behaviour (see §3.1). We overcome these challenges by proposing the first algorithm that successfully optimises a DRO objective for label shift on a large scale dataset (i.e., ImageNet). Our objective encourages robustness to arbitrary label distribution shifts within a KL-divergence ball of the empirical label distribution. Importantly, we show that this choice of robustness set admits an efficient and stable update step.
29
+
30
+ # Summary of contributions
31
+
32
+ (1) We design a gradient descent-proximal mirror ascent algorithm tailored for optimising large-scale problems with minimal computational overhead, and prove its theoretical convergence.
33
+ (2) With the proposed algorithm, we implement a practical procedure to successfully optimise the robust objective on ImageNet scale for the label shift application.
34
+ (3) We show through experiments on ImageNet and CIFAR-100 that our technique significantly improves over baselines when the label distribution is adversarially varied.
35
+
36
+ # 2 BACKGROUND AND PROBLEM FORMULATION
37
+
38
+ In this section we formalise the label shift problem and motivate its formulation as an adversarial optimisation problem. Consider a multiclass classification problem with distribution $p _ { \mathrm { t r } }$ over instances $\mathcal { X }$ and labels $\ Y = [ L ]$ . The goal is to learn a classifier $h _ { \theta } \colon \mathcal { X } \mathcal { Y }$ parameterised by $\theta \in \Theta$ , with the aim of ensuring good predictive performance on future samples drawn from $p _ { \mathrm { t r } }$ . More formally, the goal is to minimise the objective $\mathrm { n i n } _ { \theta } \mathbb { E } _ { ( x , y ) \sim p _ { \mathrm { t r } } } [ \ell ( x , y , \theta ) ]$ , where $\ell \colon \mathcal { X } \times \mathcal { Y } \times \Theta \mathbb { R } _ { + }$ is a loss function. In practice, we only have access to a finite sample $\mathcal { S } = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n } \sim p _ { \mathrm { t r } } ^ { n }$ , which motivates us to use the empirical distribution $\begin{array} { r } { p _ { \mathrm { e m p } } ( x , y ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbb { 1 } ( \bar { x } = x _ { i } , \bar { y } = y _ { i } ) } \end{array}$ tr in place of $p _ { \mathrm { t r } }$ . Doing so, we arrive at the objective of minimising the empirical risk:
39
+
40
+ $$
41
+ \operatorname* { m i n } _ { \theta } \ \mathbb { E } _ { p _ { \mathrm { e m p } } } [ \ell ( x , y , \theta ) ] : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( x _ { i } , y _ { i } , \theta ) .
42
+ $$
43
+
44
+ The assumption underlying the above formulation is that test samples are drawn from the same distribution $p _ { \mathrm { t r } }$ that is used during training. However, this assumption is violated in many practical settings. The problem of learning from a training distribution $p _ { \mathrm { t r } }$ , while attempting to perform well on a test distribution $p _ { \mathrm { t e } } \neq p _ { \mathrm { t r } }$ is referred to as domain adaptation (Ben-David et al., 2007). In the special case of label shift, one posits that $p _ { \mathrm { t e } } ( x \mid y ) = p _ { \mathrm { t r } } ( x \mid y )$ , but the label distribution $p _ { \mathrm { t e } } ( \bar { y } ) \neq p _ { \mathrm { t r } } ( y )$ (Saerens et al., 2002); i.e., the test distribution satisfies $\dot { p } _ { \mathrm { t e } } ( x , y ) = p _ { \mathrm { t e } } ( y ) p _ { \mathrm { t r } } ( x \mid y )$ . The label shift problem admits the following three distinct settings (see Table 1 for a summary):
45
+
46
+ Table 1: Summary of approaches to learning with a modified label distribution.
47
+
48
+ <table><tr><td>Label distribution</td><td>Reference</td></tr><tr><td>Train distribution</td><td>Standard ERM</td></tr><tr><td>Specified a-priori (e.g., balanced)</td><td>(Elkan,2001; Xie &amp; Manski, 1989; Cao et al., 2019)</td></tr><tr><td>Estimated test distribution</td><td>(du Plessis &amp; Sugiyama, 2014; Lipton et al., 2018; Azizzadenesheli et al., 2019; Garg et al., 2020; Combes et al., 2020)</td></tr><tr><td>Worst-performing class</td><td>(Hashimoto et al., 2018; Mohri et al., 2019; Sagawa et al., 2020)</td></tr><tr><td>Worst k-performing classes</td><td>(Fan et al.,2017; Williamson &amp; Menon,2019; Curi et al.,2019; Duchi et al., 2020)</td></tr><tr><td>Adversarial shifts within KL-divergence</td><td>This paper</td></tr></table>
49
+
50
+ (1) Fixed label shift. Here, one assumes $a$ -priori knowledge of $p _ { \mathrm { t e } } ( y )$ . One may then adjust the outputs of a probabilistic classifier post-hoc to improve test performance (Elkan, 2001). Even when the precise distribution is unknown, it is common to posit a uniform $p _ { \mathrm { t e } } ( y )$ . Minimising the resulting balanced error has been the subject of a large body of work (He & Garcia, 2009), with recent developments including Cui et al. (2019); Cao et al. (2019); Kang et al. (2020); Guo et al. (2020).
51
+
52
+ (2) Estimated label shift. Here, we assume that $p _ { \mathrm { t e } } ( y )$ is unknown, but that we have access to an unlabelled test sample. This sample may be used to estimate $p _ { \mathrm { t e } } ( y )$ , e.g., via kernel meanmatching (Zhang et al., 2013), minimisation of a suitable KL divergence (du Plessis & Sugiyama, 2014), or using black-box classifier outputs (Lipton et al., 2018; Azizzadenesheli et al., 2019; Garg et al., 2020). One may then use these estimates to minimise a suitably re-weighted empirical risk.
53
+
54
+ (3) Adversarial label shift. Here, we assume that $p _ { \mathrm { t e } } ( y )$ is unknown, and guard against a suitably defined worst-case choice. Observe that an extreme case of label shift involves placing all probability mass on a single $y ^ { \ast } \in \mathcal { Y }$ . This choice can be problematic, as (1) may be rewritten as
55
+
56
+ $$
57
+ \operatorname* { m i n } _ { \theta } \sum _ { y \in [ L ] } p _ { \mathrm { e m p } } ( y ) \cdot \bigg \{ \frac { 1 } { n _ { y } } \sum _ { i : y _ { i } = y } \ell ( x _ { i } , y _ { i } , \theta ) \bigg \} ,
58
+ $$
59
+
60
+ where $n _ { y }$ is the number of training samples with label $y$ . The empirical risk is thus a weighted average of the per-class losses. Observe that if some $y ^ { \ast } \in \mathcal { Y }$ has a large per-class loss, then an adversary could degrade performance by choosing a $p _ { \mathrm { t e } }$ with $p _ { \mathrm { t e } } ( y ^ { \ast } )$ being large. One means of guarding against such adversarial label shifts is to minimise the minimax risk (Alaiz-Rodr´ıguez et al., 2007; Davenport et al., 2010; Hashimoto et al., 2018; Mohri et al., 2019; Sagawa et al., 2020)
61
+
62
+ $$
63
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \pi \in \Delta ^ { L } } \sum _ { y \in [ L ] } \pi ( y ) \cdot { \biggl \{ } { \frac { 1 } { n _ { y } } } \sum _ { i : \ y _ { i } = y } \ell ( x _ { i } , y _ { i } , \theta ) { \biggr \} } ,
64
+ $$
65
+
66
+ where $\Delta ^ { L }$ denotes the simplex. In (2), we combine the per-label risks according to the worst-case label distribution. In practice, focusing on the worst-case label distribution may be overly pessimistic. One may temper this by instead constraining the label distribution. A popular choice is to enforce that $\| \pi \| _ { \infty } \leq \frac { 1 } { k }$ for suitable $k$ , which corresponds to minimising the average of the top- $k$ largest per-class losses for integer $k$ (Williamson & Menon, 2019; Curi et al., 2019; Duchi et al., 2020).
67
+
68
+ We focus on the adversarial label shift setting, as it meets the desiderata of training a single model that is robust to multiple label distributions, and not requiring access to test samples. Adversarial robustness has been widely studied (see Appendix A for more related work), but its application to label shift is much less explored. Amongst techniques in this area, Mohri et al. (2019); Sagawa et al. (2020) are most closely related to our work. These works optimise the worst-case loss over subgroups induced by the labels. However, both works consider settings with a relatively small $( \le 1 0 )$ number of subgroups; the resultant algorithms face many challenges when trained with many labels (see Section 4). We now detail how a suitably constrained DRO formulation, coupled with optimisation choices, can overcome this limitation.
69
+
70
+ $\Delta \mathrm { l g o r i t h m 1 A D V S H I F T } ( \theta _ { 0 } , \gamma _ { c } , \lambda , \tt N N O p t , \ / p _ { \mathrm { e m p } } , \eta _ { \pi } )$
71
+
72
+ <table><tr><td colspan="2">1:Initialise adversary distribution as π1 =(,,). for t=1,...,Tdo</td></tr><tr><td>2: 3:</td><td>Sample mini-batch of b examples {(xi,yi)}=1:</td></tr><tr><td>4:</td><td>Evaluate stochastic gradient ge = 1 ∑i=1 pemp(i) 1 b πt(yi) .Vel(xi,yi,0t)</td></tr><tr><td>5:</td><td>Update neural network parameters 0t+1 = NNOpt(ge)</td></tr><tr><td>6:</td><td>Update Lagrangian variable α =Oif r &gt;KL(πt,Pemp),α = 2γc入 if r&lt;KL(πt, Pemp).</td></tr><tr><td>7:</td><td>Evaluate adversarial gradient gπ(i) = 1∑=1 Pemp() 1{yj=.Vπl(xj,yj,0t+1).</td></tr><tr><td>8:</td><td>Update adversariadistribution Tt+1= (πt : Pemp)1/(1+α).exp(nπ)/C</td></tr></table>
73
+
74
+ # 3 ALGORITHM: DISTRIBUTIONALLY ROBUST KL-DIVERGENCE MINIMISATION
75
+
76
+ To address the adversarial label shift problem, we propose to replace the empirical risk (1) with
77
+
78
+ $$
79
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \pi \in \mathcal { P } } \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] , \quad \mathcal { P } : = \{ \pi \in \Delta ^ { L } \mid d ( \pi , p _ { \mathrm { e m p } } ) \leq r \} ,
80
+ $$
81
+
82
+ where $\mathcal { P }$ is an uncertainty set containing perturbations of the empirical distribution $p _ { \mathrm { e m p } }$ . This is an instance of distributionally robust optimisation $( D R O )$ (Shapiro et al., 2014), a framework where one minimises the worst-case expected loss over a family of distributions. In this work, we instantiate DRO with $\mathcal { P }$ being a parameterised family of distributions with varying marginal label distributions in KL-divergence, i.e., $d ( p , q ) = \mathbb { E } _ { y \sim q } \left[ - \log p ( y ) / q ( y ) \right] .$ (We use this divergence, as opposed to a generic $f$ -divergence, as it affords closed-form updates; see $\ S 3 . 3 .$ ) Solving (3) thus directly addresses adversarial label shift, as it ensures our model performs well on arbitrary label distributions from $\mathcal { P }$ Observe further that the existing minimax risk (2) is a special case of (3) with $r = + \infty$ .
83
+
84
+ Having stated our learning objective, we now turn to the issue of how to optimise it. One natural thought is to leverage strategies pursued in the literature on example-level $D R O$ using $f$ -divergences. For example, Namkoong $\&$ Duchi (2016) propose an algorithm that alternately performs iterative gradient updates for model parameters $\theta$ and adversarial distribution $\pi$ , assuming access to projection oracles, and the ability to sample from the adversarial distribution. However, there are challenges in applying such techniques on large-scale problems (e.g., ImageNet):
85
+
86
+ (1) directly sampling from $\pi$ is challenging in most data loading pipelines for ImageNet. (2) projecting $\pi$ onto the feasible set $\mathcal { P }$ requires solving a constrained convex optimization problem at every iteration, which can incur non-trivial overhead (see Appendix E).
87
+
88
+ We now describe ADVSHIFT (Algorithm 1), our approach to solve these problems. In a nutshell, we iteratively update model parameters $\theta$ and adversarial distributions $\pi$ . In the former, we update exactly as per ERM optimization (e.g., ADAM, SGD), which we denote as $\mathrm { N N O p t }$ (neural network optimiser); in the latter, we introduce a Lagrange multiplier to avoid projection. Extra care is needed to obtain unbiased gradients and speed up adversarial convergence, as we now detail.
89
+
90
+ # 3.1 ESTIMATING THE ADVERSARIAL MINIBATCH GRADIENT
91
+
92
+ For a fixed $\pi \in \Delta ^ { L }$ , to estimate the parameter gradient $\mathbb { E } _ { \pi } [ \nabla _ { \theta } \ell ( x , y , \theta ) ]$ on a training sample $\mathcal { S } = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , we employ the importance weighting identity and write
93
+
94
+ $$
95
+ \mathbb { E } _ { \pi } [ \nabla _ { \theta } \ell ( x , y , \theta ) ] = \mathbb { E } _ { p _ { \mathrm { e m p } } } \left[ \frac { 1 } { p _ { \mathrm { e m p } } ( y ) } \cdot \nabla _ { \theta } \ell ( x , y , \theta ) \right] = \frac { 1 } { n } \sum _ { i } \frac { \pi ( y _ { i } ) } { p _ { \mathrm { e m p } } ( y _ { i } ) } \cdot \nabla _ { \theta } \ell ( x _ { i } , y _ { i } , \theta ) .
96
+ $$
97
+
98
+ We may thus draw a minibatch as usual from S, and apply suitable weighting to obtain unbiased gradient estimates. A similar reweighting is necessary to compute the adversary gradients $\mathbb { E } _ { \pi } [ \nabla _ { \pi } \ell ( x , \bar { y } , \theta ) ]$ . Making the adversarial update efficient requires further effort, as we now discuss.
99
+
100
+ # 3.2 REMOVING CONSTRAINTS BY LAGRANGIAN DUALITY
101
+
102
+ To efficiently update the adversary distribution $\pi$ in (3), we would like to avoid the cost of projecting onto $\mathcal { P }$ . To bypass this difficulty, we make the following observation based on Lagrangian duality.
103
+
104
+ Proposition 1. Suppose $\ell$ is bounded, and $p _ { \mathrm { e m p } }$ is not on the boundary of the simplex. Then, $\forall r > 0$ , $\exists \gamma ^ { * } > 0$ such that for every $\gamma _ { c } \geq \gamma ^ { * }$ , the constrained objective is solvable in unconstrained form:
105
+
106
+ $$
107
+ \operatorname * { a r g m a x } _ { \pi \in \Delta L , { \mathrm { \tiny ~ K L } } ( \pi , p _ { \mathrm { c m p } } ) \leq r } \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] = \operatorname * { a r g m a x } _ { \pi \in \Delta L } \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] + \operatorname* { m i n } \{ 0 , \gamma _ { c } ( r - \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \} .
108
+ $$
109
+
110
+ Motivated by this, we may thus transform the objective (3) into:
111
+
112
+ $$
113
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \pi \in \Delta ^ { L } } \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] + \operatorname* { m i n } \{ 0 , \gamma _ { c } ( r - \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \} ,
114
+ $$
115
+
116
+ where $\gamma _ { c } > 0$ is a sufficiently large constant; in practice, this may be chosen by a bisection search.
117
+ The advantage of this formulation is that it admits an efficient update for $\pi$ , as we now discuss.
118
+
119
+ # 3.3 ADVERSARIAL DISTRIBUTION UPDATES
120
+
121
+ We now detail how we can employ proximal mirror descent to efficiently update $\pi$ . Observe that we may decompose the adversary’s (negated) objective into two terms: $f ( \theta , \pi ) : = - \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ]$ and $h ( \pi ) : = \bar { \operatorname* { m a x } } \{ 0 , \gamma _ { c } ( \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ^ { } - r ) \}$ , where $h ( \pi )$ is independent of the samples. Such decomposable objectives suggest using proximal updates (Combettes & Pesquet, 2011):
122
+
123
+ $$
124
+ \pi _ { t + 1 } = \mathrm { p r o x } _ { \lambda h } ( \pi _ { t } - \lambda \nabla _ { \pi } f ( \theta _ { t } , \pi _ { t } ) ) : = \underset { \pi \in \Delta ^ { L } } { \mathrm { a r g m i n } } h ( \pi ) + \frac { 1 } { 2 \lambda } ( \| \pi _ { t } - \pi \| ^ { 2 } + 2 \lambda \langle \nabla _ { \pi } f ( \theta _ { t } , \pi _ { t } ) , \pi \rangle ) ,
125
+ $$
126
+
127
+ where $\lambda$ serves as the learning rate. The value of proximal descent relies on the ability to efficiently solve the minimisation problem in (5). Unfortunately, this does not hold as-is for our choice of $h ( \pi )$ , essentially due to a mismatch between the use of KL-divergence in $h$ , and Euclidean distance $\| \dot { \pi } _ { t } - \pi \| ^ { 2 }$ in (5). Motivated by the advantages of mirror descent over gradient descent on the simplex (Bubeck, 2014), we propose to replace the Euclidean distance with KL-divergence:
128
+
129
+ $$
130
+ \pi _ { t + 1 } = \operatorname * { a r g m i n } _ { \pi \in \Delta ^ { L } } h ( \pi ) + \frac { 1 } { 2 \lambda } ( \mathrm { K L } ( \pi , \pi _ { t } ) + 2 \lambda \langle g _ { t } , \pi \rangle ) ,
131
+ $$
132
+
133
+ where $g _ { t }$ is an unbiased estimator of $\nabla _ { \pi } f ( \theta _ { t } , \pi _ { t } )$ . We have the following closed-form update.
134
+
135
+ Lemma 2. Assume the optimal solution $\pi _ { t + 1 }$ to (6) satisfies $\mathrm { K L } ( \pi _ { t + 1 } , p _ { \mathrm { e m p } } ) \neq r$ , and that all the classes appeared at least once in the empirical distribution, i.e. $\forall i , p _ { \mathrm { e m p } } ^ { i } > 0$ . Let $\gamma = \gamma _ { c } i f r <$ $\mathrm { K L } ( \pi _ { t + 1 } , p _ { \mathrm { e m p } } )$ , and $\gamma = 0$ if $r > \mathrm { K L } ( \pi _ { t + 1 } , p _ { \mathrm { e m p } } )$ , then $\pi _ { t + 1 }$ permits a closed form solution
136
+
137
+ $$
138
+ \pi _ { t + 1 } = ( \pi _ { t } \odot p _ { \mathrm { e m p } } ^ { \alpha } ) ^ { 1 / ( 1 + \alpha ) } \exp { ( \eta _ { \pi } g _ { t } ) / C } ,
139
+ $$
140
+
141
+ where $\begin{array} { r } { \eta _ { \pi } = \frac { 1 } { ( \gamma + 1 / 2 \lambda ) ( 1 + \alpha ) } } \end{array}$ , $\alpha = 2 \gamma \lambda$ , $C = \| ( \pi _ { t } \odot p _ { \mathrm { e m p } } ^ { \alpha } ) ^ { 1 / ( 1 + \alpha ) } \exp \left( \eta _ { \pi } g _ { t } \right) \| _ { 1 }$ projects $\pi _ { t + 1 }$ onto the simplex, and $a \odot b$ is the element-wise product between two vectors $a , b$ .
142
+
143
+ In Algorithm 1, we set $\gamma = \gamma _ { c }$ if $r < \mathrm { K L } ( \pi _ { t } , p _ { \mathrm { e m p } } )$ and 0 otherwise to appoximate the true $\gamma$ . Such approximation works well when $r - \mathrm { K L } ( \pi _ { t } , p _ { \mathrm { e m p } } )$ does not change sign frequently.
144
+
145
+ # 3.4 CONVERGENCE ANALYSIS
146
+
147
+ We provide below a convergence analysis of our gradient descent-proximal mirror ascent method for nonconvex-concave stochastic saddle point problems. For the composite objective $\begin{array} { r } { \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \pi \in \Delta ^ { L } } f ( \theta , \pi ) + h ( \pi ) } \end{array}$ , and fixed learning rate $\eta _ { \theta }$ , we abstract the Algorithm 1 update as:
148
+
149
+ $$
150
+ \theta _ { t + 1 } = \theta _ { t } - \eta _ { \theta } g ( \theta _ { t } ) , \quad \pi _ { t + 1 } = \operatorname * { a r g m a x } _ { \pi } h ( \pi ) - \frac { 1 } { 2 \lambda } ( \mathrm { K L } ( \pi , \pi _ { t } ) + 2 \lambda \langle g ( \pi _ { t } ) , \pi \rangle ) ,
151
+ $$
152
+
153
+ where $g ( \pi ) , g ( \theta )$ are stochastic gradients assumed to satisfy the following.
154
+
155
+ Assumption 1. The stochastic gradient $g ( \theta )$ with respect to $\theta$ satisfies that for some $\sigma > 0$
156
+
157
+ $$
158
+ \begin{array} { r } { \mathbb { E } [ g ( \theta ) ] = \nabla _ { \theta } f ( \theta , \pi ) , \mathrm { ~ a n d ~ } \mathbb { E } [ \| g ( \theta ) - \mathbb { E } [ g ( \theta ) ] \| ^ { 2 } ] \le \sigma ^ { 2 } . } \end{array}
159
+ $$
160
+
161
+ Assumption 2. The stochastic gradient $g ( \pi )$ with respect to $\pi$ satisfies that for some $G > 0$ ,
162
+
163
+ $$
164
+ \begin{array} { r } { \mathbb { E } [ g ( \pi ) ] = \nabla _ { \pi } f ( \theta , \pi ) , \ \mathrm { a n d } \ \mathbb { E } [ \| g ( \pi ) \| _ { \infty } ^ { 2 } ] \leq G ^ { 2 } . } \end{array}
165
+ $$
166
+
167
+ We make the following assumptions about the objective, similar to Lin et al. (2019; 2020):
168
+
169
+ Assumption 3. $f ( \theta , \pi ) + h ( \pi )$ is $L -$ smooth and l−Lipschitz; $f ( \theta , \pi )$ and $h ( \pi )$ are concave in $\pi$ . Assumption 4. Every adversarial distribution iterate $\pi _ { t }$ satisfies $\mathrm { K L } ( \pi _ { t } , p _ { \mathrm { e m p } } ) \leq R$ for some $R > 0$
170
+
171
+ Assumption 3 and 4 may be enforced by adding a constant $\epsilon$ to the adversarial updates, which prevents $\pi _ { t }$ from approaching the boundary of the simplex. Assumption 2 in the label shift setting implies that the loss is upper and lower bounded. Such an assumption may be enforced by clipping the loss for computing the adversarial gradient, which can significantly speed up training (see Appendix ??). Furthermore, this is a standard assumption for analyzing nonconvex-concave problems (Lin et al., 2019). The assumption that the square $L _ { \infty }$ norm is bounded is weaker than $L _ { 2 }$ norm being bounded; such a relaxation results from using mirror rather than Euclidean update.
172
+
173
+ Given that the function $F ( \theta ) : = \operatorname* { m a x } _ { \pi \in \Delta } f ( \theta , \pi ) + h ( \pi )$ is nonconvex, our goal is to find a stationary point instead of approximating global optimum. Yet, due to the minimax formulation, the function $F ( \theta )$ may not necessarily be differentiable. Hence, we define convergence following some recent works (Davis & Drusvyatskiy, 2019; Lin et al., 2019; Thekumparampil et al., 2019) on nonconvexconcave optimisation. First, Assumption 3 implies $F ( \theta )$ is $L -$ weakly convex and $l$ -Lipschitz (Lin et al., 2019, Lemma 4.7). Hence, we define stationarity in the language of weakly convex functions.
174
+
175
+ Definition 1. A point $\theta$ is an $\epsilon -$ stationary point of a weakly convex function $F$ if $\| \nabla F _ { 1 / 2 L } ( \theta ) \| \le \epsilon .$ where $F _ { 1 / 2 L } ( \theta )$ denotes the Moreau envelope $\begin{array} { r } { F _ { 1 / 2 L } ( \theta ) = \mathrm { m i n } _ { w } F ( w ) + L \| w - \theta \| ^ { 2 } } \end{array}$ .
176
+
177
+ With the above definition, we can establish convergence of the following update:
178
+
179
+ Theorem 3 (informal). Under Assumptions 1–4, the update in (8) finds a point $\theta$ with $\mathbb { E } [ \| \nabla F _ { \frac { 1 } { 2 L } } ( \theta ) \| ] \le \epsilon$ in $\mathcal { O } ( \epsilon ^ { - 8 } )$ iterations.
180
+
181
+ For a precise description of the theorem, please see Appendix H. The above result matches the best known rate in Lin et al. (2019) for optimising nonconvex-concave problem with stochastic gradients. To our knowledge, this is the first result that studies convergence of composite objectives with proximal methods under nonconvex-concave settings. By utilizing the proximal operator, it solves the objective with an extra $h ( \pi )$ term without incurring additional complexity cost.
182
+
183
+ # .5 CLIPPING AND REGULARISING FOR FASTER CONVERGENCE
184
+
185
+ In addition to the proposed algorithm, we apply two additional techniques. We explain them here with motivations. First, we also observe that the adversarial’s update could be very sensitive to the adversarial gradient $g _ { k }$ , i.e. label-wise loss in each minibatch, because the gradient appears in the exponential of the update. To avoid convergence degradation resulted from the noise in $g _ { k }$ , we clip the label-wise loss at value 2. Second, we notice that the KL divergence from any interior point of a simplex to its boundary is infinity. Hence, updates near boundary can be highly unstable due to the nonsmooth KL loss. To cope with this, we add a constant $\epsilon$ term on the adversarial distribution to avoid the adversarial distribution reaching any of the vertices on the simplex. The $\epsilon$ term and clipping is critical in both training and convergence analysis. We conduct an ablation of the sensitivity to these parameters in Figures 5 and 6. Note that the experiments show that even without these tricks, our proposed algorithm alone still outperform baselines.
186
+
187
+ # 3.6 DISCUSSION AND COMPARISON TO EXISTING ALGORITHMS
188
+
189
+ A number of existing learning paradigms (e.g., fairness, adversarial training, and domain adaptation) have connections to the problem of adversarial label shift; see Appendix A for details.
190
+
191
+ We comment on some key differences between ADVSHIFT and related techniques in the literature. For the problem of minimising the worst-case loss (2) — which is equivalent to setting the radius $r = + \infty$ in (3) — Sagawa et al. (2020) propose an algorithm that assumes the ability to sample data from a given group in order to evaluate adversarial gradients. Such sampling is cumbersome to implement in most ImageNet data loading pipelines. Mohri et al. (2019) propose a way to evaluate gradients using importance sampling, and then apply projected gradient descent-ascent. This method suffers from instability owing to sampling (upon which we improve with proximal updates), and incurs a non-trivial computational overhead due to the projection step. We will illustrate these problems in our subsequent experiments (see results for AGNOSTIC in $\ S \ O $ ). Finally, for an uncertainty set $\mathcal { P }$ based on the CVaR, Curi et al. (2019) provide an algorithm that updates weights using EXP3. This approach relies on a determinantal point process, which has a poor dimension-dependence.
192
+
193
+ ![](images/bd060e946aeec34579e27012cc1429007d2e585fb4aa017b5179722123f08d23.jpg)
194
+ Figure 2: Comparison of performance on ImageNet under adversarial label distributions. For each method, we vary the KL divergence threshold $\tau$ , and for each $\tau$ report the maximal validation error induced by the adversarial shift within the threshold. Subplots (a) (b) compare the performance of ADVSHIFT trained with different DRO radius $r$ against the default ERM training. We subtract the baseline error of ERM from all values for easy visualization. Absolute values can be found in Figure 8 in the Appendix. Combined with (c), (d), we see that ADVSHIFT can reduce the adversarial validation error by over $\sim 2 . 5 \%$ compared to the BASELINE method and is consistently superior to the AGNOSTIC, BALANCED and FIXED methods. Figure 3(c) illustrates adversarial distributions for varying thresholds $\tau$ .
195
+
196
+ # 4 EXPERIMENTAL RESULTS
197
+
198
+ We now present a series of experiments to evaluate the performance of the proposed ADVSHIFT algorithm and how it compares to related approaches from the literature. We first explain our experiment setups and evaluation methods. We then present the results on ImageNet dataset, and show that under the adversarial validation setting, our proposed algorithm significantly outperforms other methods discussed in Table 1. Similar results on CIFAR-100 are shown in the Appendix.
199
+
200
+ # 4.1 EXPERIMENTAL SETUP
201
+
202
+ To evaluate the proposed method, we use the standard image classification setup of training a ResNet50 on ImageNet using SGD with momentum as the neural network optimiser. All algorithms are run for 90 epochs, and are found to take almost the same clock time. Note that ImageNet has a largely balanced training label distributions, and perfectly balanced validation label distributions.
203
+
204
+ We assess the performance of models under adversarial label shift as follows. First, we train a model on the training set and compute its error distribution on the validation set. Next, we pick a threshold $\tau$ on the allowable KL divergence between the train and target distribution and find the adversarial distribution within this threshold which achieves the worst-possible validation error. Finally, we compute the validation performance under this distribution. Note that $\tau = 0$ corresponds to the train distribution, while $\tau = + \infty$ corresponds to the worst-case label distribution (see Figure 1).
205
+
206
+ We evaluate the following methods, each corresponding to one row in Table 1: (i) standard empirical risk minimisation (BASELINE) (ii) balanced empirical risk minimisation (BALANCED) (iii) agnostic federated learning algorithm of Mohri et al. (2019), which minimises the worst-case loss (AGNOSTIC) (iv) our proposed KL-divergence based algorithm, for various choices of adversarial radius $r$ (ADVSHIFT) (v) training with ADVSHIFT with a fixed adversarial distribution extracted from Figure 3(c) (FIXED). This corresponds to the estimated test distribution row in Table 1 with an ideal estimator.
207
+
208
+ # 4.2 RESULTS AND DISCUSSION
209
+
210
+ Figure 2 shows the train and validation performance on ImageNet. Each curve represents the average and standard deviation across 10 independent trials. To better illustrate the differences amongst methods, we plot the difference in error to the BASELINE method. (See Figure 8 in the Appendix for unnormalised plots.) Subfigures (a) and (b) compre the performance of ADVSHIFT for various choices of radius $r$ to the ERM baseline; (c) and (d) compare ADVSHIFT to the remaining methods.
211
+
212
+ ![](images/d0972a62dbacdf91096b72ea52e590c9fde2b7d2c0a645535fd27ae0e3844d9a.jpg)
213
+
214
+ ![](images/a56805e8b54572eb762726077a3a6a6dd4345b75740409610bb307993378fbf2.jpg)
215
+ Figure 3: Subplots (a) (b) show violin plots of the distribution of errors for both the BASELINE and our ADVSHIFT methods over the course of training. On the training set, ADVSHIFT significantly reduces the worst-case error, evidenced by lower upper endpoints of the distribution. On the validation set, the reduction is consistent, albeit less pronounced owing to a generalisation gap. Subplot (c) illustrates adversarial distributions at KL distances of 1, 2 and 3 for model trained with BASELINE. Even at $\tau = 1$ , the adversarial distribution is highly concentrated on only a few hard labels.
216
+ Figure 4: Evolution of learned adversarial distribution $( \pi )$ across training epochs. Starting off from a uniform distribution over labels, the adversary quickly infers the relative difficulty of a small fraction of labels, assigning nearly $2 \times$ the weight on them compared to the average. This distribution remains largely stable in subsequent iterations, getting gradually more concentrated as training converges.
217
+
218
+ Hyperparameters for each method are separately tuned. FIXED 1, 2, 3 corresponds to training with each of the three adversarial distributions in Figure 3(c). We see that:
219
+
220
+ • the reduction offered by ADVSHIFT is consistently superior to that afforded by the AGNOSTIC, BALANCED and FIXED methods. On the training set, we observe significant $( \sim 8 \%$ ) reduction in performance for large KL divergence thresholds. On the validation set, the gains are less pronounced $( \sim 2 . 5 \% )$ , indicating some degradation due to a generalisation gap. while ADVSHIFT consistently improves above the baseline across adversarial radii, we observe best performance for $r = 0 . 1$ . Smaller values of $r$ lead to smaller improvements, while training becomes increasingly unstable for larger radii. Please see the discussion in the last section. • during training, AGNOSTIC either learns the adversarial distribution too slowly (such that it behaves like ERM), or uses too large a learning rate for the adversary (such that the training fails). This highlights the importance of the proximal mirror ascent updates in our algorithm.
221
+
222
+ Illustration of distributions at fixed KL thresholds. Figure 3(c) visualises the adversarial distributions corresponding to a few values of the KL threshold $\tau$ . At a threshold of $\tau = 3$ , the adversarial distribution is concentrated on only a few hard labels. Consequently, the resulting performance on such distributions is highly reflective of the worst-case distribution that can happen in reality.
223
+
224
+ Training with a fixed adversarial distribution. Suppose we take the final adversarial distributions shown in Figure 3(c), and then employ them as fixed distributions during training; this corresponds to the specified a-priori and estimated validation distribution approaches in Table 1. Does the resulting model similarly reduce the error on hard classes? Surprisingly, Figure 2(d) indicates this is not so, and performance is in fact significantly worse on the “easy” classes. Employing a fixed adversarial distribution may thus lead to underfitting, which has an intuitive explanation: the model must struggle to fit difficult patterns from early stages of training. Similar issues with importance weighting in conjunction with neural networks have been reported in Byrd & Lipton (2019).
225
+
226
+ Evolution of error distributions. To dissect the evolution of performance during training, Figure 3 shows violin plots of the distribution of errors for both the BASELINE and our ADVSHIFT methods after fixed training epochs. We observe that on the training set, ADVSHIFT significantly reduces the worst-case error, evidenced by the upper endpoints of the distribution being reduced. Note also that, as expected, the adversarial algorithm is slower to reduce the error on the “easy” classes early in training, evidenced by the lower endpoints of the distribution initially taking higher values. On the validation set, the reduction is consistent, albeit less pronounced owing to a generalisation gap.
227
+
228
+ ![](images/ba926640db87c4f5979005fe8e78d890cc4d046b35521466d363ad71385950ae.jpg)
229
+ Figure 5: Ablation of loss clipping threshold. We see that when the clipping threshold is either too large or too small, validation performance of the model tends to suffer.
230
+
231
+ ![](images/a31cf2fa1f54c02267afad99f761807a44b9c79901c8f5cbae7de4fe0f119724.jpg)
232
+ Figure 6: Ablation of gradient stabilisation parameter $\epsilon$ , which is a constant added to the gradient updates to prevent iterates from reaching the vertices of the simplex. We see that without any gradient stabilisation, the model’s performance rapidly degrades as the adversarial radius increases. Conversely, performance also suffers when the stablisation is too high.
233
+
234
+ Evolution of learned adversarial weights. To understand the evolution of the adversarial distribution across training epochs, Figure 4 plots the histogram of adversary weights at fixed training epochs. Starting off from a uniform distribution, the adversary is seen to quickly infer the relative difficulty of a small fraction of labels, assigning $\sim 2 \times$ the weight on them compared to the average. In subsequent iterations the distribution becomes more concentrated, and gradually reduces the largest weights.
235
+
236
+ # Ablation of clipping threshold and gradient stabiliser.
237
+
238
+ Figures 5 and 6 show an ablation of the choice of loss clipping threshold, and the gradient stabiliser . We see that when the clipping threshold is either too large or too small, validation performance of the model tends to suffer (albeit still better than the baseline). Similarly, we see that without any gradient stabilisation, the model’s performance rapidly degrades as the adversarial radius increases. Conversely, performance also suffers when the stablisation is too high.
239
+
240
+ In summary, our experiments show that our proposed DRO formulation can be effectively solved with ADVSHIFT, and results in a model that is robust to adversarial label shift.
241
+
242
+ # 5 DISCUSSION AND FUTURE WORK
243
+
244
+ We proposed ADVSHIFT, an algorithm for coping with label shift based on distributionally robust optimisation, and illustrated its effectiveness of real-world datasets. Despite this, our approach does not solve the problem fully. First, Figure 2(a)(b) shows that the generalization gap increases as the perturbation radius increases. Understanding why there is a correlation between hard examples and bad generalization could improve robustness. Second, Figure 2(a) shows that even on the train set, the algorithm threshold $r$ does not translate to the model’s level of robustness. We conjecture this results from the interplay of model expressivity and data distribution, whose future study is of interest.
245
+
246
+ # REFERENCES
247
+
248
+ Roc´ıo Alaiz-Rodr´ıguez, Alicia Guerrero-Curieses, and Jesus Cid-Sueiro. Minimax regret classifier ´ for imprecise class distributions. Journal of Machine Learning Research, 8:103–130, May 2007. ISSN 1532-4435.
249
+
250
+ Martin Arjovsky, Leon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization, ´ 2019.
251
+
252
+ Kamyar Azizzadenesheli, Anqi Liu, Fanny Yang, and Animashree Anandkumar. Regularized learning for domain adaptation under label shifts. In International Conference on Learning Representations, 2019.
253
+
254
+ Shai Ben-David, John Blitzer, Koby Crammer, and Fernando Pereira. Analysis of representations for domain adaptation. In Advances in neural information processing systems, pp. 137–144, 2007.
255
+
256
+ Sebastien Bubeck. Convex optimization: Algorithms and complexity, 2014. ´
257
+
258
+ Jonathon Byrd and Zachary Chase Lipton. What is the effect of importance weighting in deep learning? In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 872–881. PMLR, 2019.
259
+
260
+ Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Arechiga, and Tengyu Ma. Learning imbalanced datasets with label-distribution-aware margin loss. In Advances in Neural Information Processing Systems, 2019.
261
+
262
+ Remi Tachet des Combes, Han Zhao, Yu-Xiang Wang, and Geoff Gordon. Domain adaptation with conditional distribution matching and generalized label shift. arXiv preprint arXiv:2003.04475, 2020.
263
+
264
+ Patrick L Combettes and Jean-Christophe Pesquet. Proximal splitting methods in signal processing. In Fixed-point algorithms for inverse problems in science and engineering, pp. 185–212. Springer, 2011.
265
+
266
+ Yin Cui, Menglin Jia, Tsung-Yi Lin, Yang Song, and Serge Belongie. Class-balanced loss based on effective number of samples. In CVPR, 2019.
267
+
268
+ Sebastian Curi, Kfir. Y. Levy, Stefanie Jegelka, and Andreas Krause. Adaptive sampling for stochastic risk-averse learning, 2019.
269
+
270
+ M. A. Davenport, R. G. Baraniuk, and C. D. Scott. Tuning support vector machines for minimax and neyman-pearson classification. IEEE Transactions on Pattern Analysis and Machine Intelligence, 32(10):1888–1898, 2010.
271
+
272
+ Damek Davis and Dmitriy Drusvyatskiy. Stochastic model-based minimization of weakly convex functions. SIAM Journal on Optimization, 29(1):207–239, 2019.
273
+
274
+ Michele Donini, Luca Oneto, Shai Ben-David, John Shawe-Taylor, and Massimiliano Pontil. Empirical risk minimization under fairness constraints. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS’18, pp. 2796–2806, Red Hook, NY, USA, 2018. Curran Associates Inc.
275
+
276
+ Marthinus Christoffel du Plessis and Masashi Sugiyama. Semi-supervised learning of class balance under class-prior change by distribution matching. Neural Networks, 50:110–119, 2014.
277
+
278
+ J. Duchi and H. Namkoong. Learning models with uniform performance via distributionally robust optimization. arXiv preprint arXiv:1810.08750, 2018.
279
+
280
+ John Duchi, Tatsunori Hashimoto, and Hongseok Namkoong. Distributionally robust losses for latent covariate mixtures, 2020.
281
+
282
+ Charles Elkan. The foundations of cost-sensitive learning. In Proceedings of the 17th International Joint Conference on Artificial Intelligence - Volume 2, IJCAI’01, pp. 973–978, San Francisco, CA, USA, 2001. Morgan Kaufmann Publishers Inc. ISBN 1558608125.
283
+
284
+ Yanbo Fan, Siwei Lyu, Yiming Ying, and Baogang Hu. Learning with average top-k loss. In Advances in neural information processing systems, pp. 497–505, 2017.
285
+
286
+ Louis Faury, Ugo Tanielian, Elvis Dohmatob, Elena Smirnova, and Flavian Vasile. Distributionally robust counterfactual risk minimization. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 3850–3857, 2020.
287
+
288
+ Saurabh Garg, Yifan Wu, Sivaraman Balakrishnan, and Zachary C. Lipton. A unified view of label shift estimation, 2020.
289
+
290
+ Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial nets. In Zoubin Ghahramani, Max Welling, Corinna Cortes, Neil D. Lawrence, and Kilian Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pp. 2672–2680, 2014.
291
+
292
+ Jiaxian Guo, Mingming Gong, Tongliang Liu, Kun Zhang, and Dacheng Tao. Ltf: A label transformation framework for correcting label shift. In International Conference on Machine Learning, pp. 3843–3853. PMLR, 2020.
293
+
294
+ Tatsunori Hashimoto, Megha Srivastava, Hongseok Namkoong, and Percy Liang. Fairness without demographics in repeated loss minimization. In Jennifer Dy and Andreas Krause (eds.), International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 1929–1938, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. PMLR. ¨
295
+
296
+ Haibo He and Edwardo A. Garcia. Learning from imbalanced data. IEEE Transactions on Knowledge and Data Engineering, 21(9):1263–1284, 2009.
297
+
298
+ Weihua Hu, Gang Niu, Issei Sato, and Masashi Sugiyama. Does distributionally robust supervised learning give robust classifiers? In Jennifer G. Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, ¨ Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learning Research, pp. 2034–2042. PMLR, 2018.
299
+
300
+ Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. In Eighth International Conference on Learning Representations (ICLR), 2020.
301
+
302
+ Wouter M. Kouw and Marco Loog. An introduction to domain adaptation and transfer learning. CoRR, abs/1812.11806, 2018. URL http://arxiv.org/abs/1812.11806.
303
+
304
+ Daniel Levy, Yair Carmon, John C Duchi, and Aaron Sidford. Large-scale methods for distributionally robust optimization. Advances in Neural Information Processing Systems, 33, 2020.
305
+
306
+ Tianyi Lin, Chi Jin, and Michael I. Jordan. On gradient descent ascent for nonconvex-concave minimax problems, 2019.
307
+
308
+ Tianyi Lin, Chi Jin, and Michael. I. Jordan. Near-optimal algorithms for minimax optimization, 2020.
309
+
310
+ Zachary Lipton, Yu-Xiang Wang, and Alexander Smola. Detecting and correcting for label shift with black box predictors. In Jennifer Dy and Andreas Krause (eds.), International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 3122–3130, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. PMLR. ¨
311
+
312
+ Mehryar Mohri, Gary Sivek, and Ananda Theertha Suresh. Agnostic federated learning. In International Conference on Machine Learning, 2019.
313
+
314
+ Krikamol Muandet, David Balduzzi, and Bernhard Scholkopf. Domain generalization via invariant ¨ feature representation. In Sanjoy Dasgupta and David McAllester (eds.), International Conference on Machine Learning, Proceedings of Machine Learning Research, pp. 10–18, Atlanta, Georgia, USA, 17–19 Jun 2013. PMLR.
315
+
316
+ H. Namkoong and J. Duchi. Stochastic gradient methods for distributionally robust optimization with f-divergences. In Advances in Neural Information Processing Systems (NeurIPS), 2016.
317
+
318
+ Hongseok Namkoong and John C Duchi. Variance-based regularization with convex objectives. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 2971–2980. Curran Associates, Inc., 2017.
319
+
320
+ Hamed Rahimian and Sanjay Mehrotra. Distributionally robust optimization: A review, 2019.
321
+
322
+ Marco Saerens, Patrice Latinne, and Christine Decaestecker. Adjusting the outputs of a classifier to new a priori probabilities: A simple procedure. Neural Computation, 14(1):21–41, 2002.
323
+
324
+ S. Sagawa, P. W. Koh, T. B. Hashimoto, and P. Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. In International Conference on Learning Representations (ICLR), 2020.
325
+
326
+ Alexander Shapiro, Darinka Dentcheva, and Andrzej Ruszczynski. ´ Lectures on Stochastic Programming: Modeling and Theory, Second Edition. Society for Industrial and Applied Mathematics, Philadelphia, PA, 2014. doi: 10.1137/1.9781611973433.
327
+
328
+ Aman Sinha, Hongseok Namkoong, and John Duchi. Certifying some distributional robustness with principled adversarial training. arXiv preprint arXiv:1710.10571, 2017.
329
+
330
+ Aman Sinha, Hongseok Namkoong, and John Duchi. Certifiable distributional robustness with principled adversarial training. In International Conference on Learning Representations, 2018.
331
+
332
+ Amos J Storkey and Masashi Sugiyama. Mixture regression for covariate shift. In B. Scholkopf,¨ J. C. Platt, and T. Hoffman (eds.), Advances in Neural Information Processing Systems 19, pp. 1337–1344. MIT Press, 2007.
333
+
334
+ Kiran Koshy Thekumparampil, Prateek Jain, Praneeth Netrapalli, and Sewoong Oh. Efficient algorithms for smooth minimax optimization, 2019.
335
+
336
+ Robert C. Williamson and Aditya Krishna Menon. Fairness risk measures. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pp. 6786–6797, 2019.
337
+
338
+ Yu Xie and Charles F. Manski. The logit model and response-based samples. Sociological Methods & Research, 17(3):283–302, 1989.
339
+
340
+ Muhammad Bilal Zafar, Isabel Valera, Manuel Gomez Rodriguez, and Krishna P. Gummadi. Fairness beyond disparate treatment & disparate impact: Learning classification without disparate mistreatment. In Proceedings of the 26th International Conference on World Wide Web, WWW ’17, pp. 1171–1180, Republic and Canton of Geneva, CHE, 2017. International World Wide Web Conferences Steering Committee. ISBN 9781450349130.
341
+
342
+ Kun Zhang, Bernhard Scholkopf, Krikamol Muandet, and Zhikun Wang. Domain adaptation under ¨ target and conditional shift. In Proceedings of the 30th International Conference on International Conference on Machine Learning - Volume 28, ICML’13, pp. III–819–III–827. JMLR.org, 2013.
343
+
344
+ # A RELATED PROBLEMS
345
+
346
+ Example-level DRO. Existing work on DRO has largely focussed on the setting where $\mathcal { P }$ encompasses shifts in the instance space (Namkoong & Duchi, 2016; 2017; Sinha et al., 2018; Duchi & Namkoong, 2018; Levy et al., 2020). This notion of robustness has a natural link with adversarial training (Sinha et al., 2017), and involves a more challenging problem, as it requires parameterising the adversary’s distribution. Hu et al. (2018) illustrate the potential pitfalls of DRO, owing to a mismatch between surrogate and 0-1 losses. They also propose to encode an uncertainty set based on latent label distribution shift (Storkey & Sugiyama, 2007), which requires domain knowledge. The techniques in example-level DRO are mostly designed for small scale dataset with SVM models, as these techniques require sampling according to adversarial distribution, which can be very unstable if implemented with importance sampling only. It also requires maintaining a vector proportional to the number of labels and indexing each sample during training to match up the sample index, which is not available in most dataloading pipelines.
347
+
348
+ Fairness. Adversarial label shift may be related to algorithmic fairness. Abstractly, this concerns the mitigation of systematic bias in predictions on sensitive subgroups (e.g., country of origin). One fairness criteria posits that the per-subgroup errors should be equal (Zafar et al., 2017; Donini et al., 2018), an ideal that may be targetted by minimising the worst-subgroup error (Mohri et al., 2019; Sagawa et al., 2020). When the subgroups correspond to labels, ensuring this notion of fairness is tantamount to guarding against an adversary that can place all mass on the worst performing label.
349
+
350
+ GANs. GANs (Goodfellow et al., 2014) involve solving a min-max objective that bears some similarity to the DRO formulation (3), but is fundamentally different in details: while DRO considers reweighting of samples according to a fixed family, GANs involve a parameterised adversarial family, with the training objective augmented with an additional penalty.
351
+
352
+ Domain adaptation. Label shift can be viewed as a special case of domain adaptation, where $p _ { \mathrm { t r } }$ and $p _ { \mathrm { t e } }$ can systematically differ. Typically, one assumes access to a small sample from $p _ { \mathrm { t e } }$ , which may be used to estimate importance weights (Combes et al., 2020), or samples from multiple domains, which may be used to estimate a generic domain-agnostic representation (Muandet et al., 2013). In causal inference, there has been interest in similar classes of models (Arjovsky et al., 2019).
353
+
354
+ # B ALGORITHM IMPLEMENTATION DETAILS
355
+
356
+ We introduce some additional details in our implementation of ADVSHIFT. First, as observed in Section 3.1, our algorithm requires knowing the empirical label distribution. As the exact value is not always available, we estimate the empirical label distribution online for all the experiments presented later in Section 4 using an exponential moving average, $p _ { \mathrm { e m p } } = \beta \cdot p _ { \mathrm { e m p } } + ( 1 - \beta ) \cdot p _ { \mathrm { b a t c h } }$ , where $p _ { \mathrm { b a t c h } }$ is the label distribution in the minibatch. We set $\beta = 0 . 9 9 9$ . The number is set such that the exponential moving average has a half-life roughly equal to the number of iterations in one epoch of ImageNet training using our setup.
357
+
358
+ In all the experiments, we set $2 \gamma _ { c } \lambda = 1$ in Algorithm 1 for simplicity. For learning the adversarial distribution, we only tune the adversarial learning rate $\eta _ { \pi }$ .
359
+
360
+ # C ADDITIONAL EXPERIMENTAL RESULTS
361
+
362
+ We present here additional experimental results, including:
363
+
364
+ • for ImageNet, an illustration of the lack of correlation between a label’s frequency in the training set, and its validation error. (Figure 7) unnormalised versions of the results on ImageNet shown in the body, where we do not subtract the baseline performance from each of the curves; this gives a sense of the absolute performance numbers obtained by each method. (Figure 8)
365
+ • an ablation of the loss clipping threshold and gradient stabiliser $\epsilon$ as introduced above. (Figure 5,6)
366
+ • results on CIFAR-100, to complement those for ImageNet. (Figure 9,10)
367
+
368
+ ![](images/a520e8b289893455646126cfd5ca63e844157e7dcdaa15105a6be6f5a79a7806.jpg)
369
+ Figure 7: Illustration that training label frequency does not strongly correlate with test error. Observe that several classes with a high error appear frequently in the training set.
370
+
371
+ ![](images/86d4b0e48f8565e0e2549c4dc207d0b33c9bd820cd3d5fcc24e8241af0af2c6e.jpg)
372
+ Figure 8: Comparison of performance of various methods on ImageNet under adversarial label distributions. For each plot, we vary a KL divergence threshold $\tau$ , and for a given $\tau$ construct the label distribution which results in maximal test error for the baseline model. We then compute the test error under this distribution. Note that the case $\tau = 0$ corresponds to using the train distribution, while $\tau = + \infty$ corresponds to using the worst-case label distribution, which is concentrated on the worst-performing label. Our proposed ADVSHIFT can reduce the adversarial test error by over $\sim 2 . 5 \%$ over the baseline method.
373
+
374
+ # C.1 BALANCED LABELS $\nRightarrow$ BALANCED PERFORMANCE
375
+
376
+ Figure 7 shows that training label frequency does not strongly correlate with test error. Observe that several classes with a high error appear frequently in the training set. Indeed, the three classes with highest error – casette player, maillot, and water jug – all appear an equal number of times in the training set.
377
+
378
+ # C.2 UNNORMALISED PLOTS ON IMAGENET
379
+
380
+ Figure 8 presents plots of the unnormalised performance of the various methods compared in the body. Here, rather than subtract the performance of the baseline, we show the absolute accuracy of each method as the adversarial radius is varied. Evidently, the baseline and AGNOSTIC models tend to suffer in their validation error as the adversarial radius increases.
381
+
382
+ # C.3 RESULTS ON CIFAR-100
383
+
384
+ Figure 9 shows results on CIFAR-100, where we train various methods using a CIFAR-ResNet-18 as the underlying architecture, Here, we see a consistent and sizable improvement from ADVSHIFT over the baseline method. On this dataset, AGNOSTIC fares better, and eventually matches the performance of ADVSHIFT with a large adversarial radius. This is in keeping with the intended use-case of AGNOSTIC, i.e., minimising the worst-case loss. Figure 10 supplements these plots with unnormalised versions, to illustrate the absolute performance differences.
385
+
386
+ ![](images/0a7a04ccdfa5ecafabe929e79af042a313f6ca9119019b280e522edc085aa52f.jpg)
387
+ Figure 9: Comparison of performance of various methods on CIFAR-100.
388
+
389
+ ![](images/fec85174177b8c4435ef89c5a745fdb755c48cbee98c794a89b21e8bb1b3a962.jpg)
390
+ Figure 10: Comparison of performance of various methods on CIFAR-100 (unnormalised).
391
+
392
+ We remark here that the choice of a CIFAR-ResNet-18 results in an underparameterised model, which does not perfectly fit the training data. In the overparameterised case, there are challenges with employing DRO, as noted by Sagawa et al. (2020). Addressing these challenges in settings where the training data is balanced remains an interesting open question.
393
+
394
+ # D CONSTRAINED DRO DOES NOT PERMIT A BOLTZMAN SOLUTION
395
+
396
+ We start with a simple example with three label classes $\{ a , b , c \}$ with class losses $l = \{ 1 , 2 , 4 \}$ respectively. We assume an uniform empirical distribution, i.e. $p _ { \mathrm { e m p } } = \{ 1 / 3 , 1 / 3 , 1 / \bar { 3 } \}$ . We consider two different problems. The first is to find the optimal solution to regularised objective,
397
+
398
+ $$
399
+ \begin{array} { r } { p = \mathrm { a r g m i n } _ { p } p ^ { \top } l + \gamma \mathrm { K L } ( p , p _ { \mathrm { e m p } } ) . } \end{array}
400
+ $$
401
+
402
+ This problem is well known (e.g. see 2.7.2 of lecture ) to permit a solution of form $p ( x ) \ =$ P exp lx/tx0∈{a,b,c} exp l0x/t for some t.
403
+
404
+ In contrast, we show that distributions of the above form does not solve the constrained version of the problem. In particular, we consider the following optimisation problem:
405
+
406
+ $$
407
+ \operatorname* { m a x } _ { \boldsymbol { p } } p ^ { \intercal } l
408
+ $$
409
+
410
+ If the solution is of form $\begin{array} { r } { p ( x ) = \frac { \exp { l _ { x } / t } } { \sum _ { x ^ { \prime } \in \{ a , b , c \} } { \exp { l _ { x } ^ { \prime } / t } } } } \end{array}$ , then we know for ${ \mathit { l } } _ { b } \neq { \mathit { l } } _ { c }$
411
+
412
+ $$
413
+ ( \log ( p _ { a } ) - \log ( p _ { c } ) ) / ( \log ( p _ { b } ) - \log ( p _ { c } ) ) = ( l _ { a } - l _ { c } ) / ( l _ { b } - l _ { c } ) .
414
+ $$
415
+
416
+ We solve the above problem with a convex optimizer using $r = 0 . 0 1$ and found $p _ { a } = 0 . 2 8 3 , p _ { b } =$ $0 . 3 2 2 , p _ { c } = 0 . 3 9 5$ .
417
+
418
+ $$
419
+ ( \log ( p _ { a } ) - \log ( p _ { c } ) ) / ( \log ( p _ { b } ) - \log ( p _ { c } ) ) = 1 . 6 4 \neq ( l _ { a } - l _ { c } ) / ( l _ { b } - l _ { c } ) = 1 . 5 .
420
+ $$
421
+
422
+ Note that the above example shows that not all solutions of the contrained problem can be written a Boltzman distribution, i.e. $\begin{array} { r } { p ( x ) = \frac { \exp { l _ { x } / t } } { \sum _ { x ^ { \prime } \in \{ a , b , c \} } { \exp { l _ { x } ^ { \prime } / t } } } } \end{array}$ . Yet, this does not contradict with results
423
+
424
+ [e.g. Lemma 4, Faury et al. (2020)] that claim there is a Boltzman distribution whose function value matches the optimal value of the constraint problem. Mathematically, we can have $p \neq p ^ { \prime }$ but $\mathbb { E } _ { p } [ l ( x ) ] = \mathbb { E } _ { p ^ { \prime } } [ l ( x ) ]$ .
425
+
426
+ # E PROJECTING AN ADVERSARIAL DISTRIBUTION
427
+
428
+ The projection operator in our setting aims to project a distribution $p$ into the set ${ \mathcal { P } } = \{ q : \mathrm { K L } ( q , { \hat { p } } ) \leq$ $r \}$ by solving the following problem:
429
+
430
+ $$
431
+ \begin{array} { c } { \displaystyle \operatorname* { m i n } _ { { q } } \| q - p \| ^ { 2 } } \\ { \displaystyle } \\ { \mathrm { s u c h ~ t h a t ~ } \sum _ { i } q _ { i } \log ( q _ { i } / p _ { i } ) \leq r } \\ { \displaystyle \sum _ { i } q _ { i } = 1 , } \\ { \forall i , q _ { i } \geq 0 , } \end{array}
432
+ $$
433
+
434
+ where $q _ { i } , p _ { i }$ denotes the $i _ { t h }$ component of $q , p$ and $n$ denotes number of classes. Given that our implementation is based on Tensorflow, we use the “trust-region constrained algorithm” provided by SciPy for easy integration with our python-based training procedure. However, even after extensive tuning, solving each problem up to $1 \%$ relative constraint error requires more than 1 minute when $n = 1 0 0 0$ (the number of labels in ImageNet). This means that if we train ResNet50 on ImageNet for $1 0 0 \mathrm { k }$ iterations, we need to spend $1 0 0 k$ minutes on projection operation, which is not affordable.
435
+
436
+ # F PROOF OF PROPOSITION 1
437
+
438
+ Proof. We only need to show that for large enough $\gamma _ { c }$ , any minimiser $p ^ { * }$ of the unconstrained problem satisfies that $\mathrm { K L } ( p ^ { * } , p _ { \mathrm { e m p } } ) \leq r$ . Since the distance from boundary of the simplex to any interior point is $+ \infty$ , we can safely assume that the point lies within the relative interior of the simplex. To prove the proposition, denote $c = \operatorname* { i n f } \{ | | { \hat { \nabla } } _ { p } \mathrm { K L } ( p , p _ { \mathrm { e m p } } ) | | \mid p \in \Delta ^ { L } , s . t . \mathrm { K L } ( p , p _ { \mathrm { e m p } } ) { \stackrel { . } { > } } r \} \quad$ By strict convexity of KL divergence and the fact that $r \ > \ 0$ , we know $c > 0$ . Denote the upper bound of loss as $M$ , then when $\gamma _ { c } > M / c$ , we know that $\mathrm { K L } ( p , p _ { \mathrm { e m p } } ) > r \implies 0 \notin$ $\partial _ { \pi } ( \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] + \operatorname* { m i n } \{ 0 , \gamma _ { c } ( r - \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \} )$ . However, since $p$ minimises the objective if and only if $0 \in \partial _ { \pi } ( \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] + \operatorname* { m i n } \{ 0 , \gamma _ { c } ( r - \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \} )$ , we have that any minimiser $p$ must satisfy $\mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \leq r$ . □
439
+
440
+ # G PROOF OF LEMMA 2
441
+
442
+ Recall that we want to find $\pi _ { k + 1 }$ that minimises the following objective,
443
+
444
+ $$
445
+ \begin{array} { l } { \displaystyle \pi _ { k + 1 } = \underset { \pi \in \Delta } { \mathrm { a r g m i n } } h ( \pi ) + \frac { 1 } { 2 \lambda } ( \mathrm { K L } ( \pi , \pi _ { k } ) + 2 \lambda \langle g _ { k } , \pi \rangle ) } \\ { = \underset { \pi \in \Delta } { \mathrm { a r g m i n } } \operatorname* { m a x } \left\{ 0 , \frac { \alpha _ { c } } { 1 + \alpha _ { c } } \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) \right\} + \frac { 1 } { 1 + \alpha _ { c } } ( \mathrm { K L } ( \pi , \pi _ { k } ) - \eta \langle g _ { k } , \pi \rangle ) , } \end{array}
446
+ $$
447
+
448
+ where $\eta = 1 / ( 2 \gamma _ { c } + 1 / \lambda )$ , $\alpha _ { c } = 2 \gamma _ { c } \lambda$ . Denote $v ( i )$ as the $i _ { t h }$ component of vector $v$ . Notice that the simplex can be written as a constraint that $\begin{array} { r } { \sum _ { i } \pi ( i ) = 1 ; \forall i , \pi ( i ) \ge 0 } \end{array}$ . Based on this constraint, we first write (6)’s Lagrangian dual
449
+
450
+ $$
451
+ \begin{array} { r } { L ( { a } , { b } , \pi ) = \displaystyle \sum _ { i } ( a _ { i } \pi ( i ) ) + b ( \displaystyle \sum _ { i } \pi ( i ) - 1 ) + \operatorname* { m a x } \left\{ 0 , \frac { \alpha _ { c } } { 1 + \alpha _ { c } } ( \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) - r ) \right\} } \\ { + \frac { 1 } { 1 + \alpha _ { c } } ( \mathrm { K L } ( \pi , \pi _ { k } ) - \eta \langle { g } _ { k } , \pi \rangle ) } \end{array}
452
+ $$
453
+
454
+ where $\pi ( i )$ denotes the $i _ { t h }$ component of $\pi$ . If $\pi _ { k } > 0$ component-wise, then the optimal $\pi$ cannot lie on the boundary (i.e. $\forall i , \pi ( i ) > 0 \rangle$ , which results in $\mathrm { K L } ( \pi , \pi _ { k } ) = \infty$ . By Lagrangian duality and
455
+
456
+ complementary slackness, we know that for if $\mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) > r$
457
+
458
+ $$
459
+ 0 = { \frac { \partial } { \partial \pi ( i ) } } L ( a , b , \pi ) = b + { \frac { \alpha _ { c } } { 1 + \alpha _ { c } } } \log ( \pi ( i ) / p _ { \mathrm { e m p } } ( i ) ) + { \frac { 1 } { 1 + \alpha _ { c } } } \log ( \pi ( i ) / \pi _ { k } ( i ) ) - \eta g _ { k } ( i ) + 1 .
460
+ $$
461
+
462
+ On the other hand, if $\mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) < r$
463
+
464
+ $$
465
+ 0 = \frac { \partial } { \partial \pi ( i ) } L ( a , b , \pi ) = b + \frac { 1 } { 1 + \alpha _ { c } } \log ( \pi ( i ) / \pi _ { k } ( i ) ) - \eta g _ { k } ( i ) + 1 .
466
+ $$
467
+
468
+ We discuss the case when $\mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) < r$ , and the other case follows similarly. Rearrange the optimality condition of Lagrangian multiplier, we get
469
+
470
+ $$
471
+ \frac { \alpha } { 1 + \alpha } \log ( \pi ( i ) / p _ { \mathrm { e m p } } ( i ) ) + \frac { 1 } { 1 + \alpha _ { c } } \log ( \pi ( i ) / \pi _ { k } ( i ) ) - \eta g _ { k } ( i ) = - b - 1 .
472
+ $$
473
+
474
+ Since $b$ is a constant for all coordinates,
475
+
476
+ $$
477
+ \begin{array} { r } { \pi ( i ) \propto ( p _ { \mathrm { e m p } } ( i ) _ { c } ^ { \alpha } \pi _ { k } ( i ) ) ^ { 1 / ( 1 + \alpha _ { c } ) } \exp { ( \frac { \eta g _ { k } ( i ) } { 1 + \alpha _ { c } } ) } . } \end{array}
478
+ $$
479
+
480
+ The result follows by noting that $\begin{array} { r } { \sum _ { i } \pi ( i ) = 1 } \end{array}$ .
481
+
482
+ # H PROOF OF THEOREM 3
483
+
484
+ For completeness, we define several terms used in optimisation. A function $f ( \theta )$ is $l$ −Lipschitz if for all $\theta , \theta ^ { \prime }$ ,
485
+
486
+ $$
487
+ \begin{array} { r } { | f ( \theta ) - f ( \theta ^ { \prime } ) | \leq l \| \theta - \theta ^ { \prime } \| . } \end{array}
488
+ $$
489
+
490
+ A function $f ( \theta )$ is $L$ −smooth if for all $\theta , \theta ^ { \prime }$ ,
491
+
492
+ $$
493
+ \| \nabla f ( \theta ) - \nabla f ( \theta ^ { \prime } ) \| \leq L \| \theta - \theta ^ { \prime } \| .
494
+ $$
495
+
496
+ A function $f ( \theta )$ is $L -$ weakly convex if $\begin{array} { r } { f ( \theta ) + \frac { L } { 2 } \lVert \theta \rVert ^ { 2 } } \end{array}$ is convex.
497
+
498
+ Then we can state the formal theorem below.
499
+
500
+ Theorem 4 (formal version of Theorem 3). Under Assumptions 1–4, the update in (8) generates a sequence of points $\theta _ { 1 } , . . . , \theta _ { T }$ with the following property:
501
+
502
+ $$
503
+ \begin{array} { r l } & { \frac { 1 } { T } \displaystyle \sum _ { t } \mathbb { E } [ \| \nabla F _ { 1 / 2 L } ( \theta _ { t } ) \| ^ { 2 } ] \leq \frac { 1 } { T ^ { 1 / 4 } } \left( \frac { 2 } { L } ( F _ { 1 / 2 L } ( \theta _ { 0 } ) - F _ { 1 / 2 L } ^ { \ast } ) + 2 G + G ^ { 2 } + \frac { R } { 2 } + ( l ^ { 2 } + \sigma ^ { 2 } ) ^ { 1 / 2 } ) \right) } \\ & { \quad \quad \quad \quad \quad + ( h ^ { \ast } - h ( \pi _ { 0 } ) ) / T } \end{array}
504
+ $$
505
+
506
+ Proof. For convenience, denote $\Phi ( \theta , \pi ) = f ( \theta , \pi ) + h ( \pi ) , F ( \theta ) = \mathrm { m a x } _ { p } \Phi ( \theta , p )$ . We start by following the standard SGD proof. Denote $g _ { \theta }$ as the stochastic gradient evaluated at step $t - 1$ with respect to $\theta$ . Denote $\begin{array} { r } { \hat { \theta } = \mathrm { p r o x } _ { F / 2 L } ( \theta ) : = \arg \operatorname* { m i n } _ { w } \{ F ( w ) + 2 L \| w - \theta \| ^ { 2 } \} . } \end{array}$ . Conditioned on $\theta _ { t - 1 }$ , we have
507
+
508
+ $$
509
+ \begin{array} { r l } & { \mathbb { E } [ \| \hat { \theta } _ { t - 1 } - \theta _ { t } \| ^ { 2 } ] = \| \theta _ { t - 1 } - \hat { \theta } _ { t - 1 } \| ^ { 2 } + 2 \eta _ { \theta } \mathbb { E } [ \langle \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } , g _ { \theta } \rangle ] + \eta _ { \theta } ^ { 2 } \mathbb { E } [ \| g _ { \theta } \| ^ { 2 } ] } \\ & { \qquad \leq \| \theta _ { t - 1 } - \hat { \theta } _ { t - 1 } \| ^ { 2 } + 2 \eta _ { \theta } \langle \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } , \nabla _ { \theta } \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) \rangle + \eta _ { \theta } ^ { 2 } ( L ^ { 2 } + \sigma ^ { 2 } ) } \end{array}
510
+ $$
511
+
512
+ where the first equality follows by $\theta _ { t } = \theta _ { t - 1 } - \eta _ { \theta } \nabla _ { \theta } \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } )$ . Next, we observe that
513
+
514
+ $$
515
+ \begin{array} { r l r } { { \langle \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } , \nabla _ { \theta } \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) \rangle \leq \Phi ( \hat { \theta } _ { t - 1 } , \pi _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) + \frac { L } { 2 } \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } } } \\ & { } & \\ & { } & { \leq F ( \hat { \theta } _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) + \displaystyle \frac { L } { 2 } \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } } \\ & { } & \\ & { } & { \leq F ( \theta _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) - \displaystyle \frac { L } { 2 } \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } } \end{array}
516
+ $$
517
+
518
+ The first line follows by convexity and $L -$ smoothness. The second line by definition of $F$ . The third line by definition of $\hat { \theta }$ . Next, by definition of Moreau envelop,
519
+
520
+ $$
521
+ F _ { 1 / 2 L } ( \theta _ { t } ) \leq F ( \hat { \theta } _ { t - 1 } ) + L \Vert \hat { \theta } _ { t - 1 } - \theta _ { t } \Vert ^ { 2 }
522
+ $$
523
+
524
+ Take expectation on both sides and we get
525
+
526
+ $$
527
+ \begin{array} { r l } & { \cdots _ { \ell } \binom { n - 1 } { \ell - 1 } + \mathcal { L } [ L \| \hat { \theta } _ { t - 1 } - \theta _ { t } \| ^ { 2 } ] } \\ & { \leq F ( \hat { \theta } _ { t - 1 } ) + \mathbb { E } [ L \| \hat { \theta } _ { t - 1 } - \theta _ { t } \| ^ { 2 } ] } \\ & { = F ( \hat { \theta } _ { t - 1 } ) + L ( \| \theta _ { t - 1 } - \hat { \theta } _ { t - 1 } \| ^ { 2 } + 2 \eta _ { \theta } \langle \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } , \nabla _ { \theta } \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) \rangle + \eta _ { \theta } ^ { 2 } ( l ^ { 2 } + \sigma ^ { 2 } ) ) } \\ & { \leq F _ { 1 / 2 L } ( \theta _ { t - 1 } ) + 2 L \eta _ { \theta } ( \Phi ( \hat { \theta } _ { t - 1 } , \pi _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) - \displaystyle \frac { L } { 2 } \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } ) + L \eta _ { \theta } ^ { 2 } ( l ^ { 2 } + \sigma ^ { 2 } ) } \end{array}
528
+ $$
529
+
530
+ The second line substitutes in (9). The third line follows by convexity and $L -$ smoothness. Denote that $\Delta _ { t } : = F ( \hat { \theta } _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) \geq \Phi ( \hat { \theta } _ { t - 1 } , \pi _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } )$ . We can sum over $t$ and take expectation recursively to get,
531
+
532
+ $$
533
+ \begin{array} { r l r } { { \sum _ { t } \mathbb { E } [ \| \nabla F _ { 1 / 2 L } ( \theta _ { t } ) \| ^ { 2 } ] = 2 L \sum _ { t } \mathbb { E } [ \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } ] } } \\ & { } & { \leq \frac { 2 } { L \eta _ { \theta } } ( F _ { 1 / 2 L } ( \theta _ { 0 } ) - F _ { 1 / 2 L } ^ { * } ) + 4 \sum _ { t } \Delta _ { t } + T \eta _ { \theta } ( l ^ { 2 } + \sigma ^ { 2 } ) ) } \end{array}
534
+ $$
535
+
536
+ where $F _ { 1 / 2 L } ^ { * } = \operatorname* { m i n } _ { \theta } F _ { 1 / 2 L } ( \theta )$ . The first equality follows by the definition of Moreau envelope. The second inequality follows by rearranging (11).
537
+
538
+ Next, we aim to bound the accumulated error $\textstyle \sum _ { t } \Delta _ { t }$ .
539
+
540
+ Recall that the update for the $\pi$ is as follows for $\mathbb { E } [ g _ { \pi } ] = \nabla _ { \pi } f ( \theta , \pi )$ ,
541
+
542
+ $$
543
+ \begin{array} { r } { \pi _ { k + 1 } : = \operatorname * { a r g m i n } _ { \pi \in \Delta ^ { L } } \{ - 2 \lambda \langle g _ { \pi } , \pi \rangle - 2 \lambda h ( \pi ) + \mathrm { K L } ( \pi , \pi _ { k } ) \} } \end{array}
544
+ $$
545
+
546
+ Applying Lemma 5 with ${ \cal L } ( \pi ) = - 2 \lambda \langle g _ { \pi } , \pi \rangle + - 2 \lambda h ( \pi )$ , we get
547
+
548
+ $$
549
+ \begin{array} { r l } & { - h ( \pi ^ { * } ( \theta _ { s } ) ) - \langle g _ { \pi } , \pi ^ { * } ( \theta _ { s } ) \rangle + \mathrm { K L } ( \pi ^ { * } , \pi _ { k } ) } \\ & { \qquad \ge - \langle g _ { \pi } , \pi _ { k + 1 } \rangle - h ( \pi _ { k + 1 } ) + \mathrm { K L } ( \pi _ { k + 1 } , \pi _ { k } ) + \mathrm { K L } ( \pi ^ { * } , \pi _ { k + 1 } ) } \end{array}
550
+ $$
551
+
552
+ Rearrange and take expectation we get
553
+
554
+ $$
555
+ \begin{array} { r l } & { 2 \lambda ( \mathbb { E } [ \langle - g _ { \pi } , \pi _ { k } - \pi ^ { * } ( \theta _ { s } ) \rangle ] - \mathbb { E } [ h ( \pi _ { k + 1 } ) ] + \mathbb { E } [ h ( \pi ^ { * } ( \theta _ { s } ) ) ] ) } \\ & { \ \leq - \mathbb { E } [ \mathrm { K L } ( \pi _ { k + 1 } , \pi _ { k } ) ] + \mathrm { K L } ( \pi ^ { * } , \pi _ { k + 1 } ) - \mathrm { K L } ( \pi ^ { * } , \pi _ { k } ) + 2 \lambda ( \mathbb { E } [ \langle g _ { \pi } , \pi _ { k } - \pi _ { k + 1 } \rangle ] ) } \\ & { \ \leq - \mathbb { E } [ \mathrm { K L } ( \pi _ { k } , \pi ^ { * } ) ] + \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } , \pi _ { k + 1 } ) ] - \| \pi ^ { * } - \pi _ { k } \| _ { 1 } ^ { 2 } / 2 + 2 \lambda ^ { 2 } \mathbb { E } [ \| g _ { \pi } \| _ { \infty } ^ { 2 } ] + \| \pi ^ { * } - \pi _ { k } \| _ { 1 } ^ { 2 } / 2 } \end{array}
556
+ $$
557
+
558
+ The second inequality follows by the fact that $K L -$ divergence is strongly convex with respect to $L _ { 1 }$ norm and Cauchy-Schwartz inequality. We further observe that
559
+
560
+ $$
561
+ \begin{array} { r l } & { - \mathbb { E } [ \langle g _ { \pi } , \pi _ { k } - \pi ^ { * } ( \theta _ { s } ) \rangle ] = - \langle \nabla _ { \pi } f ( \theta _ { k } , \pi _ { k } ) , \pi _ { k } - \pi ^ { * } ( \theta _ { s } ) \rangle \geq - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { s } ) ) } \\ & { \quad \quad \quad \quad = - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { s } ) ) } \\ & { \quad \quad \quad \geq - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) + f ( \theta _ { s } , \pi ^ { * } ( \theta _ { k } ) ) } \\ & { \quad \quad \quad - f ( \theta _ { s } , \pi ^ { * } ( \theta _ { s } ) ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { s } ) ) } \\ & { \quad \quad \quad \geq - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - 2 l \| \theta _ { s } - \theta _ { k } \| } \end{array}
562
+ $$
563
+
564
+ The first inequality follows by concavity. The third line follows by $f ( \theta _ { s } , \pi ^ { * } ( \theta _ { k } ) ) \leq f ( \theta _ { s } , \pi ^ { * } ( \theta _ { s } ) )$ The last inequality follows by Lipschitzness. Similarly,
565
+
566
+ $$
567
+ - h ( \theta _ { k } , \pi _ { k } ) + h ( \theta _ { k } , \pi ^ { * } ( \theta _ { s } ) ) \geq - h ( \theta _ { k } , \pi _ { k } ) + h ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - 2 l \| \theta _ { s } - \theta _ { k } \|
568
+ $$
569
+
570
+ We can take iterative expectation and get sum over $k = s + 1 , . . . , s + B$ to get
571
+
572
+ $$
573
+ \begin{array} { r l r } { { \sum _ { k = s + 1 } ^ { s + B } \mathbb { E } [ - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - h ( \pi _ { k } ) + h ( \pi ^ { * } ( \theta _ { k } ) ) ] } } \\ & { } & \\ & { } & { \leq - h ( \pi _ { s } ) + \mathbb { E } [ h ( \pi _ { s + B } ) ] + 4 l \sum _ { k = s + 1 } ^ { s + B } \sum _ { j = s } ^ { k } \mathbb { E } [ \| \theta _ { j } - \theta _ { j + 1 } \| ] + \lambda B G ^ { 2 } } \\ & { } & \\ & { } & { \quad + \frac { 1 } { 2 \lambda } ( \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } ( \theta _ { s } ) , \pi _ { 0 } ) ] - \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } ( \theta _ { s } ) , \pi _ { s } ) ] ) } \end{array}
574
+ $$
575
+
576
+ Note that $\Delta _ { k } = - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - h ( \pi _ { k } ) + h ( \pi ^ { * } ( \theta _ { k } ) )$ , hence
577
+
578
+ $$
579
+ \begin{array} { r l r } { { \sum _ { k = s + 1 } ^ { s + B } \mathbb { E } [ \Delta _ { k } ] \le - h ( \pi _ { s } ) + \mathbb { E } [ h ( \pi _ { s + B } ) ] + 2 \eta _ { \theta } l B ^ { 2 } G + \lambda B G ^ { 2 } } } \\ & { } & { \quad + \displaystyle \frac { 1 } { 2 \lambda } ( \mathbb { E } [ { \mathrm { K L } } ( \pi ^ { \ast } ( \theta _ { s } ) , \pi _ { 0 } ) ] - \mathbb { E } [ { \mathrm { K L } } ( \pi ^ { \ast } ( \theta _ { s } ) , \pi _ { s } ) ] ) } \end{array}
580
+ $$
581
+
582
+ By further sum over all blocks and divide by total number of iterations $T$ , we get
583
+
584
+ $$
585
+ \begin{array} { r l r } { { \frac { 1 } { T } \sum _ { b = 1 } ^ { T / B } \sum _ { k = b s + 1 } ^ { s + B } \mathbb { E } [ \Delta _ { k } ] \le ( - h ( \pi _ { 0 } ) + \mathbb { E } [ h ( \pi _ { T } ) ] ) / T + 2 \eta _ { \theta } B G + \lambda G ^ { 2 } } } \\ & { } & { \quad \quad + \frac { 1 } { 2 \lambda B } ( \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } ( \theta _ { s } ) , \pi _ { 0 } ) ] - \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } ( \theta _ { s } ) , \pi _ { s } ) ] ) } \end{array}
586
+ $$
587
+
588
+ Substitute the above inequality into (12) and we get
589
+
590
+ $$
591
+ \begin{array} { r l } { \displaystyle \frac { 1 } { T } \sum _ { t } \mathbb { E } [ \| \nabla F _ { 1 / 2 L } ( \theta _ { t } ) \| ^ { 2 } ] \leq \frac { 2 } { T L \eta _ { \theta } } ( F _ { 1 / 2 L } ( \theta _ { 0 } ) - F _ { 1 / 2 L } ^ { \ast } ) + 4 ( - h ( \pi _ { 0 } ) + \mathbb { E } [ h ( \pi _ { T } ) ] ) / T + 2 \eta _ { \theta } B G + \lambda G } & { } \\ { + \displaystyle \frac { 1 } { 2 \lambda B } ( \mathbb { E } [ \mathrm { K L } ( \pi ^ { \ast } ( \theta _ { s } ) , \pi _ { 0 } ) ] - \mathbb { E } [ \mathrm { K L } ( \pi ^ { \ast } ( \theta _ { T } ) , \pi _ { T } ) ] ) + \eta _ { \theta } ( l ^ { 2 } + \sigma ^ { 2 } ) ^ { 1 / 2 } ) } & { } \end{array}
592
+ $$
593
+
594
+ If we set $\eta _ { \theta } = T ^ { - 3 / 4 } , B = T ^ { 1 / 2 } , \lambda = T ^ { - 1 / 4 }$ , then we see that
595
+
596
+ $$
597
+ \begin{array} { l } { \displaystyle \frac { 1 } { T } \sum _ { t } \mathbb { E } [ \| \nabla F _ { 1 / 2 L } ( \theta _ { t } ) \| ^ { 2 } ] \leq \frac { 1 } { T ^ { 1 / 4 } } \left( \frac { 2 } { L } ( F _ { 1 / 2 L } ( \theta _ { 0 } ) - F _ { 1 / 2 L } ^ { \ast } ) + 2 G + G ^ { 2 } + \frac { R } { 2 } + ( l ^ { 2 } + \sigma ^ { 2 } ) ^ { 1 / 2 } ) \right) } \\ { \displaystyle \qquad + ( - h ( \pi _ { 0 } ) + h ^ { \ast } ) / T } \end{array}
598
+ $$
599
+
600
+ Lemma 5. For any differentiable convex function $\begin{array} { r } { L , i f x ^ { * } = \operatorname * { a r g m i n } _ { x \in \Delta } \{ L ( x ) + \operatorname { K L } ( x , x _ { 0 } ) \} } \end{array}$ , then for any $x ^ { \prime } \in \Delta$ , we have
601
+
602
+ $$
603
+ \ell ( x ^ { \prime } ) + \mathrm { K L } ( x ^ { \prime } , x _ { 0 } ) \geq \ell ( x ^ { * } ) + \mathrm { K L } ( x ^ { * } , x _ { 0 } ) + \mathrm { K L } ( x ^ { \prime } , x ^ { * } ) .
604
+ $$
605
+
606
+ Proof. This Lemma is well-known, but we include a proof for completeness. By optimality of $x ^ { * }$ and convexity of $\Delta$ , we know that
607
+
608
+ $$
609
+ \langle \nabla \ell ( x ^ { * } ) + \nabla \phi ( x ^ { * } ) - \nabla \phi ( x _ { 0 } ) , x - x ^ { * } \rangle \geq 0 ,
610
+ $$
611
+
612
+ where $\begin{array} { r } { \phi ( x ) = \sum _ { i } x _ { i } \log ( x _ { i } ) } \end{array}$ , and the Bregman divergence defined according to $\phi$ is KL-divergence. Then
613
+
614
+ $$
615
+ \begin{array} { r l } & { \ell ( x ^ { \prime } ) \geq \ell ( x ^ { * } ) + \langle \nabla \ell ( x ^ { * } ) , x ^ { \prime } - x ^ { * } \rangle } \\ & { \qquad \geq \ell ( x ^ { * } ) + \langle \nabla \phi ( x _ { 0 } ) - \nabla \phi ( x ^ { * } ) , x - x ^ { * } \rangle } \\ & { = \ell ( x ^ { * } ) - \langle \nabla \phi ( x _ { 0 } ) , x ^ { * } - x _ { 0 } \rangle + \phi ( x ^ { * } ) - \phi ( x _ { 0 } ) } \\ & { \qquad + \left. \nabla \phi ( x _ { 0 } ) , x ^ { \prime } - x _ { 0 } \right. + \phi ( x ^ { \prime } ) - \phi ( x _ { 0 } ) - \langle \nabla \phi ( x ^ { * } ) , x ^ { \prime } - x ^ { * } \rangle + \phi ( x ^ { \prime } ) - \phi ( x ^ { * } ) } \\ & { = \ell ( x ^ { * } ) + \mathrm { K L } ( x ^ { * } , x _ { 0 } ) - \mathrm { K L } ( x ^ { \prime } , x _ { 0 } ) + \mathrm { K L } ( x ^ { \prime } , x ^ { * } ) } \end{array}
616
+ $$
parse/train/Drynvt7gg4L/Drynvt7gg4L.md ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADASPEECH: ADAPTIVE TEXT TO SPEECH FOR CUSTOM VOICE
2
+
3
+ Mingjian Chen∗, Xu Tan∗, Bohan Li, Yanqing Liu, Tao Qin, Sheng Zhao, Tie-Yan Liu
4
+ Microsoft Research Asia, Microsoft Azure Speech
5
+ {xuta,taoqin,szhao,tyliu}@microsoft.com
6
+
7
+ # ABSTRACT
8
+
9
+ Custom voice, a specific text to speech (TTS) service in commercial speech platforms, aims to adapt a source TTS model to synthesize personal voice for a target speaker using few speech from her/him. Custom voice presents two unique challenges for TTS adaptation: 1) to support diverse customers, the adaptation model needs to handle diverse acoustic conditions which could be very different from source speech data, and 2) to support a large number of customers, the adaptation parameters need to be small enough for each target speaker to reduce memory usage while maintaining high voice quality. In this work, we propose AdaSpeech, an adaptive TTS system for high-quality and efficient customization of new voices. We design several techniques in AdaSpeech to address the two challenges in custom voice: 1) To handle different acoustic conditions, we model the acoustic information in both utterance and phoneme level. Specifically, we use one acoustic encoder to extract an utterance-level vector and another one to extract a sequence of phoneme-level vectors from the target speech during pre-training and fine-tuning; in inference, we extract the utterance-level vector from a reference speech and use an acoustic predictor to predict the phonemelevel vectors. 2) To better trade off the adaptation parameters and voice quality, we introduce conditional layer normalization in the mel-spectrogram decoder of AdaSpeech, and fine-tune this part in addition to speaker embedding for adaptation. We pre-train the source TTS model on LibriTTS datasets and fine-tune it on VCTK and LJSpeech datasets (with different acoustic conditions from LibriTTS) with few adaptation data, e.g., 20 sentences, about 1 minute speech. Experiment results show that AdaSpeech achieves much better adaptation quality than baseline methods, with only about 5K specific parameters for each speaker, which demonstrates its effectiveness for custom voice. The audio samples are available at https://speechresearch.github.io/adaspeech/.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Text to speech (TTS) aims to synthesize natural and intelligible voice from text, and attracts a lot of interests in machine learning community (Arik et al., 2017; Wang et al., 2017; Gibiansky et al., 2017; Ping et al., 2018; Shen et al., 2018; Ren et al., 2019). TTS models can synthesize natural human voice when training with a large amount of high-quality and single-speaker recordings (Ito, 2017), and has been extended to multi-speaker scenarios (Gibiansky et al., 2017; Ping et al., 2018; Zen et al., 2019; Chen et al., 2020) using multi-speaker corpora (Panayotov et al., 2015; Veaux et al., 2016; Zen et al., 2019). However, these corpora contain a fixed set of speakers where each speaker still has a certain amount of speech data.
14
+
15
+ Nowadays, custom voice has attracted increasing interests in different application scenarios such as personal assistant, news broadcast and audio navigation, and has been widely supported in commercial speech platforms (some custom voice services include Microsoft Azure, Amazon AWS and Google Cloud). In custom voice, a source TTS model is usually adapted on personalized voices with few adaptation data, since the users of custom voice prefer to record as few adaptation data as possible (several minutes or seconds) for convenient purpose. Few adaptation data presents great challenges on the naturalness and similarity of adapted voice. Furthermore, there are also several distinctive challenges in custom voice: 1) The recordings of the custom users are usually of different acoustic conditions from the source speech data (the data to train the source TTS model). For example, the adaptation data is usually recorded with diverse speaking prosodies, styles, emotions, accents and recording environments. The mismatch in these acoustic conditions makes the source model difficult to generalize and leads to poor adaptation quality. 2) When adapting the source TTS model to a new voice, there is a trade-off between the fine-tuning parameters and voice quality. Generally speaking, more adaptation parameters will usually result in better voice quality, which, as a result, increases the memory storage and serving cost1.
16
+
17
+ While previous works in TTS adaptation have well considered the few adaptation data setting in custom voice, they have not fully addressed the above challenges. They fine-tune the whole model (Chen et al., 2018; Kons et al., 2019) or decoder part (Moss et al., 2020; Zhang et al., 2020), achieving good quality but causing too many adaptation parameters. Reducing the amount of adaptation parameters is necessary for the deployment of commercialized custom voice. Otherwise, the memory storage would explode as the increase of users. Some works only fine-tune the speaker embedding (Arik et al., 2018; Chen et al., 2018), or train a speaker encoder module (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020; Li et al., 2017; Wan et al., 2018) that does not need fine-tuning during adaptation. While these approaches lead a light-weight and efficient adaptation, they result in poor adaptation quality. Moreover, most previous works assume the source speech data and adaptation data are in the same domain and do not consider the setting with different acoustic conditions, which is not practical in custom voice scenarios.
18
+
19
+ In this paper, we propose AdaSpeech, an adaptive TTS model for high-quality and efficient customization of new voice. AdaSpeech employ a three-stage pipeline for custom voice: 1) pre-training; 2) fine-tuning; 3) inference. During the pre-training stage, the TTS model is trained on large-scale multi-speaker datasets, which can ensure the TTS model to cover diverse text and speaking voices that is helpful for adaptation. During the fine-tuning stage, the source TTS model is adapted on a new voice by fine-tuning (a part of) the model parameters on the limited adaptation data with diverse acoustic conditions. During the inference stage, both the unadapted part (parameters shared by all custom voices) and the adapted part (each custom voice has specific adapted parameters) of the TTS model are used for the inference request. We build AdaSpeech based on the popular non-autoregressive TTS models (Ren et al., 2019; Peng et al., 2020; Kim et al., 2020; Ren et al., 2021) and further design several techniques to address the challenges in custom voice:
20
+
21
+ • Acoustic condition modeling. In order to handle different acoustic conditions for adaptation, we model the acoustic conditions in both utterance and phoneme level in pre-training and fine-tuning. Specifically, we use two acoustic encoders to extract an utterance-level vector and a sequence of phoneme-level vectors from the target speech, which are taken as the input of the mel-spectrogram decoder to represent the global and local acoustic conditions respectively. In this way, the decoder can predict speech in different acoustic conditions based on these acoustic information. Otherwise, the model would memorize the acoustic conditions and cannot generalize well. In inference, we extract the utterance-level vector from a reference speech and use another acoustic predictor that is built upon the phoneme encoder to predict the phoneme-level vectors.
22
+
23
+ • Conditional layer normalization. To fine-tune as small amount of parameters as possible while ensuring the adaptation quality, we modify the layer normalization (Ba et al., 2016) in the melspectrogram decoder in pre-training, by using speaker embedding as the conditional information to generate the scale and bias vector in layer normalization. In fine-tuning, we only adapt the parameters related to the conditional layer normalization. In this way, we can greatly reduce adaptation parameters and thus memory storage2 compared with fine-tuning the whole model, but maintain high-quality adaptation voice thanks to the flexibility of conditional layer normalization.
24
+
25
+ To evaluate the effectiveness of our proposed AdaSpeech for custom voice, we conduct experiments to train the TTS model on LibriTTS datasets and adapt the model on VCTK and LJSpeech datasets with different adaptation settings. Experiment results show that AdaSpeech achieves better adaptation quality in terms of MOS (mean opinion score) and SMOS (similarity MOS) than baseline methods, with
26
+
27
+ only about 5K specific parameters for each speaker, demonstrating its effectiveness for custom voice.
28
+ Audio samples are available at https://speechresearch.github.io/adaspeech/.
29
+
30
+ # 2 ADASPEECH
31
+
32
+ In this section, we first describe the overall design of our proposed AdaSpeech, and then introduce the key techniques to address the challenges in custom voice. At last, we list the pre-training, finetuning and inference pipeline of AdaSpeech for custom voice.
33
+
34
+ The model structure of AdaSpeech is shown in Figure 1. We adopt FastSpeech 2 (Ren et al., 2021) as the model backbone considering the FastSpeech (Ren et al., 2019; 2021) series are one of the most popular models in non-autoregressive TTS. The basic model backbone consists of a phoneme encoder, a mel-spectrogram decoder, and a variance adaptor which provides variance information including duration, pitch and energy into the phoneme hidden sequence following Ren et al. (2021). As shown in Figure 1, we design two additional components to address the distinctive challenges in custom voice: 1) to support diverse customers, we use acoustic condition modeling to capture the diverse acoustic conditions of adaptation speech in different granularities; 2) to support a large number of customers with affordable memory storage, we use conditional layer normalization in decoder for efficient adaptation with few parameters while high voice quality. In the next subsections, we introduce the details of these components respectively.
35
+
36
+ # 2.1 ACOUSTIC CONDITION MODELING
37
+
38
+ In custom voice, the adaptation data can be spoken with diverse prosodies, styles, accents, and can be recorded under various environments, which can make the acoustic conditions far different from that in source speech data. This presents great challenges to adapt the source TTS model, since the source speech cannot cover all the acoustic conditions in custom voice. A practical way to alleviate this issue is to improve the adaptability (generalizability) of source TTS model. In text to speech, since the input text lacks enough acoustic conditions (such as speaker timbre, prosody and recording environments) to predict the target speech, the model tends to memorize and overfit on the training data (Ren et al., 2021), and has poor generalization during adaptation. A natural way to solve such problem is to provide corresponding acoustic conditions as input to make the model learn reasonable text-to-speech mapping towards better generalization instead of memorizing.
39
+
40
+ ![](images/b16230a0b3471c9cf7166d42bf87e2d4d83fb2c8fad20fc0c5c9c58c2c644de2.jpg)
41
+ Figure 1: AdaSpeech.
42
+
43
+ To better model the acoustic conditions with different granularities, we categorize the acoustic conditions in different levels as shown in Figure 2a: 1) speaker level, the coarse-grained acoustic conditions to capture the overall characteristics of a speaker; 2) utterance level, the fine-grained acoustic conditions in each utterance of a speaker; 3) phoneme level, the more fine-grained acoustic conditions in each phoneme of an utterance, such as accents on specific phonemes, pitches, prosodies and temporal environment noises3. Since speaker ID (embedding) is widely used to capture speakerlevel acoustic conditions in multi-speaker scenario (Chen et al., 2020), speaker embedding is used by default. We describe the utterance-level and phoneme-level acoustic condition modeling as follows.
44
+
45
+ • Utterance Level. We use an acoustic encoder to extract a vector from a reference speech, similar to Arik et al. (2018); Jia et al. (2018); Cooper et al. (2020), and then expand and add it to the phoneme hidden sequence to provide the utterance-level acoustic conditions. As shown in Figure 2b, the acoustic encoder consists of several convolutional layers and a mean pooling layer to get a single vector. The reference speech is the target speech during training, while a randomly chosen speech of this speaker during inference.
46
+
47
+ • Phoneme Level. We use another acoustic encoder (shown in Figure 2c) to extract a sequence of phoneme-level vectors from the target speech and add it to the phoneme hidden sequence to provide the phoneme-level acoustic conditions4. In order to extract phoneme-level information from speech, we first average the speech frames corresponding to the same phoneme according to alignment between phoneme and mel-spectrogram sequence (shown in Figure 2a), to convert to length of speech frame sequence into the length of phoneme sequence, similar to Sun et al. (2020); Zeng et al. (2020). During inference, we use another phoneme-level acoustic predictor (shown in Figure 2d) which is built upon the original phoneme encoder to predict the phoneme-level vectors.
48
+
49
+ ![](images/1b8115e8378ff3f0bce5e8c218cc53e46a1027bcc95a6b54cc7689458e994c80.jpg)
50
+ Figure 2: (a) The overall structure of acoustic condition modeling. (b) Utterance-level acoustic encoder. (c) Phoneme-level acoustic encoder, where phoneme-level mel means the mel-frames aligned to the same phoneme are averaged. (d) Phoneme-level acoustic predictor, where phoneme hiddens is the hidden sequence from the phoneme encoder in Figure 1. ‘Conv1D $( m , n ) $ means the kernel size and stride size in 1D convolution is $m$ and $n$ respectively. ‘LN’ means layer normalization. As shown in Figure 2a, the phoneme-level vectors are directly added element-wisely into the hidden sequence, and the utterance-level and speaker level vector/embedding are first expanded to the same length and then added element-wisely into the hidden sequence.
51
+
52
+ Using speech encoders to extract a single vector or a sequence of vectors to represent the characteristics of a speech sequence has been adopted in previous works (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020; Sun et al., 2020; Zeng et al., 2020). They usually leverage them to improve the speaker timbre or prosody of the TTS model, or improve the controllability of the model. The key contribution in our acoustic condition modeling in this work is the novel perspective to model the diverse acoustic conditions in different granularities to make the source model more adaptable to different adaptation data. As analyzed in Section 4.2, utterance-level and phoneme-level acoustic modeling can indeed help the learning of acoustic conditions and is critical to ensure the adaptation quality.
53
+
54
+ # 2.2 CONDITIONAL LAYER NORMALIZATION
55
+
56
+ Achieving high adaptation quality while using small adaptation parameters is challenging. Previous works use zero-shot adaptation with speaker encoder (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020) or only fine-tune the speaker embedding cannot achieve satisfied quality. Can we greatly increase the voice quality at the cost of slightly more but negligible parameters? To this end, we analyze the model parameters of FastSpeech 2 (Ren et al., 2021), which is basically built upon the structure of Transformer (Vaswani et al., 2017), with a self-attention network and a feed-forward network in each Transformer block. Both the matrix multiplications in the query, key, value and output of self-attention and two-layer feed-forward networks are parameter-intensive, which is not efficient to adapt. We find that layer normalization (Ba et al., 2016) is adopted in each self-attention and feed-forward network in decoder, which can greatly influence the hidden activation and final prediction with a light-weight learnable scale vector $\gamma$ and bias vector $\beta$ : $\begin{array} { r } { L N ( x ) = \gamma \frac { x - \mu } { \sigma } + \beta } \end{array}$ , where $\mu$ and $\sigma$ are the mean and variance of hidden vector $x$ .
57
+
58
+ ![](images/a66e8ffc76fa99ca95e58f3c7f706be919dbfefddd07a11631defff56ae26599.jpg)
59
+ Figure 3: Conditional LayerNorm.
60
+
61
+ If we can determine the scale and bias vector in layer normalization with the corresponding speaker characteristics using a small conditional network, then we can fine-tune this conditional network when adapting to a new voice, and greatly reduce the adaptation parameters while ensuring the adaptation quality. As shown in Figure 3, the conditional network consists of two simple linear layers $W _ { c } ^ { \gamma }$ and $\hat W _ { c } ^ { \beta }$ that take speaker embedding $E ^ { s }$ as input and output the scale and bias vector respectively:
62
+
63
+ $$
64
+ \gamma _ { c } ^ { s } = E ^ { s } * W _ { c } ^ { \gamma } , \beta _ { c } ^ { s } = E ^ { s } * W _ { c } ^ { \beta } ,
65
+ $$
66
+
67
+ where $s$ denotes the speaker ID, and $c \in [ C ]$ denotes there are $C$ conditional layer normalizations in the decoder (the number of decoder layer is $( C - 1 ) / 2$ since each layer has two conditional layer normalizations corresponding to self-attention and feed-forward network in Transformer, and there is an additional layer normalization at the final output) and each uses different conditional matrices.
68
+
69
+ # 2.3 PIPELINE OF ADASPEECH
70
+
71
+ We list the pre-training, fine-tuning and inference pipeline of AdaSpeech in Algorithm 1. During fine-tuning, we only fine-tune the two matrices $W _ { c } ^ { \gamma }$ and $W _ { c } ^ { \beta }$ in each conditional layer normalization in decoder and the speaker embedding $E ^ { s }$ , fixing other model parameters including the utterance-level and phoneme-level acoustic encoders and phoneme-level acoustic predictor as described in Section 2.1. During inference, we do not directly use the two matrices $W _ { c } ^ { \gamma }$ and $W _ { c } ^ { \beta }$ in each conditional layer normalization since they still have large parameters. Instead we use the two matrices to calculate each scale and bias vector $\gamma _ { c } ^ { s }$ and $\beta _ { c } ^ { s }$ from speaker embedding $E _ { s }$ according to Equation 1 considering $E _ { s }$ is fixed in inference. In this way, we can save a lot of memory storage5.
72
+
73
+ Algorithm 1 Pre-training, fine-tuning and inference of AdaSpeech
74
+
75
+ 1: Pre-training: Train the AdaSpeech model $\theta$ with source training data $D$ .
76
+ 2: Fine-tuning: Fine-tune $W _ { c } ^ { \gamma }$ and $W _ { c } ^ { \beta }$ in each conditional layer normalization $c \in [ C ]$ and speaker embedding $E ^ { s }$ with the adaptation data $D ^ { s }$ for each custom speaker/voice $s$ .
77
+ 3: Inference: Deployment: 1) Calculate $\gamma _ { c , } ^ { s } \beta _ { c } ^ { s }$ in each conditional layer normalization $c \in [ C ]$ , and get the parameters $\theta ^ { s } = \{ \{ \gamma _ { c } ^ { s } , \beta _ { c } ^ { s } \} _ { c = 1 } ^ { C } , E ^ { s } \}$ for speaker $s$ . 2) Deploy the shared model parameters $\tilde { \theta }$ (not fine-tuned in $\theta$ during adaptation) and speaker specific parameters $\theta ^ { s }$ for $s$ . Inference: Use $\tilde { \theta }$ and $\theta ^ { s }$ to synthesize custom voice for speaker $s$ .
78
+
79
+ # 3 EXPERIMENTAL SETUP
80
+
81
+ Datasets We train the AdaSpeech source model on LibriTTS (Zen et al., 2019) dataset, which is a multi-speaker corpus (2456 speakers) derived from LibriSpeech (Panayotov et al., 2015) and contains 586 hours speech data. In order to evaluate AdaSpeech in custom voice scenario, we adapt the source model to the voices in other datasets including VCTK (Veaux et al., 2016) (a multi-speaker datasets with 108 speakers and 44 hours speech data) and LJSpeech (Ito, 2017) (a single-speaker high-quality dataset with 24 hours speech data), which have different acoustic conditions from LibriTTS. As a comparison, we also adapt the source model to the voices in the same LibriTTS dataset.
82
+
83
+ We randomly choose several speakers (including both male and female) from the training set of LibriTTS and VCTK and the only single speaker from the training set of LJSpeech for adaptation. For each chosen speaker, we randomly choose $K = 2 0$ sentences for adaptation and also study the effects of smaller $K$ in experiment part. We use all the speakers in the training set of LibriTTS (exclude those chosen for adaptation) to train the source AdaSpeech model, and use the original test sets in these datasets corresponding to the adaptation speakers to evaluate the adaptation voice quality.
84
+
85
+ We conduct the following preprocessing on the speech and text data in these corpora: 1) convert the sampling rate of all speech data to 16kHz; 2) extract the mel-spectrogram with $1 2 . 5 \mathrm { m s }$ hop size and $5 0 \mathrm { m s }$ window size following the common practice in Shen et al. (2018); Ren et al. (2019); 3) convert text sequence into phoneme sequence with grapheme-to-phoneme conversion (Sun et al., 2019) and take phoneme as the encoder input.
86
+
87
+ Model Configurations The model of AdaSpeech follows the basic structure in FastSpeech 2 (Ren et al., 2021), which consists of 4 feed-forward Transformer blocks for the phoneme encoder and melspectrogram decoder. The hidden dimension (including the phoneme embedding, speaker embedding, the hidden in self-attention, and the input and output hidden of feed-forward network) is set to 256. The number of attention heads, the feed-forward filter size and kernel size are set to 2, 1024 and 9 respectively. The output linear layer converts the 256-dimensional hidden into 80-dimensional mel-spectrogram. Other model configurations follow Ren et al. (2021) unless otherwise stated.
88
+
89
+ The phoneme-level acoustic encoder (Figure 2c) and predictor (Figure 2d) share the same structure, which consists of 2 convolutional layers with filter size and kernel size of 256 and 3 respectively, and a linear layer to compress the hidden to a dimension of 4 (we choose the dimension of 4 according to our preliminary study and is also consistent with previous works (Sun et al., 2020; Zeng et al., 2020)). We use MFA (McAuliffe et al., 2017) to extract the alignment between the phoneme and mel-spectrogram sequence, which is used to prepare the input of the phoneme-level acoustic encoder. We also tried to leverage VQ-VAE (Sun et al., 2020) into the phoneme-level acoustic encoder but found no obvious gains. The utterance-level acoustic encoder consists of 2 convolutional layers with filter size, kernel size and stride size of 256, 5 and 3, and a pooling layer to obtain a single vector.
90
+
91
+ Training, Adaptation and Inference In the source model training process, we first train AdaSpeech for 60,000 steps, and all the model parameters are optimized except the parameters of phoneme-level acoustic predictor. Then we train AdaSpeech and the phoneme-level acoustic predictor jointly for the remaining 40,000 steps, where the output hidden of the phoneme-level acoustic encoder is used as the label (the gradient is stopped to prevent flowing back to the phoneme-level acoustic encoder) to train the phoneme-level acoustic predictor with mean square error (MSE) loss. We train AdaSpeech on 4 NVIDIA P40 GPUs and each GPU has a batch size of about 12,500 speech frames. Adam optimizer is used with $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 8$ , $\epsilon = 1 0 ^ { - 9 }$ .
92
+
93
+ In the adaptation process, we fine-tune AdaSpeech on 1 NVIDIA P40 GPU for 2000 steps, where only the parameters of speaker embedding and conditional layer-normalization are optimized. In the inference process, the utterance-level acoustic conditions are extracted from another reference speech of the speaker, and the phoneme-level acoustic conditions are predicted from phoneme-level acoustic predictor. We use MelGAN (Kumar et al., 2019) as the vocoder to synthesize waveform from the generated mel-spectrogram.
94
+
95
+ # 4 RESULTS
96
+
97
+ In this section, we first evaluate the quality of the adaptation voices of AdaSpeech, and conduct ablation study to verify the effectiveness of each component in AdaSpeech, and finally we show some analyses of our method.
98
+
99
+ # 4.1 THE QUALITY OF ADAPTATION VOICE
100
+
101
+ We evaluate the quality of adaption voices in terms of naturalness (how the synthesized voices sound natural like human) and similarity (how the synthesized voices sound similar to this speaker). Therefore, we conduct human evaluations with MOS (mean opinion score) for naturalness and SMOS (similarity MOS) for similarity. Each sentence is listened by 20 judgers. For VCTK and LibriTTS, we average the MOS and SMOS scores of multiple adapted speakers as the final scores. We compare AdaSpeech with several settings: 1) GT, the ground-truth recordings; 2) GT mel $^ +$ Vocoder, using ground-truth mel-spectrogram to synthesize waveform with MelGAN vocoder; 3) Baseline (spk emb), a baseline system based on FastSpeech2 which only fine-tunes the speaker embedding during adaptation, and can be regarded as our lower bound; 4) Baseline (decoder), another baseline system based on FastSpeech2 which fine-tunes the whole decoder during adaptation, and can be regarded as a strong comparable system since it uses more parameters during adaptation; 5) AdaSpeech, our proposed AdaSpeech system with utterance-/phoneme-level acoustic condition modeling and conditional layer normalization during adaptation6.
102
+
103
+ Table 1: The MOS and SMOS scores with $9 5 \%$ confidence intervals when adapting the source AdaSpeech model (trained on LibriTTS) to LJSpeech, VCTK and LibriTTS datasets. The third column shows the number of additional parameters for each custom voice during adaptation (the number in bracket shows the number of parameters in inference following the practice in Section 2.3).
104
+
105
+ <table><tr><td>Metric</td><td>Setting</td><td>|#Params/Speaker</td><td>LJSpeech</td><td>VCTK</td><td>LibriTTS</td></tr><tr><td rowspan="5">MOS</td><td>GT</td><td>/</td><td>3.98±0.12</td><td>3.87± 0.11</td><td>3.72 ± 0.12</td></tr><tr><td>GT mel + Vocoder</td><td>/</td><td>3.75 ±0.10</td><td>3.74 ±0.11</td><td>3.65 ± 0.12</td></tr><tr><td>Baseline (spk emb) Baseline (decoder)</td><td>256 (256) 14.1M (14.1M)</td><td>2.37 ± 0.14</td><td>2.36 ±0.10</td><td>3.02±0.13</td></tr><tr><td></td><td></td><td>3.44 ± 0.13</td><td>3.35 ± 0.12</td><td>3.51 ±0.11</td></tr><tr><td>AdaSpeech</td><td>1.2M (4.9K)</td><td>3.45 ± 0.11</td><td>3.39 ±0.10</td><td>3.55± 0.12</td></tr><tr><td rowspan="5">SMOS</td><td>GT</td><td>/</td><td>4.36 ± 0.11</td><td>4.44 ± 0.10</td><td>4.31 ± 0.07</td></tr><tr><td>GT mel + Vocoder</td><td>/</td><td>4.29 ± 0.11</td><td>4.36 ± 0.11</td><td>4.31± 0.07</td></tr><tr><td>Baseline (spk emb)</td><td>256 (256)</td><td>2.79 ± 0.19</td><td>3.34± 0.19</td><td>4.00 ± 0.12</td></tr><tr><td>Baseline (decoder)</td><td>14.1M (14.1M)</td><td>3.57± 0.12</td><td>3.90± 0.12</td><td>4.10 ±0.10</td></tr><tr><td> AdaSpeech</td><td>1.2M (4.9K)</td><td>3.59 ± 0.15</td><td>3.96± 0.15</td><td>4.13± 0.09</td></tr></table>
106
+
107
+ The MOS and SMOS results are shown in Table 1. We have several observations: 1) Adapting the model (trained on LibriTTS) to the cross-domain datasets (LJSpeech and VCTK) is more difficult than adapting to the in-domain datasets (LibriTTS), since the MOS and SMOS gap between the adaptation models (two baselines and AdaSpeech) and the ground-truth mel $^ +$ vocoder setting is bigger on cross-domain datasets7. This also confirms the challenges of modeling different acoustic conditions in custom voice scenarios. 2) Compared with only fine-tuning speaker embedding, i.e., Baseline (spk emb), AdaSpeech achieves significant improvements in terms of both MOS and SMOS in the three adaptation datasets, by only leveraging slightly more parameters in conditional layer normalization. We also analyze in next subsection (Table 3) that even if we increase the adaptation parameters of baseline to match or surpass that in AdaSpeech, it still performs much worse than AdaSpeech. 3) Compared with fine-tuning the whole decoder, i.e., Baseline (decoder), AdaSpeech achieves slightly better quality in both MOS and SMOS and importantly with much smaller adaptation parameters, which demonstrates the effectiveness and efficiency of our proposed acoustic condition modeling and conditional layer normalization. Note that fine-tuning the whole decoder causes too much adaptation parameters that cannot satisfy the custom voice scenario.
108
+
109
+ # 4.2 METHOD ANALYSIS
110
+
111
+ In this section, we first conduct ablation studies to verify the effectiveness of each component in AdaSpeech, including utterance-level and phonemelevel acoustic condition modeling, and conditional layer normalization, and then conduct more detailed analyses on our proposed AdaSpeech.
112
+
113
+ Table 2: The CMOS of the ablation study on VCTK. UL-ACM and PL-ACM represents utterance-level and phoneme-level acoustic condition modeling, and CLN represents conditional layer normalization.
114
+
115
+ <table><tr><td>Setting</td><td>CMOS</td></tr><tr><td>AdaSpeech</td><td>0</td></tr><tr><td>AdaSpeech w/o UL-ACM AdaSpeech w/o PL-ACM AdaSpeech w/o CLN</td><td>-0.12 -0.21 -0.14</td></tr></table>
116
+
117
+ Ablation Study We compare the CMOS (comparison MOS) of the adaptation voice quality when removing each component in AdaSpeech on VCTK testset (each sentence is listened by 20 judgers). Specifically, when removing conditional layer normalization, we only fine-tune the speaker embedding. From Table 2, we can see that removing utterance-level and phoneme-level acoustic modeling, and conditional layer normalization all result in performance drop in voice quality, demonstrating the effectiveness of each component in AdaSpeech.
118
+
119
+ Analyses on Acoustic Condition Modeling We analyze the vectors extracted from the utterancelevel acoustic encoder for several speakers on LibriTTS datasets. We use t-SNE (Maaten & Hinton,
120
+
121
+ ![](images/20d44f231397740e61ebc70e686f9e8cb055d74084454170043752107ac8df7c.jpg)
122
+ Figure 4: (a) The visualization of utterance-level acoustic vectors for several speakers (each number in the legend represents a speaker ID in LibriTTS datasets). (b) The MOS of different adaptation data on LJSpeech and VCTK.
123
+
124
+ 2008) to illustrate them in Figure 4a, where each point represents an utterance-level vector and each color belongs to the same speaker. It can be seen that different utterances of the same speaker are clustered together but have difference in acoustic conditions. There are some exceptions, such as the two pink points one blue point in the brown solid circle. According to our investigation on the corresponding speech data, these points correspond to the utterances with short and emotional voice, and thus are close to each other although belonging to different speakers.
125
+
126
+ Analyses on Conditional Layer Normalization We further compare conditional layer normalization (CLN) with other two settings: 1) $\mathrm { L N } +$ fine-tune scale/bias: removing the condition on speaker embedding, and only fine-tuning scale/bias in layer normalization and speaker embedding; 2) $\mathrm { ~ L N ~ } +$ fine-tuning others: removing the condition on speaker embedding, and instead fine-tuning other (similar or even larger amount of) parameters in the decoder8. The CMOS evaluations are shown in Table 3. It can be seen that both settings result in worse quality compared with conditional layer normalization, which verifies its effectiveness.
127
+
128
+ <table><tr><td>Setting CMOS</td></tr><tr><td>CLN 0</td></tr><tr><td>LN + fine-tune scale/bias -0.18</td></tr><tr><td>LN + fine-tune others -0.24</td></tr></table>
129
+
130
+ Table 3: The CMOS on VCTK for the comparison of conditional layer normalization.
131
+
132
+ Varying Adaptation Data We study the voice quality with different amount of adaptation data (fewer than the default setting) on VCTK and LJSpeech, and conduct MOS evaluation as shown in Figure 4b. It can be seen that the voice quality continue drops when adaptation data decreases, and drops quickly when the adaptation data is fewer than 10 sentences.
133
+
134
+ # 5 CONCLUSIONS
135
+
136
+ In this paper, we have developed AdaSpeech, an adaptive TTS system to support the distinctive requirements in custom voice. We propose acoustic condition modeling to make the source TTS model more adaptable for custom voice with various acoustic conditions. We further design conditional layer normalization to improve the adaptation efficiency: fine-tuning few model parameters to achieve high voice quality. We finally present the pipeline of pre-training, fine-tuning and inference in AdaSpeech for custom voice. Experiment results demonstrate that AdaSpeech can support custom voice with different acoustic conditions with few memory storage and at the same time with high voice quality. For future work, we will further improve the modeling of acoustic conditions in the source TTS model and study more diverse acoustic conditions such as noisy speech in custom voice. We will also investigate the adaptation setting with untranscribed data (Yan et al., 2021) and further compress the model size (Luo et al., 2021) to support more custom voices.
137
+
138
+ # REFERENCES
139
+
140
+ Sercan Arik, Jitong Chen, Kainan Peng, Wei Ping, and Yanqi Zhou. Neural voice cloning with a few samples. In Advances in Neural Information Processing Systems, pp. 10019–10029, 2018.
141
+
142
+ Sercan O Arik, Mike Chrzanowski, Adam Coates, Gregory Diamos, Andrew Gibiansky, Yongguo Kang, Xian Li, John Miller, Andrew $\mathrm { N g }$ , Jonathan Raiman, et al. Deep voice: Real-time neural text-to-speech. arXiv preprint arXiv:1702.07825, 2017.
143
+
144
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
145
+
146
+ Mingjian Chen, Xu Tan, Yi Ren, Jin Xu, Hao Sun, Sheng Zhao, and Tao Qin. Multispeech: Multispeaker text to speech with transformer. Proc. Interspeech 2020, pp. 4024–4028, 2020.
147
+
148
+ Yutian Chen, Yannis Assael, Brendan Shillingford, David Budden, Scott Reed, Heiga Zen, Quan Wang, Luis C Cobo, Andrew Trask, Ben Laurie, et al. Sample efficient adaptive text-to-speech. arXiv preprint arXiv:1809.10460, 2018.
149
+
150
+ Erica Cooper, Cheng-I Lai, Yusuke Yasuda, Fuming Fang, Xin Wang, Nanxin Chen, and Junichi Yamagishi. Zero-shot multi-speaker text-to-speech with state-of-the-art neural speaker embeddings. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6184–6188. IEEE, 2020.
151
+
152
+ Andrew Gibiansky, Sercan Arik, Gregory Diamos, John Miller, Kainan Peng, Wei Ping, Jonathan Raiman, and Yanqi Zhou. Deep voice 2: Multi-speaker neural text-to-speech. In Advances in neural information processing systems, pp. 2962–2970, 2017.
153
+
154
+ Keith Ito. The lj speech dataset. https://keithito.com/LJ-Speech-Dataset/, 2017.
155
+
156
+ Ye Jia, Yu Zhang, Ron Weiss, Quan Wang, Jonathan Shen, Fei Ren, Patrick Nguyen, Ruoming Pang, Ignacio Lopez Moreno, Yonghui Wu, et al. Transfer learning from speaker verification to multispeaker text-to-speech synthesis. In Advances in neural information processing systems, pp. 4480–4490, 2018.
157
+
158
+ Jaehyeon Kim, Sungwon Kim, Jungil Kong, and Sungroh Yoon. Glow-tts: A generative flow for text-to-speech via monotonic alignment search. arXiv preprint arXiv:2005.11129, 2020.
159
+
160
+ Zvi Kons, Slava Shechtman, Alex Sorin, Carmel Rabinovitz, and Ron Hoory. High quality, lightweight and adaptable tts using lpcnet. arXiv preprint arXiv:1905.00590, 2019.
161
+
162
+ Kundan Kumar, Rithesh Kumar, Thibault de Boissiere, Lucas Gestin, Wei Zhen Teoh, Jose Sotelo, Alexandre de Brébisson, Yoshua Bengio, and Aaron C Courville. Melgan: Generative adversarial networks for conditional waveform synthesis. In Advances in Neural Information Processing Systems, pp. 14910–14921, 2019.
163
+
164
+ Chao Li, Xiaokong Ma, Bing Jiang, Xiangang Li, Xuewei Zhang, Xiao Liu, Ying Cao, Ajay Kannan, and Zhenyao Zhu. Deep speaker: an end-to-end neural speaker embedding system. arXiv preprint arXiv:1705.02304, 2017.
165
+
166
+ Renqian Luo, Xu Tan, Rui Wang, Tao Qin, Jinzhu Li, Sheng Zhao, Enhong Chen, and Tie-Yan Liu. Lightspeech: Lightweight and fast text to speech with neural architecture search. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021.
167
+
168
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
169
+
170
+ Michael McAuliffe, Michaela Socolof, Sarah Mihuc, Michael Wagner, and Morgan Sonderegger. Montreal forced aligner: Trainable text-speech alignment using kaldi. In Interspeech, pp. 498–502, 2017.
171
+
172
+ Henry B Moss, Vatsal Aggarwal, Nishant Prateek, Javier González, and Roberto Barra-Chicote. Boffin tts: Few-shot speaker adaptation by bayesian optimization. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7639–7643. IEEE, 2020.
173
+
174
+ Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5206–5210. IEEE, 2015.
175
+
176
+ Kainan Peng, Wei Ping, Zhao Song, and Kexin Zhao. Non-autoregressive neural text-to-speech. ICML, 2020.
177
+
178
+ Wei Ping, Kainan Peng, Andrew Gibiansky, Sercan O. Arik, Ajay Kannan, Sharan Narang, Jonathan Raiman, and John Miller. Deep voice 3: 2000-speaker neural text-to-speech. In International Conference on Learning Representations, 2018.
179
+
180
+ Yi Ren, Yangjun Ruan, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. Fastspeech: Fast, robust and controllable text to speech. In NeurIPS, 2019.
181
+
182
+ Yi Ren, Chenxu Hu, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. Fastspeech 2: Fast and high-quality end-to-end text-to-speech. In ICLR, 2021.
183
+
184
+ Jonathan Shen, Ruoming Pang, Ron J Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, Rj Skerrv-Ryan, et al. Natural tts synthesis by conditioning wavenet on mel spectrogram predictions. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4779–4783. IEEE, 2018.
185
+
186
+ Guangzhi Sun, Yu Zhang, Ron J Weiss, Yuan Cao, Heiga Zen, Andrew Rosenberg, Bhuvana Ramabhadran, and Yonghui Wu. Generating diverse and natural text-to-speech samples using a quantized fine-grained vae and autoregressive prosody prior. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6699–6703. IEEE, 2020.
187
+
188
+ Hao Sun, Xu Tan, Jun-Wei Gan, Hongzhi Liu, Sheng Zhao, Tao Qin, and Tie-Yan Liu. Token-level ensemble distillation for grapheme-to-phoneme conversion. In INTERSPEECH, 2019.
189
+
190
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008, 2017.
191
+
192
+ Christophe Veaux, Junichi Yamagishi, Kirsten MacDonald, et al. Superseded-cstr vctk corpus: English multi-speaker corpus for cstr voice cloning toolkit. 2016.
193
+
194
+ Li Wan, Quan Wang, Alan Papir, and Ignacio Lopez Moreno. Generalized end-to-end loss for speaker verification. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4879–4883. IEEE, 2018.
195
+
196
+ Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: Towards end-to-end speech synthesis. arXiv preprint arXiv:1703.10135, 2017.
197
+
198
+ Yuzi Yan, Xu Tan, Bohan Li, Tao Qin, Sheng Zhao, Yuan Shen, and Tie-Yan Liu. Adaspeech 2: Adaptive text to speech with untranscribed data. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021.
199
+
200
+ Heiga Zen, Viet Dang, Rob Clark, Yu Zhang, Ron J Weiss, Ye Jia, Zhifeng Chen, and Yonghui Wu. Libritts: A corpus derived from librispeech for text-to-speech. arXiv preprint arXiv:1904.02882, 2019.
201
+
202
+ Zhen Zeng, Jianzong Wang, Ning Cheng, and Jing Xiao. Prosody learning mechanism for speech synthesis system without text length limit. arXiv preprint arXiv:2008.05656, 2020.
203
+
204
+ Chen Zhang, Yi Ren, Xu Tan, Jinglin Liu, Kejun Zhang, Tao Qin, Sheng Zhao, and Tie-Yan Liu. Denoispeech: Denoising text to speech with frame-level noise modeling. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021.
205
+
206
+ Zewang Zhang, Qiao Tian, Heng Lu, Ling-Hui Chen, and Shan Liu. Adadurian: Few-shot adaptation for neural text-to-speech with durian. arXiv preprint arXiv:2005.05642, 2020.
parse/train/Drynvt7gg4L/Drynvt7gg4L_content_list.json ADDED
@@ -0,0 +1,1170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "ADASPEECH: ADAPTIVE TEXT TO SPEECH FOR CUSTOM VOICE ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 176,
8
+ 98,
9
+ 741,
10
+ 146
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Mingjian Chen∗, Xu Tan∗, Bohan Li, Yanqing Liu, Tao Qin, Sheng Zhao, Tie-Yan Liu \nMicrosoft Research Asia, Microsoft Azure Speech \n{xuta,taoqin,szhao,tyliu}@microsoft.com ",
17
+ "bbox": [
18
+ 184,
19
+ 169,
20
+ 772,
21
+ 212
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 250,
32
+ 544,
33
+ 263
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Custom voice, a specific text to speech (TTS) service in commercial speech platforms, aims to adapt a source TTS model to synthesize personal voice for a target speaker using few speech from her/him. Custom voice presents two unique challenges for TTS adaptation: 1) to support diverse customers, the adaptation model needs to handle diverse acoustic conditions which could be very different from source speech data, and 2) to support a large number of customers, the adaptation parameters need to be small enough for each target speaker to reduce memory usage while maintaining high voice quality. In this work, we propose AdaSpeech, an adaptive TTS system for high-quality and efficient customization of new voices. We design several techniques in AdaSpeech to address the two challenges in custom voice: 1) To handle different acoustic conditions, we model the acoustic information in both utterance and phoneme level. Specifically, we use one acoustic encoder to extract an utterance-level vector and another one to extract a sequence of phoneme-level vectors from the target speech during pre-training and fine-tuning; in inference, we extract the utterance-level vector from a reference speech and use an acoustic predictor to predict the phonemelevel vectors. 2) To better trade off the adaptation parameters and voice quality, we introduce conditional layer normalization in the mel-spectrogram decoder of AdaSpeech, and fine-tune this part in addition to speaker embedding for adaptation. We pre-train the source TTS model on LibriTTS datasets and fine-tune it on VCTK and LJSpeech datasets (with different acoustic conditions from LibriTTS) with few adaptation data, e.g., 20 sentences, about 1 minute speech. Experiment results show that AdaSpeech achieves much better adaptation quality than baseline methods, with only about 5K specific parameters for each speaker, which demonstrates its effectiveness for custom voice. The audio samples are available at https://speechresearch.github.io/adaspeech/. ",
40
+ "bbox": [
41
+ 232,
42
+ 281,
43
+ 766,
44
+ 640
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 176,
54
+ 667,
55
+ 336,
56
+ 683
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Text to speech (TTS) aims to synthesize natural and intelligible voice from text, and attracts a lot of interests in machine learning community (Arik et al., 2017; Wang et al., 2017; Gibiansky et al., 2017; Ping et al., 2018; Shen et al., 2018; Ren et al., 2019). TTS models can synthesize natural human voice when training with a large amount of high-quality and single-speaker recordings (Ito, 2017), and has been extended to multi-speaker scenarios (Gibiansky et al., 2017; Ping et al., 2018; Zen et al., 2019; Chen et al., 2020) using multi-speaker corpora (Panayotov et al., 2015; Veaux et al., 2016; Zen et al., 2019). However, these corpora contain a fixed set of speakers where each speaker still has a certain amount of speech data. ",
63
+ "bbox": [
64
+ 174,
65
+ 699,
66
+ 825,
67
+ 810
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Nowadays, custom voice has attracted increasing interests in different application scenarios such as personal assistant, news broadcast and audio navigation, and has been widely supported in commercial speech platforms (some custom voice services include Microsoft Azure, Amazon AWS and Google Cloud). In custom voice, a source TTS model is usually adapted on personalized voices with few adaptation data, since the users of custom voice prefer to record as few adaptation data as possible (several minutes or seconds) for convenient purpose. Few adaptation data presents great challenges on the naturalness and similarity of adapted voice. Furthermore, there are also several distinctive challenges in custom voice: 1) The recordings of the custom users are usually of different acoustic conditions from the source speech data (the data to train the source TTS model). For example, the adaptation data is usually recorded with diverse speaking prosodies, styles, emotions, accents and recording environments. The mismatch in these acoustic conditions makes the source model difficult to generalize and leads to poor adaptation quality. 2) When adapting the source TTS model to a new voice, there is a trade-off between the fine-tuning parameters and voice quality. Generally speaking, more adaptation parameters will usually result in better voice quality, which, as a result, increases the memory storage and serving cost1. ",
74
+ "bbox": [
75
+ 174,
76
+ 818,
77
+ 825,
78
+ 901
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "",
85
+ "bbox": [
86
+ 174,
87
+ 103,
88
+ 825,
89
+ 229
90
+ ],
91
+ "page_idx": 1
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "While previous works in TTS adaptation have well considered the few adaptation data setting in custom voice, they have not fully addressed the above challenges. They fine-tune the whole model (Chen et al., 2018; Kons et al., 2019) or decoder part (Moss et al., 2020; Zhang et al., 2020), achieving good quality but causing too many adaptation parameters. Reducing the amount of adaptation parameters is necessary for the deployment of commercialized custom voice. Otherwise, the memory storage would explode as the increase of users. Some works only fine-tune the speaker embedding (Arik et al., 2018; Chen et al., 2018), or train a speaker encoder module (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020; Li et al., 2017; Wan et al., 2018) that does not need fine-tuning during adaptation. While these approaches lead a light-weight and efficient adaptation, they result in poor adaptation quality. Moreover, most previous works assume the source speech data and adaptation data are in the same domain and do not consider the setting with different acoustic conditions, which is not practical in custom voice scenarios. ",
96
+ "bbox": [
97
+ 174,
98
+ 236,
99
+ 825,
100
+ 402
101
+ ],
102
+ "page_idx": 1
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "In this paper, we propose AdaSpeech, an adaptive TTS model for high-quality and efficient customization of new voice. AdaSpeech employ a three-stage pipeline for custom voice: 1) pre-training; 2) fine-tuning; 3) inference. During the pre-training stage, the TTS model is trained on large-scale multi-speaker datasets, which can ensure the TTS model to cover diverse text and speaking voices that is helpful for adaptation. During the fine-tuning stage, the source TTS model is adapted on a new voice by fine-tuning (a part of) the model parameters on the limited adaptation data with diverse acoustic conditions. During the inference stage, both the unadapted part (parameters shared by all custom voices) and the adapted part (each custom voice has specific adapted parameters) of the TTS model are used for the inference request. We build AdaSpeech based on the popular non-autoregressive TTS models (Ren et al., 2019; Peng et al., 2020; Kim et al., 2020; Ren et al., 2021) and further design several techniques to address the challenges in custom voice: ",
107
+ "bbox": [
108
+ 173,
109
+ 410,
110
+ 825,
111
+ 561
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "• Acoustic condition modeling. In order to handle different acoustic conditions for adaptation, we model the acoustic conditions in both utterance and phoneme level in pre-training and fine-tuning. Specifically, we use two acoustic encoders to extract an utterance-level vector and a sequence of phoneme-level vectors from the target speech, which are taken as the input of the mel-spectrogram decoder to represent the global and local acoustic conditions respectively. In this way, the decoder can predict speech in different acoustic conditions based on these acoustic information. Otherwise, the model would memorize the acoustic conditions and cannot generalize well. In inference, we extract the utterance-level vector from a reference speech and use another acoustic predictor that is built upon the phoneme encoder to predict the phoneme-level vectors. ",
118
+ "bbox": [
119
+ 174,
120
+ 574,
121
+ 825,
122
+ 700
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "• Conditional layer normalization. To fine-tune as small amount of parameters as possible while ensuring the adaptation quality, we modify the layer normalization (Ba et al., 2016) in the melspectrogram decoder in pre-training, by using speaker embedding as the conditional information to generate the scale and bias vector in layer normalization. In fine-tuning, we only adapt the parameters related to the conditional layer normalization. In this way, we can greatly reduce adaptation parameters and thus memory storage2 compared with fine-tuning the whole model, but maintain high-quality adaptation voice thanks to the flexibility of conditional layer normalization. ",
129
+ "bbox": [
130
+ 174,
131
+ 705,
132
+ 825,
133
+ 803
134
+ ],
135
+ "page_idx": 1
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "To evaluate the effectiveness of our proposed AdaSpeech for custom voice, we conduct experiments to train the TTS model on LibriTTS datasets and adapt the model on VCTK and LJSpeech datasets with different adaptation settings. Experiment results show that AdaSpeech achieves better adaptation quality in terms of MOS (mean opinion score) and SMOS (similarity MOS) than baseline methods, with ",
140
+ "bbox": [
141
+ 174,
142
+ 815,
143
+ 825,
144
+ 871
145
+ ],
146
+ "page_idx": 1
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "only about 5K specific parameters for each speaker, demonstrating its effectiveness for custom voice. \nAudio samples are available at https://speechresearch.github.io/adaspeech/. ",
151
+ "bbox": [
152
+ 173,
153
+ 103,
154
+ 825,
155
+ 132
156
+ ],
157
+ "page_idx": 2
158
+ },
159
+ {
160
+ "type": "text",
161
+ "text": "2 ADASPEECH ",
162
+ "text_level": 1,
163
+ "bbox": [
164
+ 174,
165
+ 142,
166
+ 312,
167
+ 159
168
+ ],
169
+ "page_idx": 2
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "In this section, we first describe the overall design of our proposed AdaSpeech, and then introduce the key techniques to address the challenges in custom voice. At last, we list the pre-training, finetuning and inference pipeline of AdaSpeech for custom voice. ",
174
+ "bbox": [
175
+ 174,
176
+ 174,
177
+ 612,
178
+ 229
179
+ ],
180
+ "page_idx": 2
181
+ },
182
+ {
183
+ "type": "text",
184
+ "text": "The model structure of AdaSpeech is shown in Figure 1. We adopt FastSpeech 2 (Ren et al., 2021) as the model backbone considering the FastSpeech (Ren et al., 2019; 2021) series are one of the most popular models in non-autoregressive TTS. The basic model backbone consists of a phoneme encoder, a mel-spectrogram decoder, and a variance adaptor which provides variance information including duration, pitch and energy into the phoneme hidden sequence following Ren et al. (2021). As shown in Figure 1, we design two additional components to address the distinctive challenges in custom voice: 1) to support diverse customers, we use acoustic condition modeling to capture the diverse acoustic conditions of adaptation speech in different granularities; 2) to support a large number of customers with affordable memory storage, we use conditional layer normalization in decoder for efficient adaptation with few parameters while high voice quality. In the next subsections, we introduce the details of these components respectively. ",
185
+ "bbox": [
186
+ 174,
187
+ 237,
188
+ 614,
189
+ 416
190
+ ],
191
+ "page_idx": 2
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "",
196
+ "bbox": [
197
+ 174,
198
+ 417,
199
+ 823,
200
+ 444
201
+ ],
202
+ "page_idx": 2
203
+ },
204
+ {
205
+ "type": "text",
206
+ "text": "2.1 ACOUSTIC CONDITION MODELING ",
207
+ "text_level": 1,
208
+ "bbox": [
209
+ 176,
210
+ 462,
211
+ 455,
212
+ 477
213
+ ],
214
+ "page_idx": 2
215
+ },
216
+ {
217
+ "type": "text",
218
+ "text": "In custom voice, the adaptation data can be spoken with diverse prosodies, styles, accents, and can be recorded under various environments, which can make the acoustic conditions far different from that in source speech data. This presents great challenges to adapt the source TTS model, since the source speech cannot cover all the acoustic conditions in custom voice. A practical way to alleviate this issue is to improve the adaptability (generalizability) of source TTS model. In text to speech, since the input text lacks enough acoustic conditions (such as speaker timbre, prosody and recording environments) to predict the target speech, the model tends to memorize and overfit on the training data (Ren et al., 2021), and has poor generalization during adaptation. A natural way to solve such problem is to provide corresponding acoustic conditions as input to make the model learn reasonable text-to-speech mapping towards better generalization instead of memorizing. ",
219
+ "bbox": [
220
+ 174,
221
+ 488,
222
+ 825,
223
+ 627
224
+ ],
225
+ "page_idx": 2
226
+ },
227
+ {
228
+ "type": "image",
229
+ "img_path": "images/b16230a0b3471c9cf7166d42bf87e2d4d83fb2c8fad20fc0c5c9c58c2c644de2.jpg",
230
+ "image_caption": [
231
+ "Figure 1: AdaSpeech. "
232
+ ],
233
+ "image_footnote": [],
234
+ "bbox": [
235
+ 650,
236
+ 176,
237
+ 802,
238
+ 372
239
+ ],
240
+ "page_idx": 2
241
+ },
242
+ {
243
+ "type": "text",
244
+ "text": "To better model the acoustic conditions with different granularities, we categorize the acoustic conditions in different levels as shown in Figure 2a: 1) speaker level, the coarse-grained acoustic conditions to capture the overall characteristics of a speaker; 2) utterance level, the fine-grained acoustic conditions in each utterance of a speaker; 3) phoneme level, the more fine-grained acoustic conditions in each phoneme of an utterance, such as accents on specific phonemes, pitches, prosodies and temporal environment noises3. Since speaker ID (embedding) is widely used to capture speakerlevel acoustic conditions in multi-speaker scenario (Chen et al., 2020), speaker embedding is used by default. We describe the utterance-level and phoneme-level acoustic condition modeling as follows. ",
245
+ "bbox": [
246
+ 173,
247
+ 633,
248
+ 825,
249
+ 746
250
+ ],
251
+ "page_idx": 2
252
+ },
253
+ {
254
+ "type": "text",
255
+ "text": "• Utterance Level. We use an acoustic encoder to extract a vector from a reference speech, similar to Arik et al. (2018); Jia et al. (2018); Cooper et al. (2020), and then expand and add it to the phoneme hidden sequence to provide the utterance-level acoustic conditions. As shown in Figure 2b, the acoustic encoder consists of several convolutional layers and a mean pooling layer to get a single vector. The reference speech is the target speech during training, while a randomly chosen speech of this speaker during inference. ",
256
+ "bbox": [
257
+ 174,
258
+ 757,
259
+ 825,
260
+ 842
261
+ ],
262
+ "page_idx": 2
263
+ },
264
+ {
265
+ "type": "text",
266
+ "text": "• Phoneme Level. We use another acoustic encoder (shown in Figure 2c) to extract a sequence of phoneme-level vectors from the target speech and add it to the phoneme hidden sequence to provide the phoneme-level acoustic conditions4. In order to extract phoneme-level information from speech, we first average the speech frames corresponding to the same phoneme according to alignment between phoneme and mel-spectrogram sequence (shown in Figure 2a), to convert to length of speech frame sequence into the length of phoneme sequence, similar to Sun et al. (2020); Zeng et al. (2020). During inference, we use another phoneme-level acoustic predictor (shown in Figure 2d) which is built upon the original phoneme encoder to predict the phoneme-level vectors. ",
267
+ "bbox": [
268
+ 176,
269
+ 845,
270
+ 821,
271
+ 875
272
+ ],
273
+ "page_idx": 2
274
+ },
275
+ {
276
+ "type": "image",
277
+ "img_path": "images/1b8115e8378ff3f0bce5e8c218cc53e46a1027bcc95a6b54cc7689458e994c80.jpg",
278
+ "image_caption": [
279
+ "Figure 2: (a) The overall structure of acoustic condition modeling. (b) Utterance-level acoustic encoder. (c) Phoneme-level acoustic encoder, where phoneme-level mel means the mel-frames aligned to the same phoneme are averaged. (d) Phoneme-level acoustic predictor, where phoneme hiddens is the hidden sequence from the phoneme encoder in Figure 1. ‘Conv1D $( m , n ) $ means the kernel size and stride size in 1D convolution is $m$ and $n$ respectively. ‘LN’ means layer normalization. As shown in Figure 2a, the phoneme-level vectors are directly added element-wisely into the hidden sequence, and the utterance-level and speaker level vector/embedding are first expanded to the same length and then added element-wisely into the hidden sequence. "
280
+ ],
281
+ "image_footnote": [],
282
+ "bbox": [
283
+ 189,
284
+ 71,
285
+ 797,
286
+ 252
287
+ ],
288
+ "page_idx": 3
289
+ },
290
+ {
291
+ "type": "text",
292
+ "text": "",
293
+ "bbox": [
294
+ 189,
295
+ 386,
296
+ 825,
297
+ 469
298
+ ],
299
+ "page_idx": 3
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "Using speech encoders to extract a single vector or a sequence of vectors to represent the characteristics of a speech sequence has been adopted in previous works (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020; Sun et al., 2020; Zeng et al., 2020). They usually leverage them to improve the speaker timbre or prosody of the TTS model, or improve the controllability of the model. The key contribution in our acoustic condition modeling in this work is the novel perspective to model the diverse acoustic conditions in different granularities to make the source model more adaptable to different adaptation data. As analyzed in Section 4.2, utterance-level and phoneme-level acoustic modeling can indeed help the learning of acoustic conditions and is critical to ensure the adaptation quality. ",
304
+ "bbox": [
305
+ 173,
306
+ 482,
307
+ 825,
308
+ 607
309
+ ],
310
+ "page_idx": 3
311
+ },
312
+ {
313
+ "type": "text",
314
+ "text": "2.2 CONDITIONAL LAYER NORMALIZATION ",
315
+ "text_level": 1,
316
+ "bbox": [
317
+ 178,
318
+ 626,
319
+ 491,
320
+ 638
321
+ ],
322
+ "page_idx": 3
323
+ },
324
+ {
325
+ "type": "text",
326
+ "text": "Achieving high adaptation quality while using small adaptation parameters is challenging. Previous works use zero-shot adaptation with speaker encoder (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020) or only fine-tune the speaker embedding cannot achieve satisfied quality. Can we greatly increase the voice quality at the cost of slightly more but negligible parameters? To this end, we analyze the model parameters of FastSpeech 2 (Ren et al., 2021), which is basically built upon the structure of Transformer (Vaswani et al., 2017), with a self-attention network and a feed-forward network in each Transformer block. Both the matrix multiplications in the query, key, value and output of self-attention and two-layer feed-forward networks are parameter-intensive, which is not efficient to adapt. We find that layer normalization (Ba et al., 2016) is adopted in each self-attention and feed-forward network in decoder, which can greatly influence the hidden activation and final prediction with a light-weight learnable scale vector $\\gamma$ and bias vector $\\beta$ : $\\begin{array} { r } { L N ( x ) = \\gamma \\frac { x - \\mu } { \\sigma } + \\beta } \\end{array}$ , where $\\mu$ and $\\sigma$ are the mean and variance of hidden vector $x$ . ",
327
+ "bbox": [
328
+ 174,
329
+ 651,
330
+ 583,
331
+ 762
332
+ ],
333
+ "page_idx": 3
334
+ },
335
+ {
336
+ "type": "image",
337
+ "img_path": "images/a66e8ffc76fa99ca95e58f3c7f706be919dbfefddd07a11631defff56ae26599.jpg",
338
+ "image_caption": [
339
+ "Figure 3: Conditional LayerNorm. "
340
+ ],
341
+ "image_footnote": [],
342
+ "bbox": [
343
+ 624,
344
+ 625,
345
+ 787,
346
+ 729
347
+ ],
348
+ "page_idx": 3
349
+ },
350
+ {
351
+ "type": "text",
352
+ "text": "",
353
+ "bbox": [
354
+ 174,
355
+ 763,
356
+ 825,
357
+ 859
358
+ ],
359
+ "page_idx": 3
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "If we can determine the scale and bias vector in layer normalization with the corresponding speaker characteristics using a small conditional network, then we can fine-tune this conditional network when adapting to a new voice, and greatly reduce the adaptation parameters while ensuring the adaptation quality. As shown in Figure 3, the conditional network consists of two simple linear layers $W _ { c } ^ { \\gamma }$ and $\\hat W _ { c } ^ { \\beta }$ that take speaker embedding $E ^ { s }$ as input and output the scale and bias vector respectively: ",
364
+ "bbox": [
365
+ 173,
366
+ 103,
367
+ 825,
368
+ 174
369
+ ],
370
+ "page_idx": 4
371
+ },
372
+ {
373
+ "type": "equation",
374
+ "img_path": "images/46d9158de490c6a92b43b8057a8662efbb9d97a2f42d97fafc32fd4cfce294d3.jpg",
375
+ "text": "$$\n\\gamma _ { c } ^ { s } = E ^ { s } * W _ { c } ^ { \\gamma } , \\beta _ { c } ^ { s } = E ^ { s } * W _ { c } ^ { \\beta } ,\n$$",
376
+ "text_format": "latex",
377
+ "bbox": [
378
+ 387,
379
+ 180,
380
+ 609,
381
+ 199
382
+ ],
383
+ "page_idx": 4
384
+ },
385
+ {
386
+ "type": "text",
387
+ "text": "where $s$ denotes the speaker ID, and $c \\in [ C ]$ denotes there are $C$ conditional layer normalizations in the decoder (the number of decoder layer is $( C - 1 ) / 2$ since each layer has two conditional layer normalizations corresponding to self-attention and feed-forward network in Transformer, and there is an additional layer normalization at the final output) and each uses different conditional matrices. ",
388
+ "bbox": [
389
+ 174,
390
+ 205,
391
+ 825,
392
+ 262
393
+ ],
394
+ "page_idx": 4
395
+ },
396
+ {
397
+ "type": "text",
398
+ "text": "2.3 PIPELINE OF ADASPEECH",
399
+ "text_level": 1,
400
+ "bbox": [
401
+ 174,
402
+ 279,
403
+ 393,
404
+ 294
405
+ ],
406
+ "page_idx": 4
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "We list the pre-training, fine-tuning and inference pipeline of AdaSpeech in Algorithm 1. During fine-tuning, we only fine-tune the two matrices $W _ { c } ^ { \\gamma }$ and $W _ { c } ^ { \\beta }$ in each conditional layer normalization in decoder and the speaker embedding $E ^ { s }$ , fixing other model parameters including the utterance-level and phoneme-level acoustic encoders and phoneme-level acoustic predictor as described in Section 2.1. During inference, we do not directly use the two matrices $W _ { c } ^ { \\gamma }$ and $W _ { c } ^ { \\beta }$ in each conditional layer normalization since they still have large parameters. Instead we use the two matrices to calculate each scale and bias vector $\\gamma _ { c } ^ { s }$ and $\\beta _ { c } ^ { s }$ from speaker embedding $E _ { s }$ according to Equation 1 considering $E _ { s }$ is fixed in inference. In this way, we can save a lot of memory storage5. ",
411
+ "bbox": [
412
+ 173,
413
+ 305,
414
+ 825,
415
+ 416
416
+ ],
417
+ "page_idx": 4
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "Algorithm 1 Pre-training, fine-tuning and inference of AdaSpeech ",
422
+ "bbox": [
423
+ 173,
424
+ 425,
425
+ 609,
426
+ 439
427
+ ],
428
+ "page_idx": 4
429
+ },
430
+ {
431
+ "type": "text",
432
+ "text": "1: Pre-training: Train the AdaSpeech model $\\theta$ with source training data $D$ . \n2: Fine-tuning: Fine-tune $W _ { c } ^ { \\gamma }$ and $W _ { c } ^ { \\beta }$ in each conditional layer normalization $c \\in [ C ]$ and speaker embedding $E ^ { s }$ with the adaptation data $D ^ { s }$ for each custom speaker/voice $s$ . \n3: Inference: Deployment: 1) Calculate $\\gamma _ { c , } ^ { s } \\beta _ { c } ^ { s }$ in each conditional layer normalization $c \\in [ C ]$ , and get the parameters $\\theta ^ { s } = \\{ \\{ \\gamma _ { c } ^ { s } , \\beta _ { c } ^ { s } \\} _ { c = 1 } ^ { C } , E ^ { s } \\}$ for speaker $s$ . 2) Deploy the shared model parameters $\\tilde { \\theta }$ (not fine-tuned in $\\theta$ during adaptation) and speaker specific parameters $\\theta ^ { s }$ for $s$ . Inference: Use $\\tilde { \\theta }$ and $\\theta ^ { s }$ to synthesize custom voice for speaker $s$ . ",
433
+ "bbox": [
434
+ 179,
435
+ 444,
436
+ 826,
437
+ 547
438
+ ],
439
+ "page_idx": 4
440
+ },
441
+ {
442
+ "type": "text",
443
+ "text": "3 EXPERIMENTAL SETUP ",
444
+ "text_level": 1,
445
+ "bbox": [
446
+ 176,
447
+ 568,
448
+ 398,
449
+ 584
450
+ ],
451
+ "page_idx": 4
452
+ },
453
+ {
454
+ "type": "text",
455
+ "text": "Datasets We train the AdaSpeech source model on LibriTTS (Zen et al., 2019) dataset, which is a multi-speaker corpus (2456 speakers) derived from LibriSpeech (Panayotov et al., 2015) and contains 586 hours speech data. In order to evaluate AdaSpeech in custom voice scenario, we adapt the source model to the voices in other datasets including VCTK (Veaux et al., 2016) (a multi-speaker datasets with 108 speakers and 44 hours speech data) and LJSpeech (Ito, 2017) (a single-speaker high-quality dataset with 24 hours speech data), which have different acoustic conditions from LibriTTS. As a comparison, we also adapt the source model to the voices in the same LibriTTS dataset. ",
456
+ "bbox": [
457
+ 173,
458
+ 599,
459
+ 825,
460
+ 696
461
+ ],
462
+ "page_idx": 4
463
+ },
464
+ {
465
+ "type": "text",
466
+ "text": "We randomly choose several speakers (including both male and female) from the training set of LibriTTS and VCTK and the only single speaker from the training set of LJSpeech for adaptation. For each chosen speaker, we randomly choose $K = 2 0$ sentences for adaptation and also study the effects of smaller $K$ in experiment part. We use all the speakers in the training set of LibriTTS (exclude those chosen for adaptation) to train the source AdaSpeech model, and use the original test sets in these datasets corresponding to the adaptation speakers to evaluate the adaptation voice quality. ",
467
+ "bbox": [
468
+ 174,
469
+ 704,
470
+ 825,
471
+ 789
472
+ ],
473
+ "page_idx": 4
474
+ },
475
+ {
476
+ "type": "text",
477
+ "text": "We conduct the following preprocessing on the speech and text data in these corpora: 1) convert the sampling rate of all speech data to 16kHz; 2) extract the mel-spectrogram with $1 2 . 5 \\mathrm { m s }$ hop size and $5 0 \\mathrm { m s }$ window size following the common practice in Shen et al. (2018); Ren et al. (2019); 3) convert text sequence into phoneme sequence with grapheme-to-phoneme conversion (Sun et al., 2019) and take phoneme as the encoder input. ",
478
+ "bbox": [
479
+ 174,
480
+ 795,
481
+ 825,
482
+ 837
483
+ ],
484
+ "page_idx": 4
485
+ },
486
+ {
487
+ "type": "text",
488
+ "text": "",
489
+ "bbox": [
490
+ 174,
491
+ 103,
492
+ 823,
493
+ 132
494
+ ],
495
+ "page_idx": 5
496
+ },
497
+ {
498
+ "type": "text",
499
+ "text": "Model Configurations The model of AdaSpeech follows the basic structure in FastSpeech 2 (Ren et al., 2021), which consists of 4 feed-forward Transformer blocks for the phoneme encoder and melspectrogram decoder. The hidden dimension (including the phoneme embedding, speaker embedding, the hidden in self-attention, and the input and output hidden of feed-forward network) is set to 256. The number of attention heads, the feed-forward filter size and kernel size are set to 2, 1024 and 9 respectively. The output linear layer converts the 256-dimensional hidden into 80-dimensional mel-spectrogram. Other model configurations follow Ren et al. (2021) unless otherwise stated. ",
500
+ "bbox": [
501
+ 174,
502
+ 147,
503
+ 825,
504
+ 244
505
+ ],
506
+ "page_idx": 5
507
+ },
508
+ {
509
+ "type": "text",
510
+ "text": "The phoneme-level acoustic encoder (Figure 2c) and predictor (Figure 2d) share the same structure, which consists of 2 convolutional layers with filter size and kernel size of 256 and 3 respectively, and a linear layer to compress the hidden to a dimension of 4 (we choose the dimension of 4 according to our preliminary study and is also consistent with previous works (Sun et al., 2020; Zeng et al., 2020)). We use MFA (McAuliffe et al., 2017) to extract the alignment between the phoneme and mel-spectrogram sequence, which is used to prepare the input of the phoneme-level acoustic encoder. We also tried to leverage VQ-VAE (Sun et al., 2020) into the phoneme-level acoustic encoder but found no obvious gains. The utterance-level acoustic encoder consists of 2 convolutional layers with filter size, kernel size and stride size of 256, 5 and 3, and a pooling layer to obtain a single vector. ",
511
+ "bbox": [
512
+ 174,
513
+ 252,
514
+ 825,
515
+ 377
516
+ ],
517
+ "page_idx": 5
518
+ },
519
+ {
520
+ "type": "text",
521
+ "text": "Training, Adaptation and Inference In the source model training process, we first train AdaSpeech for 60,000 steps, and all the model parameters are optimized except the parameters of phoneme-level acoustic predictor. Then we train AdaSpeech and the phoneme-level acoustic predictor jointly for the remaining 40,000 steps, where the output hidden of the phoneme-level acoustic encoder is used as the label (the gradient is stopped to prevent flowing back to the phoneme-level acoustic encoder) to train the phoneme-level acoustic predictor with mean square error (MSE) loss. We train AdaSpeech on 4 NVIDIA P40 GPUs and each GPU has a batch size of about 12,500 speech frames. Adam optimizer is used with $\\beta _ { 1 } = 0 . 9$ , $\\beta _ { 2 } = 0 . 9 8$ , $\\epsilon = 1 0 ^ { - 9 }$ . ",
522
+ "bbox": [
523
+ 174,
524
+ 392,
525
+ 825,
526
+ 503
527
+ ],
528
+ "page_idx": 5
529
+ },
530
+ {
531
+ "type": "text",
532
+ "text": "In the adaptation process, we fine-tune AdaSpeech on 1 NVIDIA P40 GPU for 2000 steps, where only the parameters of speaker embedding and conditional layer-normalization are optimized. In the inference process, the utterance-level acoustic conditions are extracted from another reference speech of the speaker, and the phoneme-level acoustic conditions are predicted from phoneme-level acoustic predictor. We use MelGAN (Kumar et al., 2019) as the vocoder to synthesize waveform from the generated mel-spectrogram. ",
533
+ "bbox": [
534
+ 174,
535
+ 511,
536
+ 825,
537
+ 594
538
+ ],
539
+ "page_idx": 5
540
+ },
541
+ {
542
+ "type": "text",
543
+ "text": "4 RESULTS ",
544
+ "text_level": 1,
545
+ "bbox": [
546
+ 174,
547
+ 614,
548
+ 282,
549
+ 630
550
+ ],
551
+ "page_idx": 5
552
+ },
553
+ {
554
+ "type": "text",
555
+ "text": "In this section, we first evaluate the quality of the adaptation voices of AdaSpeech, and conduct ablation study to verify the effectiveness of each component in AdaSpeech, and finally we show some analyses of our method. ",
556
+ "bbox": [
557
+ 176,
558
+ 635,
559
+ 825,
560
+ 676
561
+ ],
562
+ "page_idx": 5
563
+ },
564
+ {
565
+ "type": "text",
566
+ "text": "4.1 THE QUALITY OF ADAPTATION VOICE ",
567
+ "text_level": 1,
568
+ "bbox": [
569
+ 174,
570
+ 693,
571
+ 480,
572
+ 708
573
+ ],
574
+ "page_idx": 5
575
+ },
576
+ {
577
+ "type": "text",
578
+ "text": "We evaluate the quality of adaption voices in terms of naturalness (how the synthesized voices sound natural like human) and similarity (how the synthesized voices sound similar to this speaker). Therefore, we conduct human evaluations with MOS (mean opinion score) for naturalness and SMOS (similarity MOS) for similarity. Each sentence is listened by 20 judgers. For VCTK and LibriTTS, we average the MOS and SMOS scores of multiple adapted speakers as the final scores. We compare AdaSpeech with several settings: 1) GT, the ground-truth recordings; 2) GT mel $^ +$ Vocoder, using ground-truth mel-spectrogram to synthesize waveform with MelGAN vocoder; 3) Baseline (spk emb), a baseline system based on FastSpeech2 which only fine-tunes the speaker embedding during adaptation, and can be regarded as our lower bound; 4) Baseline (decoder), another baseline system based on FastSpeech2 which fine-tunes the whole decoder during adaptation, and can be regarded as a strong comparable system since it uses more parameters during adaptation; 5) AdaSpeech, our proposed AdaSpeech system with utterance-/phoneme-level acoustic condition modeling and conditional layer normalization during adaptation6. ",
579
+ "bbox": [
580
+ 174,
581
+ 719,
582
+ 825,
583
+ 900
584
+ ],
585
+ "page_idx": 5
586
+ },
587
+ {
588
+ "type": "table",
589
+ "img_path": "images/0f6a09d6fb8b72ff96757b9c4d679b7d1184f5c57918e40a7bebaf2a432cd1f6.jpg",
590
+ "table_caption": [
591
+ "Table 1: The MOS and SMOS scores with $9 5 \\%$ confidence intervals when adapting the source AdaSpeech model (trained on LibriTTS) to LJSpeech, VCTK and LibriTTS datasets. The third column shows the number of additional parameters for each custom voice during adaptation (the number in bracket shows the number of parameters in inference following the practice in Section 2.3). "
592
+ ],
593
+ "table_footnote": [],
594
+ "table_body": "<table><tr><td>Metric</td><td>Setting</td><td>|#Params/Speaker</td><td>LJSpeech</td><td>VCTK</td><td>LibriTTS</td></tr><tr><td rowspan=\"5\">MOS</td><td>GT</td><td>/</td><td>3.98±0.12</td><td>3.87± 0.11</td><td>3.72 ± 0.12</td></tr><tr><td>GT mel + Vocoder</td><td>/</td><td>3.75 ±0.10</td><td>3.74 ±0.11</td><td>3.65 ± 0.12</td></tr><tr><td>Baseline (spk emb) Baseline (decoder)</td><td>256 (256) 14.1M (14.1M)</td><td>2.37 ± 0.14</td><td>2.36 ±0.10</td><td>3.02±0.13</td></tr><tr><td></td><td></td><td>3.44 ± 0.13</td><td>3.35 ± 0.12</td><td>3.51 ±0.11</td></tr><tr><td>AdaSpeech</td><td>1.2M (4.9K)</td><td>3.45 ± 0.11</td><td>3.39 ±0.10</td><td>3.55± 0.12</td></tr><tr><td rowspan=\"5\">SMOS</td><td>GT</td><td>/</td><td>4.36 ± 0.11</td><td>4.44 ± 0.10</td><td>4.31 ± 0.07</td></tr><tr><td>GT mel + Vocoder</td><td>/</td><td>4.29 ± 0.11</td><td>4.36 ± 0.11</td><td>4.31± 0.07</td></tr><tr><td>Baseline (spk emb)</td><td>256 (256)</td><td>2.79 ± 0.19</td><td>3.34± 0.19</td><td>4.00 ± 0.12</td></tr><tr><td>Baseline (decoder)</td><td>14.1M (14.1M)</td><td>3.57± 0.12</td><td>3.90± 0.12</td><td>4.10 ±0.10</td></tr><tr><td> AdaSpeech</td><td>1.2M (4.9K)</td><td>3.59 ± 0.15</td><td>3.96± 0.15</td><td>4.13± 0.09</td></tr></table>",
595
+ "bbox": [
596
+ 173,
597
+ 101,
598
+ 826,
599
+ 303
600
+ ],
601
+ "page_idx": 6
602
+ },
603
+ {
604
+ "type": "text",
605
+ "text": "The MOS and SMOS results are shown in Table 1. We have several observations: 1) Adapting the model (trained on LibriTTS) to the cross-domain datasets (LJSpeech and VCTK) is more difficult than adapting to the in-domain datasets (LibriTTS), since the MOS and SMOS gap between the adaptation models (two baselines and AdaSpeech) and the ground-truth mel $^ +$ vocoder setting is bigger on cross-domain datasets7. This also confirms the challenges of modeling different acoustic conditions in custom voice scenarios. 2) Compared with only fine-tuning speaker embedding, i.e., Baseline (spk emb), AdaSpeech achieves significant improvements in terms of both MOS and SMOS in the three adaptation datasets, by only leveraging slightly more parameters in conditional layer normalization. We also analyze in next subsection (Table 3) that even if we increase the adaptation parameters of baseline to match or surpass that in AdaSpeech, it still performs much worse than AdaSpeech. 3) Compared with fine-tuning the whole decoder, i.e., Baseline (decoder), AdaSpeech achieves slightly better quality in both MOS and SMOS and importantly with much smaller adaptation parameters, which demonstrates the effectiveness and efficiency of our proposed acoustic condition modeling and conditional layer normalization. Note that fine-tuning the whole decoder causes too much adaptation parameters that cannot satisfy the custom voice scenario. ",
606
+ "bbox": [
607
+ 173,
608
+ 388,
609
+ 825,
610
+ 597
611
+ ],
612
+ "page_idx": 6
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "4.2 METHOD ANALYSIS ",
617
+ "text_level": 1,
618
+ "bbox": [
619
+ 174,
620
+ 608,
621
+ 354,
622
+ 622
623
+ ],
624
+ "page_idx": 6
625
+ },
626
+ {
627
+ "type": "text",
628
+ "text": "In this section, we first conduct ablation studies to verify the effectiveness of each component in AdaSpeech, including utterance-level and phonemelevel acoustic condition modeling, and conditional layer normalization, and then conduct more detailed analyses on our proposed AdaSpeech. ",
629
+ "bbox": [
630
+ 174,
631
+ 633,
632
+ 517,
633
+ 717
634
+ ],
635
+ "page_idx": 6
636
+ },
637
+ {
638
+ "type": "table",
639
+ "img_path": "images/f0ae6d6caebcf00b31cfe68249141b9021546d91f8bb83c04fabe6ef5f8ee980.jpg",
640
+ "table_caption": [
641
+ "Table 2: The CMOS of the ablation study on VCTK. UL-ACM and PL-ACM represents utterance-level and phoneme-level acoustic condition modeling, and CLN represents conditional layer normalization. "
642
+ ],
643
+ "table_footnote": [],
644
+ "table_body": "<table><tr><td>Setting</td><td>CMOS</td></tr><tr><td>AdaSpeech</td><td>0</td></tr><tr><td>AdaSpeech w/o UL-ACM AdaSpeech w/o PL-ACM AdaSpeech w/o CLN</td><td>-0.12 -0.21 -0.14</td></tr></table>",
645
+ "bbox": [
646
+ 547,
647
+ 621,
648
+ 805,
649
+ 714
650
+ ],
651
+ "page_idx": 6
652
+ },
653
+ {
654
+ "type": "text",
655
+ "text": "Ablation Study We compare the CMOS (comparison MOS) of the adaptation voice quality when removing each component in AdaSpeech on VCTK testset (each sentence is listened by 20 judgers). Specifically, when removing conditional layer normalization, we only fine-tune the speaker embedding. From Table 2, we can see that removing utterance-level and phoneme-level acoustic modeling, and conditional layer normalization all result in performance drop in voice quality, demonstrating the effectiveness of each component in AdaSpeech. ",
656
+ "bbox": [
657
+ 173,
658
+ 733,
659
+ 517,
660
+ 801
661
+ ],
662
+ "page_idx": 6
663
+ },
664
+ {
665
+ "type": "text",
666
+ "text": "",
667
+ "bbox": [
668
+ 178,
669
+ 803,
670
+ 823,
671
+ 843
672
+ ],
673
+ "page_idx": 6
674
+ },
675
+ {
676
+ "type": "text",
677
+ "text": "Analyses on Acoustic Condition Modeling We analyze the vectors extracted from the utterancelevel acoustic encoder for several speakers on LibriTTS datasets. We use t-SNE (Maaten & Hinton, ",
678
+ "bbox": [
679
+ 174,
680
+ 859,
681
+ 823,
682
+ 887
683
+ ],
684
+ "page_idx": 6
685
+ },
686
+ {
687
+ "type": "image",
688
+ "img_path": "images/20d44f231397740e61ebc70e686f9e8cb055d74084454170043752107ac8df7c.jpg",
689
+ "image_caption": [
690
+ "Figure 4: (a) The visualization of utterance-level acoustic vectors for several speakers (each number in the legend represents a speaker ID in LibriTTS datasets). (b) The MOS of different adaptation data on LJSpeech and VCTK. "
691
+ ],
692
+ "image_footnote": [],
693
+ "bbox": [
694
+ 184,
695
+ 104,
696
+ 794,
697
+ 301
698
+ ],
699
+ "page_idx": 7
700
+ },
701
+ {
702
+ "type": "text",
703
+ "text": "2008) to illustrate them in Figure 4a, where each point represents an utterance-level vector and each color belongs to the same speaker. It can be seen that different utterances of the same speaker are clustered together but have difference in acoustic conditions. There are some exceptions, such as the two pink points one blue point in the brown solid circle. According to our investigation on the corresponding speech data, these points correspond to the utterances with short and emotional voice, and thus are close to each other although belonging to different speakers. ",
704
+ "bbox": [
705
+ 173,
706
+ 366,
707
+ 825,
708
+ 449
709
+ ],
710
+ "page_idx": 7
711
+ },
712
+ {
713
+ "type": "text",
714
+ "text": "Analyses on Conditional Layer Normalization We further compare conditional layer normalization (CLN) with other two settings: 1) $\\mathrm { L N } +$ fine-tune scale/bias: removing the condition on speaker embedding, and only fine-tuning scale/bias in layer normalization and speaker embedding; 2) $\\mathrm { ~ L N ~ } +$ fine-tuning others: removing the condition on speaker embedding, and instead fine-tuning other (similar or even larger amount of) parameters in the decoder8. The CMOS evaluations are shown in Table 3. It can be seen that both settings result in worse quality compared with conditional layer normalization, which verifies its effectiveness. ",
715
+ "bbox": [
716
+ 174,
717
+ 465,
718
+ 549,
719
+ 606
720
+ ],
721
+ "page_idx": 7
722
+ },
723
+ {
724
+ "type": "table",
725
+ "img_path": "images/f2ae598e272212dfc8f9698ce4fa960fb6de7964c596c9a24382866020661a5f.jpg",
726
+ "table_caption": [],
727
+ "table_footnote": [
728
+ "Table 3: The CMOS on VCTK for the comparison of conditional layer normalization. "
729
+ ],
730
+ "table_body": "<table><tr><td>Setting CMOS</td></tr><tr><td>CLN 0</td></tr><tr><td>LN + fine-tune scale/bias -0.18</td></tr><tr><td>LN + fine-tune others -0.24</td></tr></table>",
731
+ "bbox": [
732
+ 563,
733
+ 470,
734
+ 821,
735
+ 544
736
+ ],
737
+ "page_idx": 7
738
+ },
739
+ {
740
+ "type": "text",
741
+ "text": "",
742
+ "bbox": [
743
+ 178,
744
+ 606,
745
+ 691,
746
+ 618
747
+ ],
748
+ "page_idx": 7
749
+ },
750
+ {
751
+ "type": "text",
752
+ "text": "Varying Adaptation Data We study the voice quality with different amount of adaptation data (fewer than the default setting) on VCTK and LJSpeech, and conduct MOS evaluation as shown in Figure 4b. It can be seen that the voice quality continue drops when adaptation data decreases, and drops quickly when the adaptation data is fewer than 10 sentences. ",
753
+ "bbox": [
754
+ 174,
755
+ 635,
756
+ 825,
757
+ 690
758
+ ],
759
+ "page_idx": 7
760
+ },
761
+ {
762
+ "type": "text",
763
+ "text": "5 CONCLUSIONS ",
764
+ "text_level": 1,
765
+ "bbox": [
766
+ 176,
767
+ 712,
768
+ 328,
769
+ 728
770
+ ],
771
+ "page_idx": 7
772
+ },
773
+ {
774
+ "type": "text",
775
+ "text": "In this paper, we have developed AdaSpeech, an adaptive TTS system to support the distinctive requirements in custom voice. We propose acoustic condition modeling to make the source TTS model more adaptable for custom voice with various acoustic conditions. We further design conditional layer normalization to improve the adaptation efficiency: fine-tuning few model parameters to achieve high voice quality. We finally present the pipeline of pre-training, fine-tuning and inference in AdaSpeech for custom voice. Experiment results demonstrate that AdaSpeech can support custom voice with different acoustic conditions with few memory storage and at the same time with high voice quality. For future work, we will further improve the modeling of acoustic conditions in the source TTS model and study more diverse acoustic conditions such as noisy speech in custom voice. We will also investigate the adaptation setting with untranscribed data (Yan et al., 2021) and further compress the model size (Luo et al., 2021) to support more custom voices. ",
776
+ "bbox": [
777
+ 174,
778
+ 733,
779
+ 825,
780
+ 886
781
+ ],
782
+ "page_idx": 7
783
+ },
784
+ {
785
+ "type": "text",
786
+ "text": "REFERENCES ",
787
+ "text_level": 1,
788
+ "bbox": [
789
+ 176,
790
+ 102,
791
+ 287,
792
+ 117
793
+ ],
794
+ "page_idx": 8
795
+ },
796
+ {
797
+ "type": "text",
798
+ "text": "Sercan Arik, Jitong Chen, Kainan Peng, Wei Ping, and Yanqi Zhou. Neural voice cloning with a few samples. In Advances in Neural Information Processing Systems, pp. 10019–10029, 2018. ",
799
+ "bbox": [
800
+ 174,
801
+ 125,
802
+ 821,
803
+ 155
804
+ ],
805
+ "page_idx": 8
806
+ },
807
+ {
808
+ "type": "text",
809
+ "text": "Sercan O Arik, Mike Chrzanowski, Adam Coates, Gregory Diamos, Andrew Gibiansky, Yongguo Kang, Xian Li, John Miller, Andrew $\\mathrm { N g }$ , Jonathan Raiman, et al. Deep voice: Real-time neural text-to-speech. arXiv preprint arXiv:1702.07825, 2017. ",
810
+ "bbox": [
811
+ 174,
812
+ 161,
813
+ 823,
814
+ 204
815
+ ],
816
+ "page_idx": 8
817
+ },
818
+ {
819
+ "type": "text",
820
+ "text": "Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. ",
821
+ "bbox": [
822
+ 171,
823
+ 212,
824
+ 823,
825
+ 242
826
+ ],
827
+ "page_idx": 8
828
+ },
829
+ {
830
+ "type": "text",
831
+ "text": "Mingjian Chen, Xu Tan, Yi Ren, Jin Xu, Hao Sun, Sheng Zhao, and Tao Qin. Multispeech: Multispeaker text to speech with transformer. Proc. Interspeech 2020, pp. 4024–4028, 2020. ",
832
+ "bbox": [
833
+ 171,
834
+ 250,
835
+ 823,
836
+ 280
837
+ ],
838
+ "page_idx": 8
839
+ },
840
+ {
841
+ "type": "text",
842
+ "text": "Yutian Chen, Yannis Assael, Brendan Shillingford, David Budden, Scott Reed, Heiga Zen, Quan Wang, Luis C Cobo, Andrew Trask, Ben Laurie, et al. Sample efficient adaptive text-to-speech. arXiv preprint arXiv:1809.10460, 2018. ",
843
+ "bbox": [
844
+ 174,
845
+ 286,
846
+ 826,
847
+ 329
848
+ ],
849
+ "page_idx": 8
850
+ },
851
+ {
852
+ "type": "text",
853
+ "text": "Erica Cooper, Cheng-I Lai, Yusuke Yasuda, Fuming Fang, Xin Wang, Nanxin Chen, and Junichi Yamagishi. Zero-shot multi-speaker text-to-speech with state-of-the-art neural speaker embeddings. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6184–6188. IEEE, 2020. ",
854
+ "bbox": [
855
+ 174,
856
+ 337,
857
+ 826,
858
+ 393
859
+ ],
860
+ "page_idx": 8
861
+ },
862
+ {
863
+ "type": "text",
864
+ "text": "Andrew Gibiansky, Sercan Arik, Gregory Diamos, John Miller, Kainan Peng, Wei Ping, Jonathan Raiman, and Yanqi Zhou. Deep voice 2: Multi-speaker neural text-to-speech. In Advances in neural information processing systems, pp. 2962–2970, 2017. ",
865
+ "bbox": [
866
+ 174,
867
+ 401,
868
+ 823,
869
+ 445
870
+ ],
871
+ "page_idx": 8
872
+ },
873
+ {
874
+ "type": "text",
875
+ "text": "Keith Ito. The lj speech dataset. https://keithito.com/LJ-Speech-Dataset/, 2017. ",
876
+ "bbox": [
877
+ 169,
878
+ 452,
879
+ 820,
880
+ 468
881
+ ],
882
+ "page_idx": 8
883
+ },
884
+ {
885
+ "type": "text",
886
+ "text": "Ye Jia, Yu Zhang, Ron Weiss, Quan Wang, Jonathan Shen, Fei Ren, Patrick Nguyen, Ruoming Pang, Ignacio Lopez Moreno, Yonghui Wu, et al. Transfer learning from speaker verification to multispeaker text-to-speech synthesis. In Advances in neural information processing systems, pp. 4480–4490, 2018. ",
887
+ "bbox": [
888
+ 174,
889
+ 476,
890
+ 826,
891
+ 531
892
+ ],
893
+ "page_idx": 8
894
+ },
895
+ {
896
+ "type": "text",
897
+ "text": "Jaehyeon Kim, Sungwon Kim, Jungil Kong, and Sungroh Yoon. Glow-tts: A generative flow for text-to-speech via monotonic alignment search. arXiv preprint arXiv:2005.11129, 2020. ",
898
+ "bbox": [
899
+ 169,
900
+ 540,
901
+ 823,
902
+ 569
903
+ ],
904
+ "page_idx": 8
905
+ },
906
+ {
907
+ "type": "text",
908
+ "text": "Zvi Kons, Slava Shechtman, Alex Sorin, Carmel Rabinovitz, and Ron Hoory. High quality, lightweight and adaptable tts using lpcnet. arXiv preprint arXiv:1905.00590, 2019. ",
909
+ "bbox": [
910
+ 169,
911
+ 577,
912
+ 823,
913
+ 607
914
+ ],
915
+ "page_idx": 8
916
+ },
917
+ {
918
+ "type": "text",
919
+ "text": "Kundan Kumar, Rithesh Kumar, Thibault de Boissiere, Lucas Gestin, Wei Zhen Teoh, Jose Sotelo, Alexandre de Brébisson, Yoshua Bengio, and Aaron C Courville. Melgan: Generative adversarial networks for conditional waveform synthesis. In Advances in Neural Information Processing Systems, pp. 14910–14921, 2019. ",
920
+ "bbox": [
921
+ 174,
922
+ 613,
923
+ 825,
924
+ 670
925
+ ],
926
+ "page_idx": 8
927
+ },
928
+ {
929
+ "type": "text",
930
+ "text": "Chao Li, Xiaokong Ma, Bing Jiang, Xiangang Li, Xuewei Zhang, Xiao Liu, Ying Cao, Ajay Kannan, and Zhenyao Zhu. Deep speaker: an end-to-end neural speaker embedding system. arXiv preprint arXiv:1705.02304, 2017. ",
931
+ "bbox": [
932
+ 173,
933
+ 678,
934
+ 825,
935
+ 720
936
+ ],
937
+ "page_idx": 8
938
+ },
939
+ {
940
+ "type": "text",
941
+ "text": "Renqian Luo, Xu Tan, Rui Wang, Tao Qin, Jinzhu Li, Sheng Zhao, Enhong Chen, and Tie-Yan Liu. Lightspeech: Lightweight and fast text to speech with neural architecture search. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021. ",
942
+ "bbox": [
943
+ 174,
944
+ 728,
945
+ 826,
946
+ 772
947
+ ],
948
+ "page_idx": 8
949
+ },
950
+ {
951
+ "type": "text",
952
+ "text": "Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008. ",
953
+ "bbox": [
954
+ 171,
955
+ 780,
956
+ 823,
957
+ 809
958
+ ],
959
+ "page_idx": 8
960
+ },
961
+ {
962
+ "type": "text",
963
+ "text": "Michael McAuliffe, Michaela Socolof, Sarah Mihuc, Michael Wagner, and Morgan Sonderegger. Montreal forced aligner: Trainable text-speech alignment using kaldi. In Interspeech, pp. 498–502, 2017. ",
964
+ "bbox": [
965
+ 173,
966
+ 816,
967
+ 826,
968
+ 859
969
+ ],
970
+ "page_idx": 8
971
+ },
972
+ {
973
+ "type": "text",
974
+ "text": "Henry B Moss, Vatsal Aggarwal, Nishant Prateek, Javier González, and Roberto Barra-Chicote. Boffin tts: Few-shot speaker adaptation by bayesian optimization. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7639–7643. IEEE, 2020. ",
975
+ "bbox": [
976
+ 174,
977
+ 867,
978
+ 826,
979
+ 922
980
+ ],
981
+ "page_idx": 8
982
+ },
983
+ {
984
+ "type": "text",
985
+ "text": "Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5206–5210. IEEE, 2015. ",
986
+ "bbox": [
987
+ 176,
988
+ 103,
989
+ 823,
990
+ 146
991
+ ],
992
+ "page_idx": 9
993
+ },
994
+ {
995
+ "type": "text",
996
+ "text": "Kainan Peng, Wei Ping, Zhao Song, and Kexin Zhao. Non-autoregressive neural text-to-speech. ICML, 2020. ",
997
+ "bbox": [
998
+ 173,
999
+ 155,
1000
+ 825,
1001
+ 184
1002
+ ],
1003
+ "page_idx": 9
1004
+ },
1005
+ {
1006
+ "type": "text",
1007
+ "text": "Wei Ping, Kainan Peng, Andrew Gibiansky, Sercan O. Arik, Ajay Kannan, Sharan Narang, Jonathan Raiman, and John Miller. Deep voice 3: 2000-speaker neural text-to-speech. In International Conference on Learning Representations, 2018. ",
1008
+ "bbox": [
1009
+ 176,
1010
+ 193,
1011
+ 823,
1012
+ 234
1013
+ ],
1014
+ "page_idx": 9
1015
+ },
1016
+ {
1017
+ "type": "text",
1018
+ "text": "Yi Ren, Yangjun Ruan, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. Fastspeech: Fast, robust and controllable text to speech. In NeurIPS, 2019. ",
1019
+ "bbox": [
1020
+ 173,
1021
+ 243,
1022
+ 825,
1023
+ 272
1024
+ ],
1025
+ "page_idx": 9
1026
+ },
1027
+ {
1028
+ "type": "text",
1029
+ "text": "Yi Ren, Chenxu Hu, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. Fastspeech 2: Fast and high-quality end-to-end text-to-speech. In ICLR, 2021. ",
1030
+ "bbox": [
1031
+ 174,
1032
+ 281,
1033
+ 823,
1034
+ 310
1035
+ ],
1036
+ "page_idx": 9
1037
+ },
1038
+ {
1039
+ "type": "text",
1040
+ "text": "Jonathan Shen, Ruoming Pang, Ron J Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, Rj Skerrv-Ryan, et al. Natural tts synthesis by conditioning wavenet on mel spectrogram predictions. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4779–4783. IEEE, 2018. ",
1041
+ "bbox": [
1042
+ 173,
1043
+ 319,
1044
+ 826,
1045
+ 376
1046
+ ],
1047
+ "page_idx": 9
1048
+ },
1049
+ {
1050
+ "type": "text",
1051
+ "text": "Guangzhi Sun, Yu Zhang, Ron J Weiss, Yuan Cao, Heiga Zen, Andrew Rosenberg, Bhuvana Ramabhadran, and Yonghui Wu. Generating diverse and natural text-to-speech samples using a quantized fine-grained vae and autoregressive prosody prior. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6699–6703. IEEE, 2020. ",
1052
+ "bbox": [
1053
+ 173,
1054
+ 385,
1055
+ 826,
1056
+ 441
1057
+ ],
1058
+ "page_idx": 9
1059
+ },
1060
+ {
1061
+ "type": "text",
1062
+ "text": "Hao Sun, Xu Tan, Jun-Wei Gan, Hongzhi Liu, Sheng Zhao, Tao Qin, and Tie-Yan Liu. Token-level ensemble distillation for grapheme-to-phoneme conversion. In INTERSPEECH, 2019. ",
1063
+ "bbox": [
1064
+ 173,
1065
+ 450,
1066
+ 823,
1067
+ 479
1068
+ ],
1069
+ "page_idx": 9
1070
+ },
1071
+ {
1072
+ "type": "text",
1073
+ "text": "Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008, 2017. ",
1074
+ "bbox": [
1075
+ 176,
1076
+ 488,
1077
+ 823,
1078
+ 531
1079
+ ],
1080
+ "page_idx": 9
1081
+ },
1082
+ {
1083
+ "type": "text",
1084
+ "text": "Christophe Veaux, Junichi Yamagishi, Kirsten MacDonald, et al. Superseded-cstr vctk corpus: English multi-speaker corpus for cstr voice cloning toolkit. 2016. ",
1085
+ "bbox": [
1086
+ 169,
1087
+ 540,
1088
+ 825,
1089
+ 569
1090
+ ],
1091
+ "page_idx": 9
1092
+ },
1093
+ {
1094
+ "type": "text",
1095
+ "text": "Li Wan, Quan Wang, Alan Papir, and Ignacio Lopez Moreno. Generalized end-to-end loss for speaker verification. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4879–4883. IEEE, 2018. ",
1096
+ "bbox": [
1097
+ 176,
1098
+ 577,
1099
+ 823,
1100
+ 619
1101
+ ],
1102
+ "page_idx": 9
1103
+ },
1104
+ {
1105
+ "type": "text",
1106
+ "text": "Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: Towards end-to-end speech synthesis. arXiv preprint arXiv:1703.10135, 2017. ",
1107
+ "bbox": [
1108
+ 176,
1109
+ 628,
1110
+ 823,
1111
+ 672
1112
+ ],
1113
+ "page_idx": 9
1114
+ },
1115
+ {
1116
+ "type": "text",
1117
+ "text": "Yuzi Yan, Xu Tan, Bohan Li, Tao Qin, Sheng Zhao, Yuan Shen, and Tie-Yan Liu. Adaspeech 2: Adaptive text to speech with untranscribed data. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021. ",
1118
+ "bbox": [
1119
+ 176,
1120
+ 680,
1121
+ 823,
1122
+ 723
1123
+ ],
1124
+ "page_idx": 9
1125
+ },
1126
+ {
1127
+ "type": "text",
1128
+ "text": "Heiga Zen, Viet Dang, Rob Clark, Yu Zhang, Ron J Weiss, Ye Jia, Zhifeng Chen, and Yonghui Wu. Libritts: A corpus derived from librispeech for text-to-speech. arXiv preprint arXiv:1904.02882, 2019. ",
1129
+ "bbox": [
1130
+ 173,
1131
+ 732,
1132
+ 826,
1133
+ 775
1134
+ ],
1135
+ "page_idx": 9
1136
+ },
1137
+ {
1138
+ "type": "text",
1139
+ "text": "Zhen Zeng, Jianzong Wang, Ning Cheng, and Jing Xiao. Prosody learning mechanism for speech synthesis system without text length limit. arXiv preprint arXiv:2008.05656, 2020. ",
1140
+ "bbox": [
1141
+ 171,
1142
+ 784,
1143
+ 823,
1144
+ 813
1145
+ ],
1146
+ "page_idx": 9
1147
+ },
1148
+ {
1149
+ "type": "text",
1150
+ "text": "Chen Zhang, Yi Ren, Xu Tan, Jinglin Liu, Kejun Zhang, Tao Qin, Sheng Zhao, and Tie-Yan Liu. Denoispeech: Denoising text to speech with frame-level noise modeling. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021. ",
1151
+ "bbox": [
1152
+ 174,
1153
+ 820,
1154
+ 825,
1155
+ 864
1156
+ ],
1157
+ "page_idx": 9
1158
+ },
1159
+ {
1160
+ "type": "text",
1161
+ "text": "Zewang Zhang, Qiao Tian, Heng Lu, Ling-Hui Chen, and Shan Liu. Adadurian: Few-shot adaptation for neural text-to-speech with durian. arXiv preprint arXiv:2005.05642, 2020. ",
1162
+ "bbox": [
1163
+ 174,
1164
+ 873,
1165
+ 823,
1166
+ 901
1167
+ ],
1168
+ "page_idx": 9
1169
+ }
1170
+ ]
parse/train/Drynvt7gg4L/Drynvt7gg4L_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HJGv1Z-AW/HJGv1Z-AW.md ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EMERGENCE OF LINGUISTIC COMMUNICATION FROM REFERENTIAL GAMES WITH SYMBOLIC AND PIXEL INPUT
2
+
3
+ Angeliki Lazaridou∗, Karl Moritz Hermann, Karl Tuyls, Stephen Clark
4
+ DeepMind,
5
+ London, UK
6
+
7
+ # ABSTRACT
8
+
9
+ The ability of algorithms to evolve or learn (compositional) communication protocols has traditionally been studied in the language evolution literature through the use of emergent communication tasks. Here we scale up this research by using contemporary deep learning methods and by training reinforcement-learning neural network agents on referential communication games. We extend previous work, in which agents were trained in symbolic environments, by developing agents which are able to learn from raw pixel data, a more challenging and realistic input representation. We find that the degree of structure found in the input data affects the nature of the emerged protocols, and thereby corroborate the hypothesis that structured compositional language is most likely to emerge when agents perceive the world as being structured.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The study of emergent communication is important for two related problems in language development, both human and artificial: language evolution, the development of communication protocols from scratch (Nowak & Krakauer, 1999); and language acquisition, the ability of an embodied agent to learn an existing language. In this paper we focus on the problem of how environmental or pre-linguistic conditions affect the nature of the communication protocol that an agent learns. The increasing realism and complexity of environments being used for grounded language learning (Brockman et al., 2016; Hermann et al., 2017) present an opportunity to analyse these effects in detail.
14
+
15
+ In line with previous work on emergent communication, we are strongly motivated by the view that language derives meaning from its use (Wittgenstein, 1953; Wagner et al., 2003). This perspective especially motivates the study of language emergence in cases where co-operative agents try to achieve shared goals in game scenarios (Steels, 2003; Brighton & Kirby, 2006; Mordatch & Abbeel, 2017), and is related to the study of multi-agent and self-play methods that have found great success in other areas of machine learning (Bansal et al., 2017; Silver et al., 2017). Here we focus on simple referential games, in which one agent must communicate to another a target object in the agent’s environment.
16
+
17
+ One of the most important properties of natural language is compositionality. Smaller building blocks (e.g. words, morphemes) are used to generate unbounded numbers of more complex forms (e.g. sentences, multi-word expressions), with the meaning of the larger form being determined by the meanings of its parts and how they are put together (Frege, 1892). Compositionality is an advantage in any communication protocol as it allows in principle infinite expression through a finite dictionary and a finite set of combination rules. In emergent communication research, previous work has shown that agents can produce (somewhat) compositional protocols when engaging in language games (Steels, 2003). However, the computational agents were typically situated in artificial worlds containing just a handful of objects, represented as disentangled, structured, and sometimes even atomic symbols, e.g. attribute-based or one-hot vectors (Batali, 1998; Brighton, 2002; Franke, 2015; Andreas & Klein, 2017; Mordatch & Abbeel, 2017). However, humans receive raw sensorimotor rather than symbolic input, and little work to date has tested whether these findings carry over when agents are situated in less idealized worlds that bear more similarity to the kind of entangled and noisy environments to which humans are typically exposed.1
18
+
19
+ ![](images/aea3a2fceb920cffdae0270c243ac52b72776e4d05ae8e6a4c4b0000f5f4d17a.jpg)
20
+ Figure 1: High-level overview of the referential game.
21
+
22
+ In this work, in the context of referential communication games (see Figure 1), we contrast the results of two studies that lie at the extremes of how much structure is provided by the environment. The first study (Section 3) focuses on symbolic representations, where objects are represented as bags-of-attributes; this representation is inherently disentangled since dimensions encode individual properties. The second study (Section 4) considers raw perceptual input, hence data that more closely resembles what humans are exposed to. Clearly, the latter is a more challenging and realistic scenario as the computational agents are operating on entangled inputs with no pre-coded semantics. Crucially, both studies use the same referential game setup, the same learning procedure (policy learning methods) and the same neural network agent architectures.
23
+
24
+ We show that reinforcement learning agents can successfully communicate, not only when presented with symbolic and highly structured input data, but (and more importantly) even when presented with raw pixel input. This result opens up the possibility of more realistic simulations of language emergence. We successfully use the learning signal from the referential game to train agents end-to-end, including cases where the agents need to perform visual processing of images with a convolutional neural network. However, we find that the agents struggle to produce structured messages when presented with entangled input data (Bengio et al., 2013) due to the difficulty of uncovering the true factors of variation, corroborating the hypothesis of Smith et al. (2003) that structured (compositional) language is most likely to emerge when agents perceive the world as structured.
25
+
26
+ # 2 REFERENTIAL GAMES AS MULTI-AGENT CO-OPERATIVEREINFORCEMENT LEARNING
27
+
28
+ The referential game is implemented as an instance of multi-agent co-operative reinforcement learning, in which two agents take discrete actions in their environment in order to maximize a shared reward.
29
+
30
+ # 2.1 GAME AND TERMINOLOGY
31
+
32
+ The referential game is a variant of the Lewis signaling game (Lewis, 1969), which has been extensively used in linguistic and cognitive studies in the context of language evolution (e.g., Briscoe, 2002; Cangelosi & Parisi, 2002; Steels & Loetzsch, 2012; Spike et al., 2016; Lazaridou et al., 2017).
33
+
34
+ Figure 1 provides a schematic description of our setup. First, a speaker is presented with a target object (highlighted as CAR in the symbolic example on the left, and highlighted as the far right image in the pixel example on the right). Then, by making use of an alphabet consisting of primitive discrete symbols $( ^ { \ast \cdot } 2 2 ^ { \cdot \prime } , ^ { \cdot \cdot } 1 0 ^ { \cdot \prime } , ^ { \cdot \cdot } 0 ^ { \cdot \prime } , ^ { \cdot \cdot } 2 ^ { \cdot \prime } )$ , the speaker constructs a message describing that object (“22 $2 0 ^ { \circ } )$ . We will refer to the set of all distinct messages generated by the speaker as their lexicon or protocol. Finally, the listener is presented with the target and a set of distractor objects, and—by making use of the speaker’s message—has to identify the target object from the set of candidate objects. Communicative success is defined as the correct identification of the target by the listening agent.
35
+
36
+ Formally, the attribute-based object vectors (disentangled) or the pixel-based images (entangled) are the set of pre-linguistic items $W = \{ o _ { 1 } , \ldots , o _ { N } \}$ . From this set we draw a target $t \in W$ and subsequently $K - 1$ distractors $D = \{ d _ { 1 } , \dots , d _ { K - 1 } \} \subset W$ s.t. ∀j $t \neq d _ { j }$ . The speaker has only access to the target $t$ , while the listener receives candidate set $C = t \cup D$ , not knowing which of the elements in $C$ is target $t$ .
37
+
38
+ # 2.2 AGENTS
39
+
40
+ The speaker encodes $t$ into a dense representation $u$ using an encoder $f ^ { S } ( t , \theta _ { f } ^ { S } )$ . The function of this encoder depends on the type of pre-linguistic data used and is discussed separately for each study. Given an alphabet $A$ of discrete unit symbols (akin to words) and $u$ , the speaker next generates a discrete, variable-length, bounded message m by sampling symbols from a recurrent policy $\pi ^ { S }$ defined by a decoder $\check { g } ^ { S } ( u , \theta _ { g } ^ { S } )$ . The sequence generation is terminated either by the production of a stop symbol or when the maximum length $L$ has been reached. We implement the decoder as a single-layer LSTM (Hochreiter $\&$ Schmidhuber, 1997). Note that the symbols in the agents’ alphabet $A$ have no a priori meaning; rather, these symbols get grounded during the game.
41
+
42
+ The listening agent uses a similar encoder to the speaker but has independent network weights $( \theta _ { f } ^ { L } )$ . Applying this encoder to all candidate objects results in a set $U = \{ f ^ { L } ( c , \theta _ { f } ^ { L } ) \mid c \in C \}$ . For encoding the message $\mathbf { m }$ , we use a single-layer LSTM, denoted $h ^ { L }$ , which produces an encoding $z$ : $z = h ^ { L } ( \mathbf { \bar { m } } , \theta _ { h } ^ { L } )$ .
43
+
44
+ Given encoded message $z$ and candidates $U$ , the listener predicts a target object $t ^ { \prime } \in C$ following a policy $\pi ^ { L }$ implemented using a non-parametric pointing module; this module samples the predicted object from a Gibbs distribution computed via the dot product between vector $z$ and all encoded candidates $u \in U$ . See Appendix B for information regarding the agents’ architecture.
45
+
46
+ At inference time, we replace the stochastic sampling of the speaker’s message and the listener’s stochastic pointing module with deterministic processes. For the pointing module, the object with the highest probability is chosen. For the speaker’s message, this is generated in a greedy fashion by selecting the highest-probability symbol at each step.
47
+
48
+ # 2.3 LEARNING
49
+
50
+ All weights of the speaker and listener agents, $\theta = \{ \theta _ { f } ^ { S } , \theta _ { g } ^ { S } , \theta _ { f } ^ { L } , \theta _ { h } ^ { L } \}$ , are jointly optimized while playing the game. We emphasize that no weights are shared between the speaker and the listener, and the only supervision used is communicative success, i.e. whether the listener identified the correct target. The objective function that the two agents maximize for one training instance is:
51
+
52
+ $$
53
+ R ( t ^ { \prime } ) \left( \sum _ { l = 1 } ^ { L } \log p ( m _ { t } ^ { l } | m _ { t } ^ { < l } , u ) + \log p ( u _ { t ^ { \prime } } | z , U ) \right)
54
+ $$
55
+
56
+ where $R$ is the reward function returning 1 if $t = t ^ { \prime }$ (if the listener pointed to the correct target) and 0 otherwise. To maintain exploration in the speaker’s policy $\pi ^ { S }$ of generating a message, and the listener’s policy $\pi ^ { L }$ of pointing to the target, we add to the loss an entropy regularization term (Mnih et al., 2016). The parameters are estimated using the REINFORCE update rule (Williams, 1992). See Appendix $\mathbf { B }$ for more details regarding the learning.
57
+
58
+ <table><tr><td>max length</td><td>alphabet size</td><td>lexicon size</td><td>training accuracy</td><td>topographic p</td></tr><tr><td>2</td><td>10</td><td>31</td><td>92.0%</td><td>0.13</td></tr><tr><td>5</td><td>17</td><td>293</td><td>98.2%</td><td>0.16</td></tr><tr><td>10</td><td>40</td><td>355</td><td>98.5%</td><td>0.26</td></tr></table>
59
+
60
+ Table 1: Commumicative success (training accuracy in percentage) with varying maximum message length. alphabet size denotes the effective size of the symbol set used from a maximum of 100. lexicon size is the effective number of unique messages used. topographic $\rho$ reports the structural similarity in terms of Spearman $\rho$ correlation between the message and the object vector space. All Spearman $\rho$ correlations throughout the paper are significant with $p < 0 . 0 1$ .
61
+
62
+ # 3 STUDY 1: REFERENTIAL GAME WITH SYMBOLIC DATA
63
+
64
+ We first present experiments where agents are learning to communicate when presented with structured and disentangled input. We use the Visual Attributes for Concepts Dataset (VisA) of Silberer et al. (2013), which contains human-generated per-concept attribute annotations for 500 concrete concepts (e.g., cat, sofa, car) spanning across different categories (e.g., mammals, furniture, vehicles), annotated with 636 general attributes (e.g., has tail, is black, has wheels). We disregarded homonym concepts (e.g., bat), thus reducing our working set of concepts to 463 and the number of attributes to 573 (after eliminating any attribute that did not occur with the working concepts). On average, each concept has 11 attributes. All pre-linguistic objects are represented in terms of binary vectors $o \in \{ 0 , 1 \} ^ { 5 7 3 }$ . Note that these representations do carry some inherent structure; the dimensions in the object vectors are disentangled and so each object can be seen as a conjunction of properties. Speaker and listener convert the pre-linguistic representations to dense representations $u$ by using a single-layer MLP with a sigmoid activation function.
65
+
66
+ In all experiments, we set the number of candidate objects $K$ to five, meaning there were four wrong choices per correct one (resulting in a $2 0 \%$ random baseline). Inspired by Kottur et al. (2017), who show that non-compositional language emerges in the case of overcomplete alphabets, we set the size of alphabet $A$ to 100 symbols, which is smaller than the size of the set of objects (463).
67
+
68
+ # 3.1 AGENT PERFORMANCE AND AMBIGUITY
69
+
70
+ We first report model performance on the training data, comparing different settings for the maximal allowed message length (2, 5 or 10 symbols). Results are presented in Table 1 (ignore the last row topographic $\rho$ which will be explained in later sections).
71
+
72
+ In the case of the shortest message settings (maximum length 2), our trained agents on average only develop a protocol of 31 unique messages used to describe 363 training concepts (leaving aside 100 for testing). This indicates high levels of ambiguity, with each message being used to denote 11 concepts on average. Interestingly, recent findings suggest that ambiguity is a design feature of language that prevents the inefficient use of redundant codes, since some of the message content can be extracted from context: “the most efficient communication system will not convey information already provided by the context” (Piantadosi et al., 2012). In our case, we do no explicitly encode any bias towards ambiguity. We hypothesize that ambiguity arises due to the difficult exploration problem that agents are faced with, in combination with the fact that ambiguous protocols present a good local optimum that is over-represented in the hypothesis search space. As a result, in the absence of environmental pressures (e.g., a high number of carefully constructed distractors) a suboptimal policy can still achieve a reasonably high accuracy $( 9 2 \% )$ , making it even harder during training to escape from such a solution.
73
+
74
+ In classic signaling games, this polysemy phenomenon manifests itself as different states receiving the same signal and is termed partial pooling equilibrium (Skyrms, 2010). Perhaps rather counterintuitively, Skyrms (p.131) suggests that a way to obtain communication protocols that are robust to this type of local communication minima is to allow the invention of new signals, essentially increasing the search space of signals. Motivated by this suggestion, we play variants of the game in which we allow the agents to produce messages of greater maximum length (5 and 10), which leads to improved communicative success $9 8 . 2 \%$ and $9 8 . 5 \%$ respectively). We observe that the number of messages in the protocol increases from 31 to 293 and 355, respectively, reducing the average number of concepts a message can denote from 11 concepts to (approximately) 1 concept.
75
+
76
+ ![](images/f54b6c616adb9b6e25c20297338305d82c03c1c6cbacf39ded5809edadfd7eb1.jpg)
77
+ Figure 2: Training curves of different experimental setups with uniform and context-dependent target selection.
78
+
79
+ # 3.2 REALISTIC CONTEXT DISTRIBUTION
80
+
81
+ In the real world, when speakers refer to cats, listeners would likely be in a situation where they had to discriminate a cat in the context of a couch or a dog, rather than in the context of a mirror or a cow.2 Simply put, objects in the world do not appear in random contexts, but rather there is regularity in the distribution of situational and visual co-occurrences. This property of the world is typically not captured in referential games studied in the language emergence literature, with distractors usually drawn from a uniform distribution.
82
+
83
+ We address this issue and design an additional experiment with distractors sampled from a targetspecific context distribution reflecting normalized object co-occurrence statistics. Co-occurrence data is extracted from the MSCOCO caption dataset (Lin et al., 2014). This leads to more plausible distractor sets with, for instance, the target goat more likely being mixed with sheep and cow as distractors rather than bike or eggplant.
84
+
85
+ We find that the distractor selection process (uniform vs context-dependent) affects the language learning dynamics; see Figure 2 for training curves for different experimental configurations. While the non-uniform distractor sampling of the context-dependent setting can be exploited to learn a degenerate strategy —giving up to $40 \%$ communicative success shortly after the start of training— subsequently learning under this scenario takes longer. This effect is likely a combination of the local minimum achieved by the degenerate strategy of picking a target at random from only the topically relevant set of distractors, which initially makes the problem easier; however, the fact that the co-occurrence statistics tend to align with the feature vectors, means that similar objects are more likely to appear as distractors and hence the overall game becomes more difficult.
86
+
87
+ We now consider the question of how objects denoted by the same (ambiguous) message are related. When the context is drawn uniformly, object similarity is a predictor of object confusability, as similar objects tend to be mapped onto the same message (0.26 and 0.43 median pairwise cosine similarities of objects that received the same message as computed on the VisA space, for maximum message length 2 and 5, respectively). In the non-uniform case, we observe object confusability to be less influenced by object similarity (0.15 and 0.17 median pairwise cosine similarities of objects that received the same message, for maximum message length 2 and 5, respectively), but rather driven by the visual context co-occurrences. Simply put, in the non-uniform case confusability is less influenced by similarity since the agents must learn to distinguish between objects that naturally co-occur (e.g. sheep and goat). Thus, the choice of distractors, an experimental design decision that in existing language emergence literature has been neglected, has an effect on the organization (and potentially the naturalness) of the emerged language, for example as reflected in the semantics of ambiguous or homonym words in the language.
88
+
89
+ Table 2: Communicative success (acc in percentage) of agents evaluated on training (first row) and novel (last three rows) data. lexicon size column reports the percentage of novel messages (i.e., messages that were not used during the training).
90
+
91
+ <table><tr><td>Data</td><td>length 2 lexicon size</td><td>acc.</td><td>length 5 lexicon size</td><td>acc.</td><td>length 10 lexicon size</td><td>acc.</td></tr><tr><td>training data</td><td>31</td><td>92.0</td><td>293</td><td>98.2</td><td>355</td><td>98.5</td></tr><tr><td>test data</td><td>1</td><td>74.2</td><td>70</td><td>76.8</td><td>98</td><td>81.6</td></tr><tr><td>unigram chimera</td><td>5</td><td>39.3</td><td>88</td><td>40.5</td><td>99</td><td>47.0</td></tr><tr><td>uniform chimera</td><td>3</td><td>31.2</td><td>87</td><td>32.2</td><td>100</td><td>42.6</td></tr></table>
92
+
93
+ # 3.3 STRUCTURAL PROPERTIES OF EMERGED PROTOCOLS
94
+
95
+ Quantifying the degree of compositionality and structure found in the emerged language is a challenging task; to the best of our knowledge, there is no formal mathematical definition of compositionality that would allow for a definitive quantitative measure. Thus, research on this topic usually relies on defining necessary requirements that any language claiming to be compositional should adhere to, such as the ability to generalize to novel situations (Batali, 1998; Franke, 2015; Kottur et al., 2017). We adopt a similar strategy by measuring the extent to which an emerged language is able to generalize to novel objects (Section 3.3.1). Moreover, we also report quantitative results (Section 3.3.2) using a measure of message structure proposed in the language evolution literature (Brighton & Kirby, 2006; Carr et al., 2017).
96
+
97
+ # 3.3.1 GENERALIZATION TO NOVEL OBJECTS
98
+
99
+ We perform experiments where trained agents from Section 3.1 are exposed to different types of unseen objects, each of them differing to the degree to which the unseen objects resemble the objects found in the training data. In the test scenario, objects come from the same data distribution as the training data, but were not presented to the agents during training (e.g., a mouse); in the unigram chimeras scenario, the novel objects are constructed by sampling properties from a property-based distribution inferred from the training data, thus breaking any feature correlation (e.g., a mouselike animal with wheels); in the uniform chimeras scenario, the novel objects are constructed by uniformly sampling properties (e.g., a square red furry metallic object).
100
+
101
+ Table 2 reports the communicative success. While there is a drop in performance for unseen objects, agents are performing above random chance $( 2 0 \% )$ . The emerged language is indeed able to generalize to unseen objects; however, the degree of generalization is a function of the similarity between the training and unseen objects, thus resulting in the uniform chimeras setting obtaining the lowest performance.
102
+
103
+ Moreover, we observe examples of productivity, a key feature of compositionality. At test time, speakers are able to concoct novel messages on-the-fly (i.e., messages that are not part of their lexicon induced during training) to describe unseen objects. See the last three rows of Table 2, and the lexicon size column, for the percentage of novel messages. Even though listeners were not trained to associate novel messages with novel objects, they are still able comprehend such messages and correctly identify the target object. In the test data and length 10 cases, novel messages account for almost all of the generated messages, but with performance at $8 1 . 6 \%$ , providing evidence of the structure found in the messages.
104
+
105
+ # 3.3.2 TOPOGRAPHIC SIMILARITY
106
+
107
+ Given a set of objects, their meanings and the associated signals, Brighton & Kirby (2006) define topographic similarity to be the correlation of the distances between all the possible pairs of meanings and the corresponding pairs of signals. Figure 3 shows mappings between states and signals for examples of holistic (b) and compositional (c,d) languages, with the topographic similarity of compositional languages being higher than that of holistic. The intuition behind this measure is that semantically similar objects should have similar messages.
108
+
109
+ ![](images/cd5d57f50366fee02fe1b3ce12b993334e48d59f130b088d0fbe530764268416.jpg)
110
+ Figure 3: left: Three languages with different properties, taken from Brighton & Kirby (2006). The mapping between states and signals shown in (b) is random; there is no relationship between points in the meaning and signal space. In (c) and (d), similar meanings map to similar signals, i.e., there is a topographic relation between meanings and signals. right: Relation between objects’ cosine similarity and their message Levenshtein distance for trained and random agents.
111
+
112
+ To compute this measure, we first compute two lists of numbers: (i) the Levenshtein distances between all pairs of objects’ messages; and (ii) the cosine similarity between all pairs of objects’ VisA vectors. Given these two lists, the topographic similarity is defined as their negative Spearman $\rho$ correlation (since we are correlating distances with similarities, negative values of correlation indicate topographic similarity of the two spaces). Intuitively, if similar objects share much of the message structure (e.g., common prefixes or suffixes), and dissimilar objects have little common structure in their respective messages, then the topographic similarity should be high, the highest possible value being 1.
113
+
114
+ Results presented back in Table 1, in the topographic $\rho$ column, show that topographic similarity is positive in all experimental setups, indicating that similar objects receive similar messages $( p < 0 . 0 1$ , permutation test). A qualitative analysis of the messages generated in the length 10 and training data cases showed that, for example, $32 \%$ of the mammal objects had as a message prefix the bigram $9 5 \# 1 0 ^ { \star }$ ; $36 \%$ of vehicle objects had $\cdot 6 8 \# 9 5 $ ; and $11 \%$ of tool objects had ‘0#61’, suggesting that these prefix bigrams encode category-specific information.
115
+
116
+ Next, for each object pair, we calculate their Levenshtein message distance and respective cosine similarity, and plot in Figure 3 (right), for each distance, the average cosine similarities of the pairs with that distance (this is done for the length 10 and training data experiment). We observe that there is a clear relation between message similarity and meaning similarity (as measured by overlap in the VisA properties). In Figure 3, we also plot a similar correlation curve for an emerged language obtained by producing messages with randomly initialized and untrained speaker/listener architectures. This emerged language is at random in terms of communicative success; however, the generated messages do show signs of structure, since similar objects obtain somewhat similar messages. This seems to suggest that structured and disentangled pre-linguistic representations are, perhaps, a sufficient condition for the emergence of structured language, especially in neural network-based agents which, due to the nature of representation and information flow, favor similar inputs to trigger similar outputs.
117
+
118
+ # 4 STUDY 2: REFERENTIAL GAME WITH RAW PIXEL DATA
119
+
120
+ In this section, we present experiments in which agents receive as input entangled data in the form of raw pixel input, and have to learn to perform visual conceptual processing guided by the communication-based reward.
121
+
122
+ We use a synthetic dataset of scenes consisting of geometric objects generated using the MuJoCo physics engine (Todorov et al., 2012). We generate RGB images of resolution $1 2 4 \times 1 2 4$ depicting single object scenes. For each object, we pick one of eight colors (blue, red, white, black, yellow, green, cyan, magenta) and five shapes (box, sphere, cylinder, capsule, ellipsoid) resulting in 40 combinations, for each of which we generate 100 variations, varying the floor color and the object location in the image. Moreover, we introduce different variants of the game: game A with 19 distractors; game B with 1 distractor; game C with 1 distractor, and with speaker and listener having different viewpoints of the target object (the target object on the listener’s side is in a different location); game D with 1 distractor, with speaker and listener having different viewpoints, and with balanced numbers of shapes and color (obtained by downsampling from 8 colors to 5 and removing any image containing objects of the 3 disregarded objects). For each game, we create train and test splits with proportions 75/25 (i.e., 3000/1000 for games A and B, and 1850/650 for games C and D).
123
+
124
+ Pre-linguistic objects are presented in the form of pixel input, $o \in [ 0 , 2 5 5 ] ^ { 3 \times 1 2 4 \times 1 2 4 }$ . Speaker and listener convert the images $o$ to dense representations $u$ , each of them using an 8-layer convolutional neural network (ConvNet). Crucially, we do not pre-train the ConvNets on an object classification task; the only learning signal is the communication-based reward. Despite this fact, we observe that the lower layers of the ConvNets are encoding similar information to a ConvNet pre-trained on ImageNet (Deng et al., 2009).3 Conceptually, we can think of the whole speaker/listener architecture as an encoder-decoder with a discrete bottleneck (the message). Given our initial positive findings, this reward-based learning signal induced from the communication game setup could be used for classagnostic large-scale ConvNet training. Moreover, we find that, even though no weights were shared, the agents’ conceptual spaces get aligned at different levels, reminiscent of theories of interactive conceptual alignment during dialogue (Garrod & Pickering, 2004) (see Appendix A for the related experiment).
125
+
126
+ # 4.1 COMMUNICATIVE SUCCESS AND EMERGENT PROTOCOLS
127
+
128
+ Unlike the experiments of Section 3, where agents start from disentangled representations, starting from raw perceptual input presents a greater challenge: the agents have to establish naming conventions about scenes, while at the same time learning to process the input with their own visual conceptual system. Since we do not pre-train their ConvNets on an object recognition task, the dense representations $u$ used to derive the message contain no bias towards any image- or scene-specific information (e.g, object color, shape or location). The extraction of visual properties is thus driven entirely by the communication game. This contrasts with the cases of Havrylov & Titov (2017) and Lazaridou et al. (2017) who use pre-trained visual vectors, and qualitatively observe that the induced communication protocols encode information about objects. Table 3 presents the results in terms of communicative train and test success (see Appendix C for additional experiments when having access to gold object attribute classifiers). Moreover, we also report the topographic similarity (column topographic $\rho \mathrm { \Sigma }$ ) between the symbolic attribute-based representations of scenes (floor color, object color, shape and location) and the generated messages.
129
+
130
+ Overall, despite the challenges posed in this setup due to the raw nature of the data, performance across all games is well above chance, indicating that reinforcement learning agents trained end-toend are able to establish a communication protocol in this grounded environment. In game A, the agents reach $9 3 . 7 \%$ accuracy, with their lexicon consisting of 1068 messages, describing 3000 training objects. Most importantly, as captured by the positive topographic similarity, agents produce messages that respect (even to a limited degree) the compositional nature of scenes (i.e., objects as bags-of-attributes), indicating that similar scenes receive similar messages. Indeed, by examining their protocol (see Table 4), we find that messages encode in a structurally consistent way information about absolute location of objects, with the message prefix and suffix denoting the horizontal and vertical co-ordinate, respectively. Interestingly, this communication strategy is also typically followed by human players of referential games (Kazemzadeh et al., 2014).
131
+
132
+ ![](images/1a48df6cd3a8b1c8b52b9ee8420e381abf4d505b03645f3a5586570289a52a63.jpg)
133
+ Figure 4: Target images and their associated messages from game A and game B.
134
+
135
+ Table 3: Communicative success of agents playing different games. Columns random, train and test report percentage accuracies. Column topographic $\rho$ reports the topographic similarity between the symbolic representation of scenes and the generated messages $( p < 0 . 0 1$ , permutation test).
136
+
137
+ <table><tr><td>game</td><td>distractors</td><td>balanced</td><td>viewpoints</td><td>lexicon size</td><td>random</td><td>train</td><td>test</td><td>topographic p</td></tr><tr><td>A</td><td>20</td><td>No</td><td>No</td><td>1068</td><td>5.0</td><td>93.7</td><td>93.6</td><td>0.13</td></tr><tr><td>B</td><td>2</td><td>No</td><td>No</td><td>13</td><td>50.0</td><td>93.2</td><td>93.4</td><td>0.006</td></tr><tr><td>C</td><td>2</td><td>No</td><td>Yes</td><td>8</td><td>50.0</td><td>86.0</td><td>85.7</td><td>0.07</td></tr><tr><td>D</td><td>2</td><td>Yes</td><td>Yes</td><td>5</td><td>50.0</td><td>90.4</td><td>89.9</td><td>0.06</td></tr></table>
138
+
139
+ However, we find the emerged protocols to be very unstable and too grounded in the specific game situation. Small modifications of the game setup, while having close to no negative impact on the communicative performance, can radically alter the form, semantics and interpretability of the communication protocol. In game B, performance remains at the same level $( 9 3 . 2 \% )$ as game A. However, we observe that the protocol consists of 13 unique messages which do not reflect the objects’ attributes (as indicated by the close to zero topographic similarity), thus making the messages harder to interpret (see Figure 4 for randomly sampled examples). When we change the viewpoint of the agents in game C, biasing them against communicating about absolute object location, the players derive a compact communication protocol consisting of 8 unique messages that describe primarily color. Finally, when color and shape are balanced, as in game $\mathbf { D }$ , we still observe a bias towards describing the color of objects, with the five induced messages providing a perfect clustering of the objects according to their colors.4
140
+
141
+ In an entangled world, agents do not possess a priori visual biases and knowledge of concepts. Since objects can be conceptualized in indefinitely many ways, the type of information encoded in the messages is tied to the environmental pressures; communication behaviour is a function of the environment, which also dictates what data structures can emerge. The implication of this observation is that protocols essentially overfit to the particular game situation, to the degree that they become specialized ad-hoc naming conventions.
142
+
143
+ Interestingly, the emergence of ad-hoc naming conventions has also been observed during humanhuman interaction: when participants engage in some specific game situation (e.g., communicating about abstract tangram shapes), they tend to form highly specialized naming conceptions (conceptual pacts) that allow them to communicate with maximum efficiency (Brennan & Clark, 1996). While in this study we do not address the issue of how a stable and general language could emerge in entangled worlds, we believe that to alleviate the formation of such ad-hoc communication protocols, it is essential to increase the complexity of the games as well as requiring transfer across a variety of games.
144
+
145
+ <table><tr><td>game (random baseline)</td><td>object position (20.0)</td><td>object shape (20.0)</td><td>object color (12.0)</td><td>floor color (33.0)</td></tr><tr><td>A</td><td>95.3</td><td>90.2</td><td>24.7</td><td>36.4</td></tr><tr><td>B</td><td>88.6</td><td>41.2</td><td>63.8</td><td>45.4</td></tr><tr><td>C</td><td>85.9</td><td>43.5</td><td>65.8</td><td>43.8</td></tr><tr><td>D</td><td>89.4</td><td>47.1</td><td>82.0</td><td>42.3</td></tr></table>
146
+
147
+ Table 4: Accuracy of probe linear classifiers of speaker’s induced visual representations (all accuracies are in percentage format).
148
+
149
+ # 4.2 PROBE MODELS
150
+
151
+ In order to investigate what information gets captured by the speaker’s ConvNet, we probe the inferred visual representations $u$ used to derive the message. Specifically, we design 4 probe classifiers for the color and shape of the object; object position which is derived by discretizing each co-ordinate into 3 bins; and floor color which is obtained by clustering the RGB color representation of the floor. For each probe, we performed 5-fold cross validation with a linear classifier, and report accuracy results in Table 4. Overall, different games result in visual representations with different predictive power; object position is almost always encoded in the speaker’s visual representation, even in situations where location of the object is not a good strategy for communication. On the other hand, object shape seems to provide less salient information, despite the fact that it is relevant for communication, at least in the C&D games.
152
+
153
+ As expected, the structure and semantics of the emergent protocols are a function of the information captured in the visual representations. The degree to which the agents are able to pull apart the objects’ factors of variation impacts their ability to communicate about those factors, with the most extreme case being game D, where the message ignores the shape entirely. Thus, disentanglement seems to be a necessary condition for communication, at least in the case of pixel input.
154
+
155
+ # 5 CONCLUSION
156
+
157
+ We presented a series of studies investigating the properties of protocols emerging when reinforcement learning agents are trained end-to-end on referential communication games. We found that when agents are presented with disentangled input data in the form of attribute vectors, this inherent compositional structure is successfully retained in the output. Moreover, we showed that communication can also be achieved in cases where agents are presented with raw pixel data, a type of input that aligns better with the raw sensorimotor data that humans are exposed to. At the same time, we found that their ability to form compositional protocols in these cases is hampered by their ability to pull apart the objects’ factors of variations. Altogether, we were able to successfully scale up traditional research from the language evolution literature on emergent communication tasks to the contemporary deep learning framework, thus opening avenues to more realistic, and large scale, computational simulations of language emergence with complex image stimuli.
158
+
159
+ # ACKNOWLEDGEMENTS
160
+
161
+ We would like to thank Murray Shanahan, Laura Rimell and Gabor Melis for their very helpful feedback on this paper, as well as the rest of the DeepMind language team for many discussions. AL would also like to thank Marco Baroni and Alex Peysakhovich for the email correspondence and discussions from a year ago, which provided inspiration for some of the experiments on this paper.
162
+
163
+ # REFERENCES
164
+
165
+ Jacob Andreas and Dan Klein. Analogs of linguistic structure in deep representations. arXiv preprint arXiv:1707.08139, 2017.
166
+
167
+ Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. arXiv preprint arXiv:1710.03748, 2017.
168
+
169
+ John Batali. Computational simulations of the emergence of grammar. pp. 405–426, 1998.
170
+
171
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013.
172
+
173
+ Susan E Brennan and Herbert H Clark. Conceptual pacts and lexical choice in conversation. Journal of Experimental Psychology: Learning, Memory, and Cognition, 22(6):1482, 1996.
174
+
175
+ Henry Brighton. Compositional syntax from cultural transmission. Artificial life, 8(1):25–54, 2002.
176
+
177
+ Henry Brighton and Simon Kirby. Understanding linguistic evolution by visualizing the emergence of topographic mappings. Artificial life, 12(2):229–242, 2006.
178
+
179
+ Ted Briscoe (ed.). Linguistic evolution through language acquisition. Cambridge University Press, Cambridge, UK, 2002.
180
+
181
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
182
+
183
+ Angelo Cangelosi and Domenico Parisi (eds.). Simulating the evolution of language. Springer, New York, 2002.
184
+
185
+ Jon W Carr, Kenny Smith, Hannah Cornish, and Simon Kirby. The cultural evolution of structured languages in an open-ended, continuous world. Cognitive science, 41(4):892–923, 2017.
186
+
187
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
188
+
189
+ Katrina Evtimova, Andrew Drozdov, Douwe Kiela, and Kyunghyun Cho. Emergent language in a multi-modal, multi-step referential game. arXiv preprint arXiv:1705.10369, 2017.
190
+
191
+ Michael Franke. The evolution of compositionality in signaling games. Journal of Logic, Language and Information, pp. 1–23, 2015.
192
+
193
+ Gottlob Frege. Uber Sinn und Bedeutung. ¨ Zeitschrift fur Philosophie und philosophische Kritik ¨ , 100:25–50, 1892.
194
+
195
+ Simon Garrod and Martin J Pickering. Why is conversation so easy? Trends in cognitive sciences, 8(1):8–11, 2004.
196
+
197
+ Serhii Havrylov and Ivan Titov. Emergence of language with multi-agent games: Learning to communicate with sequences of symbols. arXiv preprint arXiv:1705.11192, 2017.
198
+
199
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
200
+
201
+ Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojtek Czarnecki, Max Jaderberg, Denis Teplyashin, et al. Grounded language learning in a simulated 3d world. arXiv preprint arXiv:1706.06551, 2017.
202
+
203
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
204
+
205
+ Sahar Kazemzadeh, Vicente Ordonez, Mark Matten, and Tamara L Berg. Referitgame: Referring to objects in photographs of natural scenes. In EMNLP, pp. 787–798, 2014.
206
+
207
+ Satwik Kottur, Jose MF Moura, Stefan Lee, and Dhruv Batra. Natural language does not ´ emerge’naturally’in multi-agent dialog. arXiv preprint arXiv:1706.08502, 2017.
208
+
209
+ Angeliki Lazaridou, Alexander Peysakhovich, and Marco Baroni. Multi-agent cooperation and the emergence of (natural) language. In ICLR, 2017.
210
+
211
+ David Lewis. Convention. Harvard University Press, Cambridge, MA, 1969.
212
+
213
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014.
214
+
215
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016.
216
+
217
+ Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. arXiv preprint arXiv:1703.04908, 2017.
218
+
219
+ Martin A Nowak and David C Krakauer. The evolution of language. Proceedings of the National Academy of Sciences, 96(14):8028–8033, 1999.
220
+
221
+ Steven T Piantadosi, Harry Tily, and Edward Gibson. The communicative function of ambiguity in language. Cognition, 122(3):280–291, 2012.
222
+
223
+ Carina Silberer, Vittorio Ferrari, and Mirella Lapata. Models of semantic representation with visual attributes. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 572–582, Sofia, Bulgaria, August 2013. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/P13-1056.
224
+
225
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of go without human knowledge. Nature, 550:354–359, 2017.
226
+
227
+ Brian Skyrms. Signals: Evolution, learning, and information. Oxford University Press, 2010.
228
+
229
+ Kenny Smith, Simon Kirby, and Henry Brighton. Iterated learning: A framework for the emergence of language. Artificial life, 9(4):371–386, 2003.
230
+
231
+ Matthew Spike, Kevin Stadler, Simon Kirby, and Kenny Smith. Minimal requirements for the emergence of learned signaling. Cognitive Science, 2016. In press.
232
+
233
+ Luc Steels. Social language learning. In Mario Tokoro and Luc Steels (eds.), The Future of Learning, pp. 133–162. IOS, Amsterdam, 2003.
234
+
235
+ Luc Steels and Martin Loetzsch. The grounded naming game. In Luc Steels (ed.), Experiments in Cultural Language Evolution, pp. 41–59. John Benjamins, Amsterdam, 2012.
236
+
237
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
238
+
239
+ Kyle Wagner, James A Reggia, Juan Uriagereka, and Gerald S Wilkinson. Progress in the simulation of emergent communication and language. Adaptive Behavior, 11(1):37–69, 2003.
240
+
241
+ Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn., 8(3-4):229–256, May 1992. ISSN 0885-6125. doi: 10.1007/ BF00992696. URL https://doi.org/10.1007/BF00992696.
242
+
243
+ Ludwig Wittgenstein. Philosophical Investigations. Blackwell, Oxford, UK, 1953. Translated by G.E.M. Anscombe.
244
+
245
+ # A CONCEPTUAL ALIGNMENT OF SPEAKER AND LISTENER
246
+
247
+ During conversation, communication allows interlocutors to achieve interactive conceptual alignment (Garrod & Pickering, 2004). We are able to communicate because we have established a common ground and our representations at different levels become aligned (e.g., participants mutually understand that “he” in the conversation refers to Bob). We investigated whether the agents’ conceptual systems achieve a similar structural alignment. We measure the alignment in terms of Spearman $\rho$ correlation of the intra-agent pairwise object cosine similarities as calculated via representing objects as activations from ConvNet layers.
248
+
249
+ Interestingly, we observe a gradual increase in the structural similarity as we represent the objects with layer activations closer to the pixel space. Conceptual spaces are more aligned the closer they are to the raw pixel input $\mathrm { ~ \ ' ~ } \rho = 0 . 9 7 \mathrm { - } 0 . 9 1$ , depending on the game) and become more dissimilar as the representations become more abstract. We can draw the analogy to language processing, as first ConvNet layers perform some low-level processing analogous to phoneme recognition or word segmentation (and are thus more objective) while higher layers perform more abstract processing, vaguely analogous to semantics and pragmatics (thus, represent more subjective knowledge). In cases of successful communication, speakers’ and listeners’ conceptual spaces closer to the communication point are structurally very similar $\prime \rho = 0 . 8 5 – 0 . 6 2$ , depending on the game), however this similarity drops dramatically in cases of failure of communication $\mathit { \Pi } _ { \rho } = 0 . 1 5 $ ).
250
+
251
+ # B HYPERPARAMETER DETAILS
252
+
253
+ All LSTM hidden states of the “speaking” and “listening” module as well and the “seeing” prelinguistic feed-forward encoders (see Section 3), have dimension 50. The “seeing” pre-linguistic ConvNet encoders (see Section 4) has 8 layers, 32 filters with the kernel size 3 for every layer and with strides $[ 2 , 1 , 1 , 2 , 1 , 2 , 1 , 2 ]$ for each layer. We use ReLU as activation function as well as batch normalization for every layer.
254
+
255
+ For learning, we used the Rmsprop optimizer, with learning rate 0.0001. We use a separate value of entropy regularization for each policy. For $\pi ^ { S }$ we use 0.01 and for $\pi ^ { L }$ we use 0.001. We use a mini-batch of 32.
256
+
257
+ # C COMMUNICATIVE SUCCESS USING GOLD ATTRIBUTE CLASSIFIERS
258
+
259
+ We assume a model which has access to perfect attribute classifiers for color, shape and object position, for the latter using a classifier operating on the discretized annotations we obtained in Section 4.2 after quantazing the real-valued object location. For computing the performance of this model using gold attribute classifiers, we first remove from the distractors any candidate not matching the target’s attributes and them pick at random. We repeat this experiment for single attribute classifiers and their pairwise combinations. Table 5 reports the communicative success results obtained empirically by averaging across 1000 simulations, alongside the training and test accuracies of the trained agents of Section 4.1 for comparison.
260
+
261
+ Table 5: Communicative success of trained models from Section 4.1 (train and test) as well as models with access to gold classifiers. All accuracies are in percentage format.
262
+
263
+ <table><tr><td> game</td><td>train</td><td>test</td><td>color</td><td>shape</td><td>position</td><td>color &amp; shape</td><td> position &amp; shape</td><td>position &amp; color</td></tr><tr><td>A</td><td>93.7</td><td>93.6</td><td>37.2</td><td>24.8</td><td>69.3</td><td>80.4</td><td>92.1</td><td>95.6</td></tr><tr><td>B</td><td>93.2</td><td>93.4</td><td>93.2</td><td>90.1</td><td>97.2</td><td>98.8</td><td>99.3</td><td>99.4</td></tr><tr><td>C</td><td>86.0</td><td>85.7</td><td>93.2</td><td>90.1</td><td>-</td><td>98.8</td><td>1</td><td>1</td></tr><tr><td>D</td><td>90.4</td><td>89.9</td><td>89.6</td><td>89.2</td><td>1</td><td>98.5</td><td>1</td><td>1</td></tr></table>
parse/train/HJGv1Z-AW/HJGv1Z-AW_content_list.json ADDED
@@ -0,0 +1,1473 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "EMERGENCE OF LINGUISTIC COMMUNICATION FROM REFERENTIAL GAMES WITH SYMBOLIC AND PIXEL INPUT ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 174,
8
+ 98,
9
+ 823,
10
+ 171
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Angeliki Lazaridou∗, Karl Moritz Hermann, Karl Tuyls, Stephen Clark \nDeepMind, \nLondon, UK ",
17
+ "bbox": [
18
+ 183,
19
+ 195,
20
+ 681,
21
+ 237
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 273,
32
+ 544,
33
+ 289
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "The ability of algorithms to evolve or learn (compositional) communication protocols has traditionally been studied in the language evolution literature through the use of emergent communication tasks. Here we scale up this research by using contemporary deep learning methods and by training reinforcement-learning neural network agents on referential communication games. We extend previous work, in which agents were trained in symbolic environments, by developing agents which are able to learn from raw pixel data, a more challenging and realistic input representation. We find that the degree of structure found in the input data affects the nature of the emerged protocols, and thereby corroborate the hypothesis that structured compositional language is most likely to emerge when agents perceive the world as being structured. ",
40
+ "bbox": [
41
+ 233,
42
+ 304,
43
+ 764,
44
+ 457
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 178,
54
+ 482,
55
+ 336,
56
+ 498
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "The study of emergent communication is important for two related problems in language development, both human and artificial: language evolution, the development of communication protocols from scratch (Nowak & Krakauer, 1999); and language acquisition, the ability of an embodied agent to learn an existing language. In this paper we focus on the problem of how environmental or pre-linguistic conditions affect the nature of the communication protocol that an agent learns. The increasing realism and complexity of environments being used for grounded language learning (Brockman et al., 2016; Hermann et al., 2017) present an opportunity to analyse these effects in detail. ",
63
+ "bbox": [
64
+ 174,
65
+ 513,
66
+ 825,
67
+ 625
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "In line with previous work on emergent communication, we are strongly motivated by the view that language derives meaning from its use (Wittgenstein, 1953; Wagner et al., 2003). This perspective especially motivates the study of language emergence in cases where co-operative agents try to achieve shared goals in game scenarios (Steels, 2003; Brighton & Kirby, 2006; Mordatch & Abbeel, 2017), and is related to the study of multi-agent and self-play methods that have found great success in other areas of machine learning (Bansal et al., 2017; Silver et al., 2017). Here we focus on simple referential games, in which one agent must communicate to another a target object in the agent’s environment. ",
74
+ "bbox": [
75
+ 174,
76
+ 632,
77
+ 825,
78
+ 742
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "One of the most important properties of natural language is compositionality. Smaller building blocks (e.g. words, morphemes) are used to generate unbounded numbers of more complex forms (e.g. sentences, multi-word expressions), with the meaning of the larger form being determined by the meanings of its parts and how they are put together (Frege, 1892). Compositionality is an advantage in any communication protocol as it allows in principle infinite expression through a finite dictionary and a finite set of combination rules. In emergent communication research, previous work has shown that agents can produce (somewhat) compositional protocols when engaging in language games (Steels, 2003). However, the computational agents were typically situated in artificial worlds containing just a handful of objects, represented as disentangled, structured, and sometimes even atomic symbols, e.g. attribute-based or one-hot vectors (Batali, 1998; Brighton, 2002; Franke, 2015; Andreas & Klein, 2017; Mordatch & Abbeel, 2017). However, humans receive raw sensorimotor rather than symbolic input, and little work to date has tested whether these findings carry over when agents are situated in less idealized worlds that bear more similarity to the kind of entangled and noisy environments to which humans are typically exposed.1 ",
85
+ "bbox": [
86
+ 174,
87
+ 750,
88
+ 825,
89
+ 902
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "image",
95
+ "img_path": "images/aea3a2fceb920cffdae0270c243ac52b72776e4d05ae8e6a4c4b0000f5f4d17a.jpg",
96
+ "image_caption": [
97
+ "Figure 1: High-level overview of the referential game. "
98
+ ],
99
+ "image_footnote": [],
100
+ "bbox": [
101
+ 258,
102
+ 98,
103
+ 741,
104
+ 297
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "",
111
+ "bbox": [
112
+ 174,
113
+ 358,
114
+ 825,
115
+ 400
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "In this work, in the context of referential communication games (see Figure 1), we contrast the results of two studies that lie at the extremes of how much structure is provided by the environment. The first study (Section 3) focuses on symbolic representations, where objects are represented as bags-of-attributes; this representation is inherently disentangled since dimensions encode individual properties. The second study (Section 4) considers raw perceptual input, hence data that more closely resembles what humans are exposed to. Clearly, the latter is a more challenging and realistic scenario as the computational agents are operating on entangled inputs with no pre-coded semantics. Crucially, both studies use the same referential game setup, the same learning procedure (policy learning methods) and the same neural network agent architectures. ",
122
+ "bbox": [
123
+ 174,
124
+ 406,
125
+ 825,
126
+ 532
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "We show that reinforcement learning agents can successfully communicate, not only when presented with symbolic and highly structured input data, but (and more importantly) even when presented with raw pixel input. This result opens up the possibility of more realistic simulations of language emergence. We successfully use the learning signal from the referential game to train agents end-to-end, including cases where the agents need to perform visual processing of images with a convolutional neural network. However, we find that the agents struggle to produce structured messages when presented with entangled input data (Bengio et al., 2013) due to the difficulty of uncovering the true factors of variation, corroborating the hypothesis of Smith et al. (2003) that structured (compositional) language is most likely to emerge when agents perceive the world as structured. ",
133
+ "bbox": [
134
+ 174,
135
+ 539,
136
+ 825,
137
+ 678
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "2 REFERENTIAL GAMES AS MULTI-AGENT CO-OPERATIVEREINFORCEMENT LEARNING",
144
+ "text_level": 1,
145
+ "bbox": [
146
+ 174,
147
+ 699,
148
+ 674,
149
+ 732
150
+ ],
151
+ "page_idx": 1
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": "The referential game is implemented as an instance of multi-agent co-operative reinforcement learning, in which two agents take discrete actions in their environment in order to maximize a shared reward. ",
156
+ "bbox": [
157
+ 174,
158
+ 747,
159
+ 823,
160
+ 789
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "2.1 GAME AND TERMINOLOGY ",
167
+ "text_level": 1,
168
+ "bbox": [
169
+ 176,
170
+ 806,
171
+ 403,
172
+ 820
173
+ ],
174
+ "page_idx": 1
175
+ },
176
+ {
177
+ "type": "text",
178
+ "text": "The referential game is a variant of the Lewis signaling game (Lewis, 1969), which has been extensively used in linguistic and cognitive studies in the context of language evolution (e.g., Briscoe, 2002; Cangelosi & Parisi, 2002; Steels & Loetzsch, 2012; Spike et al., 2016; Lazaridou et al., 2017). ",
179
+ "bbox": [
180
+ 174,
181
+ 833,
182
+ 825,
183
+ 875
184
+ ],
185
+ "page_idx": 1
186
+ },
187
+ {
188
+ "type": "text",
189
+ "text": "Figure 1 provides a schematic description of our setup. First, a speaker is presented with a target object (highlighted as CAR in the symbolic example on the left, and highlighted as the far right image in the pixel example on the right). Then, by making use of an alphabet consisting of primitive discrete symbols $( ^ { \\ast \\cdot } 2 2 ^ { \\cdot \\prime } , ^ { \\cdot \\cdot } 1 0 ^ { \\cdot \\prime } , ^ { \\cdot \\cdot } 0 ^ { \\cdot \\prime } , ^ { \\cdot \\cdot } 2 ^ { \\cdot \\prime } )$ , the speaker constructs a message describing that object (“22 $2 0 ^ { \\circ } )$ . We will refer to the set of all distinct messages generated by the speaker as their lexicon or protocol. Finally, the listener is presented with the target and a set of distractor objects, and—by making use of the speaker’s message—has to identify the target object from the set of candidate objects. Communicative success is defined as the correct identification of the target by the listening agent. ",
190
+ "bbox": [
191
+ 173,
192
+ 103,
193
+ 825,
194
+ 229
195
+ ],
196
+ "page_idx": 2
197
+ },
198
+ {
199
+ "type": "text",
200
+ "text": "Formally, the attribute-based object vectors (disentangled) or the pixel-based images (entangled) are the set of pre-linguistic items $W = \\{ o _ { 1 } , \\ldots , o _ { N } \\}$ . From this set we draw a target $t \\in W$ and subsequently $K - 1$ distractors $D = \\{ d _ { 1 } , \\dots , d _ { K - 1 } \\} \\subset W$ s.t. ∀j $t \\neq d _ { j }$ . The speaker has only access to the target $t$ , while the listener receives candidate set $C = t \\cup D$ , not knowing which of the elements in $C$ is target $t$ . ",
201
+ "bbox": [
202
+ 174,
203
+ 236,
204
+ 825,
205
+ 306
206
+ ],
207
+ "page_idx": 2
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "2.2 AGENTS ",
212
+ "text_level": 1,
213
+ "bbox": [
214
+ 174,
215
+ 330,
216
+ 272,
217
+ 345
218
+ ],
219
+ "page_idx": 2
220
+ },
221
+ {
222
+ "type": "text",
223
+ "text": "The speaker encodes $t$ into a dense representation $u$ using an encoder $f ^ { S } ( t , \\theta _ { f } ^ { S } )$ . The function of this encoder depends on the type of pre-linguistic data used and is discussed separately for each study. Given an alphabet $A$ of discrete unit symbols (akin to words) and $u$ , the speaker next generates a discrete, variable-length, bounded message m by sampling symbols from a recurrent policy $\\pi ^ { S }$ defined by a decoder $\\check { g } ^ { S } ( u , \\theta _ { g } ^ { S } )$ . The sequence generation is terminated either by the production of a stop symbol or when the maximum length $L$ has been reached. We implement the decoder as a single-layer LSTM (Hochreiter $\\&$ Schmidhuber, 1997). Note that the symbols in the agents’ alphabet $A$ have no a priori meaning; rather, these symbols get grounded during the game. ",
224
+ "bbox": [
225
+ 173,
226
+ 359,
227
+ 825,
228
+ 474
229
+ ],
230
+ "page_idx": 2
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "The listening agent uses a similar encoder to the speaker but has independent network weights $( \\theta _ { f } ^ { L } )$ . Applying this encoder to all candidate objects results in a set $U = \\{ f ^ { L } ( c , \\theta _ { f } ^ { L } ) \\mid c \\in C \\}$ . For encoding the message $\\mathbf { m }$ , we use a single-layer LSTM, denoted $h ^ { L }$ , which produces an encoding $z$ : $z = h ^ { L } ( \\mathbf { \\bar { m } } , \\theta _ { h } ^ { L } )$ . ",
235
+ "bbox": [
236
+ 174,
237
+ 479,
238
+ 825,
239
+ 544
240
+ ],
241
+ "page_idx": 2
242
+ },
243
+ {
244
+ "type": "text",
245
+ "text": "Given encoded message $z$ and candidates $U$ , the listener predicts a target object $t ^ { \\prime } \\in C$ following a policy $\\pi ^ { L }$ implemented using a non-parametric pointing module; this module samples the predicted object from a Gibbs distribution computed via the dot product between vector $z$ and all encoded candidates $u \\in U$ . See Appendix B for information regarding the agents’ architecture. ",
246
+ "bbox": [
247
+ 173,
248
+ 549,
249
+ 825,
250
+ 606
251
+ ],
252
+ "page_idx": 2
253
+ },
254
+ {
255
+ "type": "text",
256
+ "text": "At inference time, we replace the stochastic sampling of the speaker’s message and the listener’s stochastic pointing module with deterministic processes. For the pointing module, the object with the highest probability is chosen. For the speaker’s message, this is generated in a greedy fashion by selecting the highest-probability symbol at each step. ",
257
+ "bbox": [
258
+ 174,
259
+ 613,
260
+ 825,
261
+ 669
262
+ ],
263
+ "page_idx": 2
264
+ },
265
+ {
266
+ "type": "text",
267
+ "text": "2.3 LEARNING ",
268
+ "text_level": 1,
269
+ "bbox": [
270
+ 174,
271
+ 694,
272
+ 290,
273
+ 708
274
+ ],
275
+ "page_idx": 2
276
+ },
277
+ {
278
+ "type": "text",
279
+ "text": "All weights of the speaker and listener agents, $\\theta = \\{ \\theta _ { f } ^ { S } , \\theta _ { g } ^ { S } , \\theta _ { f } ^ { L } , \\theta _ { h } ^ { L } \\}$ , are jointly optimized while playing the game. We emphasize that no weights are shared between the speaker and the listener, and the only supervision used is communicative success, i.e. whether the listener identified the correct target. The objective function that the two agents maximize for one training instance is: ",
280
+ "bbox": [
281
+ 174,
282
+ 723,
283
+ 825,
284
+ 781
285
+ ],
286
+ "page_idx": 2
287
+ },
288
+ {
289
+ "type": "equation",
290
+ "img_path": "images/c34e2e7b58caa96bee6d7b21228b3df792fb3baa418ae30a187e41678a9fca7a.jpg",
291
+ "text": "$$\nR ( t ^ { \\prime } ) \\left( \\sum _ { l = 1 } ^ { L } \\log p ( m _ { t } ^ { l } | m _ { t } ^ { < l } , u ) + \\log p ( u _ { t ^ { \\prime } } | z , U ) \\right)\n$$",
292
+ "text_format": "latex",
293
+ "bbox": [
294
+ 334,
295
+ 796,
296
+ 661,
297
+ 839
298
+ ],
299
+ "page_idx": 2
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "where $R$ is the reward function returning 1 if $t = t ^ { \\prime }$ (if the listener pointed to the correct target) and 0 otherwise. To maintain exploration in the speaker’s policy $\\pi ^ { S }$ of generating a message, and the listener’s policy $\\pi ^ { L }$ of pointing to the target, we add to the loss an entropy regularization term (Mnih et al., 2016). The parameters are estimated using the REINFORCE update rule (Williams, 1992). See Appendix $\\mathbf { B }$ for more details regarding the learning. ",
304
+ "bbox": [
305
+ 174,
306
+ 853,
307
+ 825,
308
+ 924
309
+ ],
310
+ "page_idx": 2
311
+ },
312
+ {
313
+ "type": "table",
314
+ "img_path": "images/cfe7a03f798798062f8caf55337de20030b3afb133cfa3a577a1f4f6caf9f226.jpg",
315
+ "table_caption": [],
316
+ "table_footnote": [],
317
+ "table_body": "<table><tr><td>max length</td><td>alphabet size</td><td>lexicon size</td><td>training accuracy</td><td>topographic p</td></tr><tr><td>2</td><td>10</td><td>31</td><td>92.0%</td><td>0.13</td></tr><tr><td>5</td><td>17</td><td>293</td><td>98.2%</td><td>0.16</td></tr><tr><td>10</td><td>40</td><td>355</td><td>98.5%</td><td>0.26</td></tr></table>",
318
+ "bbox": [
319
+ 225,
320
+ 101,
321
+ 772,
322
+ 172
323
+ ],
324
+ "page_idx": 3
325
+ },
326
+ {
327
+ "type": "text",
328
+ "text": "Table 1: Commumicative success (training accuracy in percentage) with varying maximum message length. alphabet size denotes the effective size of the symbol set used from a maximum of 100. lexicon size is the effective number of unique messages used. topographic $\\rho$ reports the structural similarity in terms of Spearman $\\rho$ correlation between the message and the object vector space. All Spearman $\\rho$ correlations throughout the paper are significant with $p < 0 . 0 1$ . ",
329
+ "bbox": [
330
+ 173,
331
+ 183,
332
+ 825,
333
+ 253
334
+ ],
335
+ "page_idx": 3
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "3 STUDY 1: REFERENTIAL GAME WITH SYMBOLIC DATA ",
340
+ "text_level": 1,
341
+ "bbox": [
342
+ 176,
343
+ 280,
344
+ 656,
345
+ 296
346
+ ],
347
+ "page_idx": 3
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "We first present experiments where agents are learning to communicate when presented with structured and disentangled input. We use the Visual Attributes for Concepts Dataset (VisA) of Silberer et al. (2013), which contains human-generated per-concept attribute annotations for 500 concrete concepts (e.g., cat, sofa, car) spanning across different categories (e.g., mammals, furniture, vehicles), annotated with 636 general attributes (e.g., has tail, is black, has wheels). We disregarded homonym concepts (e.g., bat), thus reducing our working set of concepts to 463 and the number of attributes to 573 (after eliminating any attribute that did not occur with the working concepts). On average, each concept has 11 attributes. All pre-linguistic objects are represented in terms of binary vectors $o \\in \\{ 0 , 1 \\} ^ { 5 7 3 }$ . Note that these representations do carry some inherent structure; the dimensions in the object vectors are disentangled and so each object can be seen as a conjunction of properties. Speaker and listener convert the pre-linguistic representations to dense representations $u$ by using a single-layer MLP with a sigmoid activation function. ",
352
+ "bbox": [
353
+ 174,
354
+ 313,
355
+ 825,
356
+ 479
357
+ ],
358
+ "page_idx": 3
359
+ },
360
+ {
361
+ "type": "text",
362
+ "text": "In all experiments, we set the number of candidate objects $K$ to five, meaning there were four wrong choices per correct one (resulting in a $2 0 \\%$ random baseline). Inspired by Kottur et al. (2017), who show that non-compositional language emerges in the case of overcomplete alphabets, we set the size of alphabet $A$ to 100 symbols, which is smaller than the size of the set of objects (463). ",
363
+ "bbox": [
364
+ 176,
365
+ 487,
366
+ 825,
367
+ 542
368
+ ],
369
+ "page_idx": 3
370
+ },
371
+ {
372
+ "type": "text",
373
+ "text": "3.1 AGENT PERFORMANCE AND AMBIGUITY ",
374
+ "text_level": 1,
375
+ "bbox": [
376
+ 174,
377
+ 563,
378
+ 498,
379
+ 577
380
+ ],
381
+ "page_idx": 3
382
+ },
383
+ {
384
+ "type": "text",
385
+ "text": "We first report model performance on the training data, comparing different settings for the maximal allowed message length (2, 5 or 10 symbols). Results are presented in Table 1 (ignore the last row topographic $\\rho$ which will be explained in later sections). ",
386
+ "bbox": [
387
+ 178,
388
+ 589,
389
+ 823,
390
+ 631
391
+ ],
392
+ "page_idx": 3
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "In the case of the shortest message settings (maximum length 2), our trained agents on average only develop a protocol of 31 unique messages used to describe 363 training concepts (leaving aside 100 for testing). This indicates high levels of ambiguity, with each message being used to denote 11 concepts on average. Interestingly, recent findings suggest that ambiguity is a design feature of language that prevents the inefficient use of redundant codes, since some of the message content can be extracted from context: “the most efficient communication system will not convey information already provided by the context” (Piantadosi et al., 2012). In our case, we do no explicitly encode any bias towards ambiguity. We hypothesize that ambiguity arises due to the difficult exploration problem that agents are faced with, in combination with the fact that ambiguous protocols present a good local optimum that is over-represented in the hypothesis search space. As a result, in the absence of environmental pressures (e.g., a high number of carefully constructed distractors) a suboptimal policy can still achieve a reasonably high accuracy $( 9 2 \\% )$ , making it even harder during training to escape from such a solution. ",
397
+ "bbox": [
398
+ 174,
399
+ 638,
400
+ 825,
401
+ 819
402
+ ],
403
+ "page_idx": 3
404
+ },
405
+ {
406
+ "type": "text",
407
+ "text": "In classic signaling games, this polysemy phenomenon manifests itself as different states receiving the same signal and is termed partial pooling equilibrium (Skyrms, 2010). Perhaps rather counterintuitively, Skyrms (p.131) suggests that a way to obtain communication protocols that are robust to this type of local communication minima is to allow the invention of new signals, essentially increasing the search space of signals. Motivated by this suggestion, we play variants of the game in which we allow the agents to produce messages of greater maximum length (5 and 10), which leads to improved communicative success $9 8 . 2 \\%$ and $9 8 . 5 \\%$ respectively). We observe that the number of messages in the protocol increases from 31 to 293 and 355, respectively, reducing the average number of concepts a message can denote from 11 concepts to (approximately) 1 concept. ",
408
+ "bbox": [
409
+ 174,
410
+ 827,
411
+ 823,
412
+ 924
413
+ ],
414
+ "page_idx": 3
415
+ },
416
+ {
417
+ "type": "image",
418
+ "img_path": "images/f54b6c616adb9b6e25c20297338305d82c03c1c6cbacf39ded5809edadfd7eb1.jpg",
419
+ "image_caption": [
420
+ "Figure 2: Training curves of different experimental setups with uniform and context-dependent target selection. "
421
+ ],
422
+ "image_footnote": [],
423
+ "bbox": [
424
+ 328,
425
+ 99,
426
+ 666,
427
+ 284
428
+ ],
429
+ "page_idx": 4
430
+ },
431
+ {
432
+ "type": "text",
433
+ "text": "",
434
+ "bbox": [
435
+ 173,
436
+ 359,
437
+ 823,
438
+ 388
439
+ ],
440
+ "page_idx": 4
441
+ },
442
+ {
443
+ "type": "text",
444
+ "text": "3.2 REALISTIC CONTEXT DISTRIBUTION ",
445
+ "text_level": 1,
446
+ "bbox": [
447
+ 176,
448
+ 410,
449
+ 465,
450
+ 424
451
+ ],
452
+ "page_idx": 4
453
+ },
454
+ {
455
+ "type": "text",
456
+ "text": "In the real world, when speakers refer to cats, listeners would likely be in a situation where they had to discriminate a cat in the context of a couch or a dog, rather than in the context of a mirror or a cow.2 Simply put, objects in the world do not appear in random contexts, but rather there is regularity in the distribution of situational and visual co-occurrences. This property of the world is typically not captured in referential games studied in the language emergence literature, with distractors usually drawn from a uniform distribution. ",
457
+ "bbox": [
458
+ 174,
459
+ 438,
460
+ 825,
461
+ 521
462
+ ],
463
+ "page_idx": 4
464
+ },
465
+ {
466
+ "type": "text",
467
+ "text": "We address this issue and design an additional experiment with distractors sampled from a targetspecific context distribution reflecting normalized object co-occurrence statistics. Co-occurrence data is extracted from the MSCOCO caption dataset (Lin et al., 2014). This leads to more plausible distractor sets with, for instance, the target goat more likely being mixed with sheep and cow as distractors rather than bike or eggplant. ",
468
+ "bbox": [
469
+ 174,
470
+ 529,
471
+ 823,
472
+ 598
473
+ ],
474
+ "page_idx": 4
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "We find that the distractor selection process (uniform vs context-dependent) affects the language learning dynamics; see Figure 2 for training curves for different experimental configurations. While the non-uniform distractor sampling of the context-dependent setting can be exploited to learn a degenerate strategy —giving up to $40 \\%$ communicative success shortly after the start of training— subsequently learning under this scenario takes longer. This effect is likely a combination of the local minimum achieved by the degenerate strategy of picking a target at random from only the topically relevant set of distractors, which initially makes the problem easier; however, the fact that the co-occurrence statistics tend to align with the feature vectors, means that similar objects are more likely to appear as distractors and hence the overall game becomes more difficult. ",
479
+ "bbox": [
480
+ 174,
481
+ 606,
482
+ 825,
483
+ 731
484
+ ],
485
+ "page_idx": 4
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "We now consider the question of how objects denoted by the same (ambiguous) message are related. When the context is drawn uniformly, object similarity is a predictor of object confusability, as similar objects tend to be mapped onto the same message (0.26 and 0.43 median pairwise cosine similarities of objects that received the same message as computed on the VisA space, for maximum message length 2 and 5, respectively). In the non-uniform case, we observe object confusability to be less influenced by object similarity (0.15 and 0.17 median pairwise cosine similarities of objects that received the same message, for maximum message length 2 and 5, respectively), but rather driven by the visual context co-occurrences. Simply put, in the non-uniform case confusability is less influenced by similarity since the agents must learn to distinguish between objects that naturally co-occur (e.g. sheep and goat). Thus, the choice of distractors, an experimental design decision that in existing language emergence literature has been neglected, has an effect on the organization (and potentially the naturalness) of the emerged language, for example as reflected in the semantics of ambiguous or homonym words in the language. ",
490
+ "bbox": [
491
+ 174,
492
+ 738,
493
+ 825,
494
+ 890
495
+ ],
496
+ "page_idx": 4
497
+ },
498
+ {
499
+ "type": "table",
500
+ "img_path": "images/b5d62f37e1521286a723390b44164c15effbb389a0bb345d2ce0bb07c67f4c45.jpg",
501
+ "table_caption": [
502
+ "Table 2: Communicative success (acc in percentage) of agents evaluated on training (first row) and novel (last three rows) data. lexicon size column reports the percentage of novel messages (i.e., messages that were not used during the training). "
503
+ ],
504
+ "table_footnote": [],
505
+ "table_body": "<table><tr><td>Data</td><td>length 2 lexicon size</td><td>acc.</td><td>length 5 lexicon size</td><td>acc.</td><td>length 10 lexicon size</td><td>acc.</td></tr><tr><td>training data</td><td>31</td><td>92.0</td><td>293</td><td>98.2</td><td>355</td><td>98.5</td></tr><tr><td>test data</td><td>1</td><td>74.2</td><td>70</td><td>76.8</td><td>98</td><td>81.6</td></tr><tr><td>unigram chimera</td><td>5</td><td>39.3</td><td>88</td><td>40.5</td><td>99</td><td>47.0</td></tr><tr><td>uniform chimera</td><td>3</td><td>31.2</td><td>87</td><td>32.2</td><td>100</td><td>42.6</td></tr></table>",
506
+ "bbox": [
507
+ 222,
508
+ 101,
509
+ 776,
510
+ 200
511
+ ],
512
+ "page_idx": 5
513
+ },
514
+ {
515
+ "type": "text",
516
+ "text": "",
517
+ "bbox": [
518
+ 174,
519
+ 280,
520
+ 823,
521
+ 309
522
+ ],
523
+ "page_idx": 5
524
+ },
525
+ {
526
+ "type": "text",
527
+ "text": "3.3 STRUCTURAL PROPERTIES OF EMERGED PROTOCOLS",
528
+ "text_level": 1,
529
+ "bbox": [
530
+ 174,
531
+ 327,
532
+ 578,
533
+ 340
534
+ ],
535
+ "page_idx": 5
536
+ },
537
+ {
538
+ "type": "text",
539
+ "text": "Quantifying the degree of compositionality and structure found in the emerged language is a challenging task; to the best of our knowledge, there is no formal mathematical definition of compositionality that would allow for a definitive quantitative measure. Thus, research on this topic usually relies on defining necessary requirements that any language claiming to be compositional should adhere to, such as the ability to generalize to novel situations (Batali, 1998; Franke, 2015; Kottur et al., 2017). We adopt a similar strategy by measuring the extent to which an emerged language is able to generalize to novel objects (Section 3.3.1). Moreover, we also report quantitative results (Section 3.3.2) using a measure of message structure proposed in the language evolution literature (Brighton & Kirby, 2006; Carr et al., 2017). ",
540
+ "bbox": [
541
+ 173,
542
+ 353,
543
+ 825,
544
+ 478
545
+ ],
546
+ "page_idx": 5
547
+ },
548
+ {
549
+ "type": "text",
550
+ "text": "3.3.1 GENERALIZATION TO NOVEL OBJECTS ",
551
+ "text_level": 1,
552
+ "bbox": [
553
+ 176,
554
+ 496,
555
+ 493,
556
+ 508
557
+ ],
558
+ "page_idx": 5
559
+ },
560
+ {
561
+ "type": "text",
562
+ "text": "We perform experiments where trained agents from Section 3.1 are exposed to different types of unseen objects, each of them differing to the degree to which the unseen objects resemble the objects found in the training data. In the test scenario, objects come from the same data distribution as the training data, but were not presented to the agents during training (e.g., a mouse); in the unigram chimeras scenario, the novel objects are constructed by sampling properties from a property-based distribution inferred from the training data, thus breaking any feature correlation (e.g., a mouselike animal with wheels); in the uniform chimeras scenario, the novel objects are constructed by uniformly sampling properties (e.g., a square red furry metallic object). ",
563
+ "bbox": [
564
+ 174,
565
+ 520,
566
+ 825,
567
+ 632
568
+ ],
569
+ "page_idx": 5
570
+ },
571
+ {
572
+ "type": "text",
573
+ "text": "Table 2 reports the communicative success. While there is a drop in performance for unseen objects, agents are performing above random chance $( 2 0 \\% )$ . The emerged language is indeed able to generalize to unseen objects; however, the degree of generalization is a function of the similarity between the training and unseen objects, thus resulting in the uniform chimeras setting obtaining the lowest performance. ",
574
+ "bbox": [
575
+ 174,
576
+ 638,
577
+ 825,
578
+ 708
579
+ ],
580
+ "page_idx": 5
581
+ },
582
+ {
583
+ "type": "text",
584
+ "text": "Moreover, we observe examples of productivity, a key feature of compositionality. At test time, speakers are able to concoct novel messages on-the-fly (i.e., messages that are not part of their lexicon induced during training) to describe unseen objects. See the last three rows of Table 2, and the lexicon size column, for the percentage of novel messages. Even though listeners were not trained to associate novel messages with novel objects, they are still able comprehend such messages and correctly identify the target object. In the test data and length 10 cases, novel messages account for almost all of the generated messages, but with performance at $8 1 . 6 \\%$ , providing evidence of the structure found in the messages. ",
585
+ "bbox": [
586
+ 174,
587
+ 715,
588
+ 825,
589
+ 827
590
+ ],
591
+ "page_idx": 5
592
+ },
593
+ {
594
+ "type": "text",
595
+ "text": "3.3.2 TOPOGRAPHIC SIMILARITY ",
596
+ "text_level": 1,
597
+ "bbox": [
598
+ 176,
599
+ 843,
600
+ 416,
601
+ 857
602
+ ],
603
+ "page_idx": 5
604
+ },
605
+ {
606
+ "type": "text",
607
+ "text": "Given a set of objects, their meanings and the associated signals, Brighton & Kirby (2006) define topographic similarity to be the correlation of the distances between all the possible pairs of meanings and the corresponding pairs of signals. Figure 3 shows mappings between states and signals for examples of holistic (b) and compositional (c,d) languages, with the topographic similarity of compositional languages being higher than that of holistic. The intuition behind this measure is that semantically similar objects should have similar messages. ",
608
+ "bbox": [
609
+ 176,
610
+ 867,
611
+ 823,
612
+ 924
613
+ ],
614
+ "page_idx": 5
615
+ },
616
+ {
617
+ "type": "image",
618
+ "img_path": "images/cd5d57f50366fee02fe1b3ce12b993334e48d59f130b088d0fbe530764268416.jpg",
619
+ "image_caption": [
620
+ "Figure 3: left: Three languages with different properties, taken from Brighton & Kirby (2006). The mapping between states and signals shown in (b) is random; there is no relationship between points in the meaning and signal space. In (c) and (d), similar meanings map to similar signals, i.e., there is a topographic relation between meanings and signals. right: Relation between objects’ cosine similarity and their message Levenshtein distance for trained and random agents. "
621
+ ],
622
+ "image_footnote": [],
623
+ "bbox": [
624
+ 238,
625
+ 111,
626
+ 764,
627
+ 280
628
+ ],
629
+ "page_idx": 6
630
+ },
631
+ {
632
+ "type": "text",
633
+ "text": "",
634
+ "bbox": [
635
+ 173,
636
+ 402,
637
+ 823,
638
+ 430
639
+ ],
640
+ "page_idx": 6
641
+ },
642
+ {
643
+ "type": "text",
644
+ "text": "To compute this measure, we first compute two lists of numbers: (i) the Levenshtein distances between all pairs of objects’ messages; and (ii) the cosine similarity between all pairs of objects’ VisA vectors. Given these two lists, the topographic similarity is defined as their negative Spearman $\\rho$ correlation (since we are correlating distances with similarities, negative values of correlation indicate topographic similarity of the two spaces). Intuitively, if similar objects share much of the message structure (e.g., common prefixes or suffixes), and dissimilar objects have little common structure in their respective messages, then the topographic similarity should be high, the highest possible value being 1. ",
645
+ "bbox": [
646
+ 174,
647
+ 438,
648
+ 825,
649
+ 549
650
+ ],
651
+ "page_idx": 6
652
+ },
653
+ {
654
+ "type": "text",
655
+ "text": "Results presented back in Table 1, in the topographic $\\rho$ column, show that topographic similarity is positive in all experimental setups, indicating that similar objects receive similar messages $( p < 0 . 0 1$ , permutation test). A qualitative analysis of the messages generated in the length 10 and training data cases showed that, for example, $32 \\%$ of the mammal objects had as a message prefix the bigram $9 5 \\# 1 0 ^ { \\star }$ ; $36 \\%$ of vehicle objects had $\\cdot 6 8 \\# 9 5 $ ; and $11 \\%$ of tool objects had ‘0#61’, suggesting that these prefix bigrams encode category-specific information. ",
656
+ "bbox": [
657
+ 174,
658
+ 556,
659
+ 825,
660
+ 640
661
+ ],
662
+ "page_idx": 6
663
+ },
664
+ {
665
+ "type": "text",
666
+ "text": "Next, for each object pair, we calculate their Levenshtein message distance and respective cosine similarity, and plot in Figure 3 (right), for each distance, the average cosine similarities of the pairs with that distance (this is done for the length 10 and training data experiment). We observe that there is a clear relation between message similarity and meaning similarity (as measured by overlap in the VisA properties). In Figure 3, we also plot a similar correlation curve for an emerged language obtained by producing messages with randomly initialized and untrained speaker/listener architectures. This emerged language is at random in terms of communicative success; however, the generated messages do show signs of structure, since similar objects obtain somewhat similar messages. This seems to suggest that structured and disentangled pre-linguistic representations are, perhaps, a sufficient condition for the emergence of structured language, especially in neural network-based agents which, due to the nature of representation and information flow, favor similar inputs to trigger similar outputs. ",
667
+ "bbox": [
668
+ 174,
669
+ 646,
670
+ 825,
671
+ 813
672
+ ],
673
+ "page_idx": 6
674
+ },
675
+ {
676
+ "type": "text",
677
+ "text": "4 STUDY 2: REFERENTIAL GAME WITH RAW PIXEL DATA ",
678
+ "text_level": 1,
679
+ "bbox": [
680
+ 176,
681
+ 844,
682
+ 660,
683
+ 859
684
+ ],
685
+ "page_idx": 6
686
+ },
687
+ {
688
+ "type": "text",
689
+ "text": "In this section, we present experiments in which agents receive as input entangled data in the form of raw pixel input, and have to learn to perform visual conceptual processing guided by the communication-based reward. ",
690
+ "bbox": [
691
+ 176,
692
+ 882,
693
+ 823,
694
+ 922
695
+ ],
696
+ "page_idx": 6
697
+ },
698
+ {
699
+ "type": "text",
700
+ "text": "We use a synthetic dataset of scenes consisting of geometric objects generated using the MuJoCo physics engine (Todorov et al., 2012). We generate RGB images of resolution $1 2 4 \\times 1 2 4$ depicting single object scenes. For each object, we pick one of eight colors (blue, red, white, black, yellow, green, cyan, magenta) and five shapes (box, sphere, cylinder, capsule, ellipsoid) resulting in 40 combinations, for each of which we generate 100 variations, varying the floor color and the object location in the image. Moreover, we introduce different variants of the game: game A with 19 distractors; game B with 1 distractor; game C with 1 distractor, and with speaker and listener having different viewpoints of the target object (the target object on the listener’s side is in a different location); game D with 1 distractor, with speaker and listener having different viewpoints, and with balanced numbers of shapes and color (obtained by downsampling from 8 colors to 5 and removing any image containing objects of the 3 disregarded objects). For each game, we create train and test splits with proportions 75/25 (i.e., 3000/1000 for games A and B, and 1850/650 for games C and D). ",
701
+ "bbox": [
702
+ 174,
703
+ 104,
704
+ 825,
705
+ 284
706
+ ],
707
+ "page_idx": 7
708
+ },
709
+ {
710
+ "type": "text",
711
+ "text": "Pre-linguistic objects are presented in the form of pixel input, $o \\in [ 0 , 2 5 5 ] ^ { 3 \\times 1 2 4 \\times 1 2 4 }$ . Speaker and listener convert the images $o$ to dense representations $u$ , each of them using an 8-layer convolutional neural network (ConvNet). Crucially, we do not pre-train the ConvNets on an object classification task; the only learning signal is the communication-based reward. Despite this fact, we observe that the lower layers of the ConvNets are encoding similar information to a ConvNet pre-trained on ImageNet (Deng et al., 2009).3 Conceptually, we can think of the whole speaker/listener architecture as an encoder-decoder with a discrete bottleneck (the message). Given our initial positive findings, this reward-based learning signal induced from the communication game setup could be used for classagnostic large-scale ConvNet training. Moreover, we find that, even though no weights were shared, the agents’ conceptual spaces get aligned at different levels, reminiscent of theories of interactive conceptual alignment during dialogue (Garrod & Pickering, 2004) (see Appendix A for the related experiment). ",
712
+ "bbox": [
713
+ 174,
714
+ 290,
715
+ 825,
716
+ 457
717
+ ],
718
+ "page_idx": 7
719
+ },
720
+ {
721
+ "type": "text",
722
+ "text": "4.1 COMMUNICATIVE SUCCESS AND EMERGENT PROTOCOLS ",
723
+ "text_level": 1,
724
+ "bbox": [
725
+ 174,
726
+ 483,
727
+ 606,
728
+ 494
729
+ ],
730
+ "page_idx": 7
731
+ },
732
+ {
733
+ "type": "text",
734
+ "text": "Unlike the experiments of Section 3, where agents start from disentangled representations, starting from raw perceptual input presents a greater challenge: the agents have to establish naming conventions about scenes, while at the same time learning to process the input with their own visual conceptual system. Since we do not pre-train their ConvNets on an object recognition task, the dense representations $u$ used to derive the message contain no bias towards any image- or scene-specific information (e.g, object color, shape or location). The extraction of visual properties is thus driven entirely by the communication game. This contrasts with the cases of Havrylov & Titov (2017) and Lazaridou et al. (2017) who use pre-trained visual vectors, and qualitatively observe that the induced communication protocols encode information about objects. Table 3 presents the results in terms of communicative train and test success (see Appendix C for additional experiments when having access to gold object attribute classifiers). Moreover, we also report the topographic similarity (column topographic $\\rho \\mathrm { \\Sigma }$ ) between the symbolic attribute-based representations of scenes (floor color, object color, shape and location) and the generated messages. ",
735
+ "bbox": [
736
+ 174,
737
+ 510,
738
+ 825,
739
+ 690
740
+ ],
741
+ "page_idx": 7
742
+ },
743
+ {
744
+ "type": "text",
745
+ "text": "Overall, despite the challenges posed in this setup due to the raw nature of the data, performance across all games is well above chance, indicating that reinforcement learning agents trained end-toend are able to establish a communication protocol in this grounded environment. In game A, the agents reach $9 3 . 7 \\%$ accuracy, with their lexicon consisting of 1068 messages, describing 3000 training objects. Most importantly, as captured by the positive topographic similarity, agents produce messages that respect (even to a limited degree) the compositional nature of scenes (i.e., objects as bags-of-attributes), indicating that similar scenes receive similar messages. Indeed, by examining their protocol (see Table 4), we find that messages encode in a structurally consistent way information about absolute location of objects, with the message prefix and suffix denoting the horizontal and vertical co-ordinate, respectively. Interestingly, this communication strategy is also typically followed by human players of referential games (Kazemzadeh et al., 2014). ",
746
+ "bbox": [
747
+ 174,
748
+ 696,
749
+ 825,
750
+ 849
751
+ ],
752
+ "page_idx": 7
753
+ },
754
+ {
755
+ "type": "image",
756
+ "img_path": "images/1a48df6cd3a8b1c8b52b9ee8420e381abf4d505b03645f3a5586570289a52a63.jpg",
757
+ "image_caption": [
758
+ "Figure 4: Target images and their associated messages from game A and game B. "
759
+ ],
760
+ "image_footnote": [],
761
+ "bbox": [
762
+ 236,
763
+ 98,
764
+ 751,
765
+ 251
766
+ ],
767
+ "page_idx": 8
768
+ },
769
+ {
770
+ "type": "table",
771
+ "img_path": "images/1c33ae529b690363a8814473c5a0fd58333daa521703fa23bcc5b642ee753936.jpg",
772
+ "table_caption": [
773
+ "Table 3: Communicative success of agents playing different games. Columns random, train and test report percentage accuracies. Column topographic $\\rho$ reports the topographic similarity between the symbolic representation of scenes and the generated messages $( p < 0 . 0 1$ , permutation test). "
774
+ ],
775
+ "table_footnote": [],
776
+ "table_body": "<table><tr><td>game</td><td>distractors</td><td>balanced</td><td>viewpoints</td><td>lexicon size</td><td>random</td><td>train</td><td>test</td><td>topographic p</td></tr><tr><td>A</td><td>20</td><td>No</td><td>No</td><td>1068</td><td>5.0</td><td>93.7</td><td>93.6</td><td>0.13</td></tr><tr><td>B</td><td>2</td><td>No</td><td>No</td><td>13</td><td>50.0</td><td>93.2</td><td>93.4</td><td>0.006</td></tr><tr><td>C</td><td>2</td><td>No</td><td>Yes</td><td>8</td><td>50.0</td><td>86.0</td><td>85.7</td><td>0.07</td></tr><tr><td>D</td><td>2</td><td>Yes</td><td>Yes</td><td>5</td><td>50.0</td><td>90.4</td><td>89.9</td><td>0.06</td></tr></table>",
777
+ "bbox": [
778
+ 173,
779
+ 297,
780
+ 839,
781
+ 377
782
+ ],
783
+ "page_idx": 8
784
+ },
785
+ {
786
+ "type": "text",
787
+ "text": "However, we find the emerged protocols to be very unstable and too grounded in the specific game situation. Small modifications of the game setup, while having close to no negative impact on the communicative performance, can radically alter the form, semantics and interpretability of the communication protocol. In game B, performance remains at the same level $( 9 3 . 2 \\% )$ as game A. However, we observe that the protocol consists of 13 unique messages which do not reflect the objects’ attributes (as indicated by the close to zero topographic similarity), thus making the messages harder to interpret (see Figure 4 for randomly sampled examples). When we change the viewpoint of the agents in game C, biasing them against communicating about absolute object location, the players derive a compact communication protocol consisting of 8 unique messages that describe primarily color. Finally, when color and shape are balanced, as in game $\\mathbf { D }$ , we still observe a bias towards describing the color of objects, with the five induced messages providing a perfect clustering of the objects according to their colors.4 ",
788
+ "bbox": [
789
+ 174,
790
+ 462,
791
+ 825,
792
+ 628
793
+ ],
794
+ "page_idx": 8
795
+ },
796
+ {
797
+ "type": "text",
798
+ "text": "In an entangled world, agents do not possess a priori visual biases and knowledge of concepts. Since objects can be conceptualized in indefinitely many ways, the type of information encoded in the messages is tied to the environmental pressures; communication behaviour is a function of the environment, which also dictates what data structures can emerge. The implication of this observation is that protocols essentially overfit to the particular game situation, to the degree that they become specialized ad-hoc naming conventions. ",
799
+ "bbox": [
800
+ 174,
801
+ 636,
802
+ 823,
803
+ 719
804
+ ],
805
+ "page_idx": 8
806
+ },
807
+ {
808
+ "type": "text",
809
+ "text": "Interestingly, the emergence of ad-hoc naming conventions has also been observed during humanhuman interaction: when participants engage in some specific game situation (e.g., communicating about abstract tangram shapes), they tend to form highly specialized naming conceptions (conceptual pacts) that allow them to communicate with maximum efficiency (Brennan & Clark, 1996). While in this study we do not address the issue of how a stable and general language could emerge in entangled worlds, we believe that to alleviate the formation of such ad-hoc communication protocols, it is essential to increase the complexity of the games as well as requiring transfer across a variety of games. ",
810
+ "bbox": [
811
+ 174,
812
+ 726,
813
+ 825,
814
+ 837
815
+ ],
816
+ "page_idx": 8
817
+ },
818
+ {
819
+ "type": "table",
820
+ "img_path": "images/4008750bcb61befc4a824c46e6a1c278195b2e16c83358d4b9cad74b5cc97c8a.jpg",
821
+ "table_caption": [],
822
+ "table_footnote": [
823
+ "Table 4: Accuracy of probe linear classifiers of speaker’s induced visual representations (all accuracies are in percentage format). "
824
+ ],
825
+ "table_body": "<table><tr><td>game (random baseline)</td><td>object position (20.0)</td><td>object shape (20.0)</td><td>object color (12.0)</td><td>floor color (33.0)</td></tr><tr><td>A</td><td>95.3</td><td>90.2</td><td>24.7</td><td>36.4</td></tr><tr><td>B</td><td>88.6</td><td>41.2</td><td>63.8</td><td>45.4</td></tr><tr><td>C</td><td>85.9</td><td>43.5</td><td>65.8</td><td>43.8</td></tr><tr><td>D</td><td>89.4</td><td>47.1</td><td>82.0</td><td>42.3</td></tr></table>",
826
+ "bbox": [
827
+ 250,
828
+ 101,
829
+ 748,
830
+ 193
831
+ ],
832
+ "page_idx": 9
833
+ },
834
+ {
835
+ "type": "text",
836
+ "text": "4.2 PROBE MODELS ",
837
+ "text_level": 1,
838
+ "bbox": [
839
+ 174,
840
+ 257,
841
+ 325,
842
+ 271
843
+ ],
844
+ "page_idx": 9
845
+ },
846
+ {
847
+ "type": "text",
848
+ "text": "In order to investigate what information gets captured by the speaker’s ConvNet, we probe the inferred visual representations $u$ used to derive the message. Specifically, we design 4 probe classifiers for the color and shape of the object; object position which is derived by discretizing each co-ordinate into 3 bins; and floor color which is obtained by clustering the RGB color representation of the floor. For each probe, we performed 5-fold cross validation with a linear classifier, and report accuracy results in Table 4. Overall, different games result in visual representations with different predictive power; object position is almost always encoded in the speaker’s visual representation, even in situations where location of the object is not a good strategy for communication. On the other hand, object shape seems to provide less salient information, despite the fact that it is relevant for communication, at least in the C&D games. ",
849
+ "bbox": [
850
+ 174,
851
+ 284,
852
+ 825,
853
+ 422
854
+ ],
855
+ "page_idx": 9
856
+ },
857
+ {
858
+ "type": "text",
859
+ "text": "As expected, the structure and semantics of the emergent protocols are a function of the information captured in the visual representations. The degree to which the agents are able to pull apart the objects’ factors of variation impacts their ability to communicate about those factors, with the most extreme case being game D, where the message ignores the shape entirely. Thus, disentanglement seems to be a necessary condition for communication, at least in the case of pixel input. ",
860
+ "bbox": [
861
+ 174,
862
+ 429,
863
+ 825,
864
+ 498
865
+ ],
866
+ "page_idx": 9
867
+ },
868
+ {
869
+ "type": "text",
870
+ "text": "5 CONCLUSION ",
871
+ "text_level": 1,
872
+ "bbox": [
873
+ 176,
874
+ 518,
875
+ 318,
876
+ 535
877
+ ],
878
+ "page_idx": 9
879
+ },
880
+ {
881
+ "type": "text",
882
+ "text": "We presented a series of studies investigating the properties of protocols emerging when reinforcement learning agents are trained end-to-end on referential communication games. We found that when agents are presented with disentangled input data in the form of attribute vectors, this inherent compositional structure is successfully retained in the output. Moreover, we showed that communication can also be achieved in cases where agents are presented with raw pixel data, a type of input that aligns better with the raw sensorimotor data that humans are exposed to. At the same time, we found that their ability to form compositional protocols in these cases is hampered by their ability to pull apart the objects’ factors of variations. Altogether, we were able to successfully scale up traditional research from the language evolution literature on emergent communication tasks to the contemporary deep learning framework, thus opening avenues to more realistic, and large scale, computational simulations of language emergence with complex image stimuli. ",
883
+ "bbox": [
884
+ 174,
885
+ 551,
886
+ 825,
887
+ 704
888
+ ],
889
+ "page_idx": 9
890
+ },
891
+ {
892
+ "type": "text",
893
+ "text": "ACKNOWLEDGEMENTS ",
894
+ "text_level": 1,
895
+ "bbox": [
896
+ 176,
897
+ 726,
898
+ 367,
899
+ 741
900
+ ],
901
+ "page_idx": 9
902
+ },
903
+ {
904
+ "type": "text",
905
+ "text": "We would like to thank Murray Shanahan, Laura Rimell and Gabor Melis for their very helpful feedback on this paper, as well as the rest of the DeepMind language team for many discussions. AL would also like to thank Marco Baroni and Alex Peysakhovich for the email correspondence and discussions from a year ago, which provided inspiration for some of the experiments on this paper. ",
906
+ "bbox": [
907
+ 176,
908
+ 757,
909
+ 825,
910
+ 813
911
+ ],
912
+ "page_idx": 9
913
+ },
914
+ {
915
+ "type": "text",
916
+ "text": "REFERENCES ",
917
+ "text_level": 1,
918
+ "bbox": [
919
+ 176,
920
+ 834,
921
+ 285,
922
+ 849
923
+ ],
924
+ "page_idx": 9
925
+ },
926
+ {
927
+ "type": "text",
928
+ "text": "Jacob Andreas and Dan Klein. Analogs of linguistic structure in deep representations. arXiv preprint arXiv:1707.08139, 2017. ",
929
+ "bbox": [
930
+ 173,
931
+ 857,
932
+ 823,
933
+ 885
934
+ ],
935
+ "page_idx": 9
936
+ },
937
+ {
938
+ "type": "text",
939
+ "text": "Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. arXiv preprint arXiv:1710.03748, 2017. ",
940
+ "bbox": [
941
+ 176,
942
+ 895,
943
+ 820,
944
+ 924
945
+ ],
946
+ "page_idx": 9
947
+ },
948
+ {
949
+ "type": "text",
950
+ "text": "John Batali. Computational simulations of the emergence of grammar. pp. 405–426, 1998. ",
951
+ "bbox": [
952
+ 168,
953
+ 103,
954
+ 767,
955
+ 119
956
+ ],
957
+ "page_idx": 10
958
+ },
959
+ {
960
+ "type": "text",
961
+ "text": "Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013. ",
962
+ "bbox": [
963
+ 176,
964
+ 127,
965
+ 823,
966
+ 170
967
+ ],
968
+ "page_idx": 10
969
+ },
970
+ {
971
+ "type": "text",
972
+ "text": "Susan E Brennan and Herbert H Clark. Conceptual pacts and lexical choice in conversation. Journal of Experimental Psychology: Learning, Memory, and Cognition, 22(6):1482, 1996. ",
973
+ "bbox": [
974
+ 169,
975
+ 179,
976
+ 825,
977
+ 209
978
+ ],
979
+ "page_idx": 10
980
+ },
981
+ {
982
+ "type": "text",
983
+ "text": "Henry Brighton. Compositional syntax from cultural transmission. Artificial life, 8(1):25–54, 2002. ",
984
+ "bbox": [
985
+ 171,
986
+ 218,
987
+ 823,
988
+ 233
989
+ ],
990
+ "page_idx": 10
991
+ },
992
+ {
993
+ "type": "text",
994
+ "text": "Henry Brighton and Simon Kirby. Understanding linguistic evolution by visualizing the emergence of topographic mappings. Artificial life, 12(2):229–242, 2006. ",
995
+ "bbox": [
996
+ 171,
997
+ 242,
998
+ 825,
999
+ 272
1000
+ ],
1001
+ "page_idx": 10
1002
+ },
1003
+ {
1004
+ "type": "text",
1005
+ "text": "Ted Briscoe (ed.). Linguistic evolution through language acquisition. Cambridge University Press, Cambridge, UK, 2002. ",
1006
+ "bbox": [
1007
+ 173,
1008
+ 280,
1009
+ 825,
1010
+ 309
1011
+ ],
1012
+ "page_idx": 10
1013
+ },
1014
+ {
1015
+ "type": "text",
1016
+ "text": "Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016. ",
1017
+ "bbox": [
1018
+ 173,
1019
+ 318,
1020
+ 823,
1021
+ 348
1022
+ ],
1023
+ "page_idx": 10
1024
+ },
1025
+ {
1026
+ "type": "text",
1027
+ "text": "Angelo Cangelosi and Domenico Parisi (eds.). Simulating the evolution of language. Springer, New York, 2002. ",
1028
+ "bbox": [
1029
+ 173,
1030
+ 356,
1031
+ 821,
1032
+ 386
1033
+ ],
1034
+ "page_idx": 10
1035
+ },
1036
+ {
1037
+ "type": "text",
1038
+ "text": "Jon W Carr, Kenny Smith, Hannah Cornish, and Simon Kirby. The cultural evolution of structured languages in an open-ended, continuous world. Cognitive science, 41(4):892–923, 2017. ",
1039
+ "bbox": [
1040
+ 171,
1041
+ 395,
1042
+ 821,
1043
+ 424
1044
+ ],
1045
+ "page_idx": 10
1046
+ },
1047
+ {
1048
+ "type": "text",
1049
+ "text": "Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009. ",
1050
+ "bbox": [
1051
+ 173,
1052
+ 433,
1053
+ 825,
1054
+ 477
1055
+ ],
1056
+ "page_idx": 10
1057
+ },
1058
+ {
1059
+ "type": "text",
1060
+ "text": "Katrina Evtimova, Andrew Drozdov, Douwe Kiela, and Kyunghyun Cho. Emergent language in a multi-modal, multi-step referential game. arXiv preprint arXiv:1705.10369, 2017. ",
1061
+ "bbox": [
1062
+ 173,
1063
+ 484,
1064
+ 823,
1065
+ 515
1066
+ ],
1067
+ "page_idx": 10
1068
+ },
1069
+ {
1070
+ "type": "text",
1071
+ "text": "Michael Franke. The evolution of compositionality in signaling games. Journal of Logic, Language and Information, pp. 1–23, 2015. ",
1072
+ "bbox": [
1073
+ 173,
1074
+ 523,
1075
+ 823,
1076
+ 553
1077
+ ],
1078
+ "page_idx": 10
1079
+ },
1080
+ {
1081
+ "type": "text",
1082
+ "text": "Gottlob Frege. Uber Sinn und Bedeutung. ¨ Zeitschrift fur Philosophie und philosophische Kritik ¨ , 100:25–50, 1892. ",
1083
+ "bbox": [
1084
+ 173,
1085
+ 561,
1086
+ 823,
1087
+ 590
1088
+ ],
1089
+ "page_idx": 10
1090
+ },
1091
+ {
1092
+ "type": "text",
1093
+ "text": "Simon Garrod and Martin J Pickering. Why is conversation so easy? Trends in cognitive sciences, 8(1):8–11, 2004. ",
1094
+ "bbox": [
1095
+ 173,
1096
+ 599,
1097
+ 823,
1098
+ 628
1099
+ ],
1100
+ "page_idx": 10
1101
+ },
1102
+ {
1103
+ "type": "text",
1104
+ "text": "Serhii Havrylov and Ivan Titov. Emergence of language with multi-agent games: Learning to communicate with sequences of symbols. arXiv preprint arXiv:1705.11192, 2017. ",
1105
+ "bbox": [
1106
+ 173,
1107
+ 637,
1108
+ 823,
1109
+ 667
1110
+ ],
1111
+ "page_idx": 10
1112
+ },
1113
+ {
1114
+ "type": "text",
1115
+ "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. ",
1116
+ "bbox": [
1117
+ 176,
1118
+ 676,
1119
+ 820,
1120
+ 719
1121
+ ],
1122
+ "page_idx": 10
1123
+ },
1124
+ {
1125
+ "type": "text",
1126
+ "text": "Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojtek Czarnecki, Max Jaderberg, Denis Teplyashin, et al. Grounded language learning in a simulated 3d world. arXiv preprint arXiv:1706.06551, 2017. ",
1127
+ "bbox": [
1128
+ 174,
1129
+ 728,
1130
+ 825,
1131
+ 772
1132
+ ],
1133
+ "page_idx": 10
1134
+ },
1135
+ {
1136
+ "type": "text",
1137
+ "text": "Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997. ",
1138
+ "bbox": [
1139
+ 171,
1140
+ 780,
1141
+ 823,
1142
+ 809
1143
+ ],
1144
+ "page_idx": 10
1145
+ },
1146
+ {
1147
+ "type": "text",
1148
+ "text": "Sahar Kazemzadeh, Vicente Ordonez, Mark Matten, and Tamara L Berg. Referitgame: Referring to objects in photographs of natural scenes. In EMNLP, pp. 787–798, 2014. ",
1149
+ "bbox": [
1150
+ 173,
1151
+ 818,
1152
+ 825,
1153
+ 848
1154
+ ],
1155
+ "page_idx": 10
1156
+ },
1157
+ {
1158
+ "type": "text",
1159
+ "text": "Satwik Kottur, Jose MF Moura, Stefan Lee, and Dhruv Batra. Natural language does not ´ emerge’naturally’in multi-agent dialog. arXiv preprint arXiv:1706.08502, 2017. ",
1160
+ "bbox": [
1161
+ 173,
1162
+ 857,
1163
+ 820,
1164
+ 886
1165
+ ],
1166
+ "page_idx": 10
1167
+ },
1168
+ {
1169
+ "type": "text",
1170
+ "text": "Angeliki Lazaridou, Alexander Peysakhovich, and Marco Baroni. Multi-agent cooperation and the emergence of (natural) language. In ICLR, 2017. ",
1171
+ "bbox": [
1172
+ 173,
1173
+ 895,
1174
+ 820,
1175
+ 924
1176
+ ],
1177
+ "page_idx": 10
1178
+ },
1179
+ {
1180
+ "type": "text",
1181
+ "text": "David Lewis. Convention. Harvard University Press, Cambridge, MA, 1969. ",
1182
+ "bbox": [
1183
+ 173,
1184
+ 103,
1185
+ 676,
1186
+ 118
1187
+ ],
1188
+ "page_idx": 11
1189
+ },
1190
+ {
1191
+ "type": "text",
1192
+ "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. ",
1193
+ "bbox": [
1194
+ 176,
1195
+ 127,
1196
+ 823,
1197
+ 171
1198
+ ],
1199
+ "page_idx": 11
1200
+ },
1201
+ {
1202
+ "type": "text",
1203
+ "text": "Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016. ",
1204
+ "bbox": [
1205
+ 178,
1206
+ 178,
1207
+ 825,
1208
+ 222
1209
+ ],
1210
+ "page_idx": 11
1211
+ },
1212
+ {
1213
+ "type": "text",
1214
+ "text": "Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. arXiv preprint arXiv:1703.04908, 2017. ",
1215
+ "bbox": [
1216
+ 171,
1217
+ 231,
1218
+ 823,
1219
+ 260
1220
+ ],
1221
+ "page_idx": 11
1222
+ },
1223
+ {
1224
+ "type": "text",
1225
+ "text": "Martin A Nowak and David C Krakauer. The evolution of language. Proceedings of the National Academy of Sciences, 96(14):8028–8033, 1999. ",
1226
+ "bbox": [
1227
+ 169,
1228
+ 268,
1229
+ 825,
1230
+ 296
1231
+ ],
1232
+ "page_idx": 11
1233
+ },
1234
+ {
1235
+ "type": "text",
1236
+ "text": "Steven T Piantadosi, Harry Tily, and Edward Gibson. The communicative function of ambiguity in language. Cognition, 122(3):280–291, 2012. ",
1237
+ "bbox": [
1238
+ 171,
1239
+ 306,
1240
+ 823,
1241
+ 335
1242
+ ],
1243
+ "page_idx": 11
1244
+ },
1245
+ {
1246
+ "type": "text",
1247
+ "text": "Carina Silberer, Vittorio Ferrari, and Mirella Lapata. Models of semantic representation with visual attributes. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 572–582, Sofia, Bulgaria, August 2013. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/P13-1056. ",
1248
+ "bbox": [
1249
+ 173,
1250
+ 343,
1251
+ 825,
1252
+ 400
1253
+ ],
1254
+ "page_idx": 11
1255
+ },
1256
+ {
1257
+ "type": "text",
1258
+ "text": "David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of go without human knowledge. Nature, 550:354–359, 2017. ",
1259
+ "bbox": [
1260
+ 174,
1261
+ 409,
1262
+ 825,
1263
+ 465
1264
+ ],
1265
+ "page_idx": 11
1266
+ },
1267
+ {
1268
+ "type": "text",
1269
+ "text": "Brian Skyrms. Signals: Evolution, learning, and information. Oxford University Press, 2010. ",
1270
+ "bbox": [
1271
+ 171,
1272
+ 474,
1273
+ 787,
1274
+ 489
1275
+ ],
1276
+ "page_idx": 11
1277
+ },
1278
+ {
1279
+ "type": "text",
1280
+ "text": "Kenny Smith, Simon Kirby, and Henry Brighton. Iterated learning: A framework for the emergence of language. Artificial life, 9(4):371–386, 2003. ",
1281
+ "bbox": [
1282
+ 174,
1283
+ 498,
1284
+ 823,
1285
+ 527
1286
+ ],
1287
+ "page_idx": 11
1288
+ },
1289
+ {
1290
+ "type": "text",
1291
+ "text": "Matthew Spike, Kevin Stadler, Simon Kirby, and Kenny Smith. Minimal requirements for the emergence of learned signaling. Cognitive Science, 2016. In press. ",
1292
+ "bbox": [
1293
+ 173,
1294
+ 536,
1295
+ 823,
1296
+ 565
1297
+ ],
1298
+ "page_idx": 11
1299
+ },
1300
+ {
1301
+ "type": "text",
1302
+ "text": "Luc Steels. Social language learning. In Mario Tokoro and Luc Steels (eds.), The Future of Learning, pp. 133–162. IOS, Amsterdam, 2003. ",
1303
+ "bbox": [
1304
+ 174,
1305
+ 574,
1306
+ 823,
1307
+ 603
1308
+ ],
1309
+ "page_idx": 11
1310
+ },
1311
+ {
1312
+ "type": "text",
1313
+ "text": "Luc Steels and Martin Loetzsch. The grounded naming game. In Luc Steels (ed.), Experiments in Cultural Language Evolution, pp. 41–59. John Benjamins, Amsterdam, 2012. ",
1314
+ "bbox": [
1315
+ 173,
1316
+ 611,
1317
+ 823,
1318
+ 641
1319
+ ],
1320
+ "page_idx": 11
1321
+ },
1322
+ {
1323
+ "type": "text",
1324
+ "text": "Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012. ",
1325
+ "bbox": [
1326
+ 173,
1327
+ 648,
1328
+ 826,
1329
+ 691
1330
+ ],
1331
+ "page_idx": 11
1332
+ },
1333
+ {
1334
+ "type": "text",
1335
+ "text": "Kyle Wagner, James A Reggia, Juan Uriagereka, and Gerald S Wilkinson. Progress in the simulation of emergent communication and language. Adaptive Behavior, 11(1):37–69, 2003. ",
1336
+ "bbox": [
1337
+ 173,
1338
+ 700,
1339
+ 823,
1340
+ 731
1341
+ ],
1342
+ "page_idx": 11
1343
+ },
1344
+ {
1345
+ "type": "text",
1346
+ "text": "Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn., 8(3-4):229–256, May 1992. ISSN 0885-6125. doi: 10.1007/ BF00992696. URL https://doi.org/10.1007/BF00992696. ",
1347
+ "bbox": [
1348
+ 174,
1349
+ 738,
1350
+ 823,
1351
+ 781
1352
+ ],
1353
+ "page_idx": 11
1354
+ },
1355
+ {
1356
+ "type": "text",
1357
+ "text": "Ludwig Wittgenstein. Philosophical Investigations. Blackwell, Oxford, UK, 1953. Translated by G.E.M. Anscombe. ",
1358
+ "bbox": [
1359
+ 169,
1360
+ 790,
1361
+ 823,
1362
+ 819
1363
+ ],
1364
+ "page_idx": 11
1365
+ },
1366
+ {
1367
+ "type": "text",
1368
+ "text": "A CONCEPTUAL ALIGNMENT OF SPEAKER AND LISTENER ",
1369
+ "text_level": 1,
1370
+ "bbox": [
1371
+ 176,
1372
+ 103,
1373
+ 666,
1374
+ 117
1375
+ ],
1376
+ "page_idx": 12
1377
+ },
1378
+ {
1379
+ "type": "text",
1380
+ "text": "During conversation, communication allows interlocutors to achieve interactive conceptual alignment (Garrod & Pickering, 2004). We are able to communicate because we have established a common ground and our representations at different levels become aligned (e.g., participants mutually understand that “he” in the conversation refers to Bob). We investigated whether the agents’ conceptual systems achieve a similar structural alignment. We measure the alignment in terms of Spearman $\\rho$ correlation of the intra-agent pairwise object cosine similarities as calculated via representing objects as activations from ConvNet layers. ",
1381
+ "bbox": [
1382
+ 174,
1383
+ 133,
1384
+ 825,
1385
+ 231
1386
+ ],
1387
+ "page_idx": 12
1388
+ },
1389
+ {
1390
+ "type": "text",
1391
+ "text": "Interestingly, we observe a gradual increase in the structural similarity as we represent the objects with layer activations closer to the pixel space. Conceptual spaces are more aligned the closer they are to the raw pixel input $\\mathrm { ~ \\ ' ~ } \\rho = 0 . 9 7 \\mathrm { - } 0 . 9 1$ , depending on the game) and become more dissimilar as the representations become more abstract. We can draw the analogy to language processing, as first ConvNet layers perform some low-level processing analogous to phoneme recognition or word segmentation (and are thus more objective) while higher layers perform more abstract processing, vaguely analogous to semantics and pragmatics (thus, represent more subjective knowledge). In cases of successful communication, speakers’ and listeners’ conceptual spaces closer to the communication point are structurally very similar $\\prime \\rho = 0 . 8 5 – 0 . 6 2$ , depending on the game), however this similarity drops dramatically in cases of failure of communication $\\mathit { \\Pi } _ { \\rho } = 0 . 1 5 $ ). ",
1392
+ "bbox": [
1393
+ 174,
1394
+ 238,
1395
+ 825,
1396
+ 377
1397
+ ],
1398
+ "page_idx": 12
1399
+ },
1400
+ {
1401
+ "type": "text",
1402
+ "text": "B HYPERPARAMETER DETAILS ",
1403
+ "text_level": 1,
1404
+ "bbox": [
1405
+ 176,
1406
+ 397,
1407
+ 444,
1408
+ 414
1409
+ ],
1410
+ "page_idx": 12
1411
+ },
1412
+ {
1413
+ "type": "text",
1414
+ "text": "All LSTM hidden states of the “speaking” and “listening” module as well and the “seeing” prelinguistic feed-forward encoders (see Section 3), have dimension 50. The “seeing” pre-linguistic ConvNet encoders (see Section 4) has 8 layers, 32 filters with the kernel size 3 for every layer and with strides $[ 2 , 1 , 1 , 2 , 1 , 2 , 1 , 2 ]$ for each layer. We use ReLU as activation function as well as batch normalization for every layer. ",
1415
+ "bbox": [
1416
+ 174,
1417
+ 428,
1418
+ 823,
1419
+ 500
1420
+ ],
1421
+ "page_idx": 12
1422
+ },
1423
+ {
1424
+ "type": "text",
1425
+ "text": "For learning, we used the Rmsprop optimizer, with learning rate 0.0001. We use a separate value of entropy regularization for each policy. For $\\pi ^ { S }$ we use 0.01 and for $\\pi ^ { L }$ we use 0.001. We use a mini-batch of 32. ",
1426
+ "bbox": [
1427
+ 176,
1428
+ 506,
1429
+ 823,
1430
+ 546
1431
+ ],
1432
+ "page_idx": 12
1433
+ },
1434
+ {
1435
+ "type": "text",
1436
+ "text": "C COMMUNICATIVE SUCCESS USING GOLD ATTRIBUTE CLASSIFIERS ",
1437
+ "text_level": 1,
1438
+ "bbox": [
1439
+ 173,
1440
+ 569,
1441
+ 754,
1442
+ 583
1443
+ ],
1444
+ "page_idx": 12
1445
+ },
1446
+ {
1447
+ "type": "text",
1448
+ "text": "We assume a model which has access to perfect attribute classifiers for color, shape and object position, for the latter using a classifier operating on the discretized annotations we obtained in Section 4.2 after quantazing the real-valued object location. For computing the performance of this model using gold attribute classifiers, we first remove from the distractors any candidate not matching the target’s attributes and them pick at random. We repeat this experiment for single attribute classifiers and their pairwise combinations. Table 5 reports the communicative success results obtained empirically by averaging across 1000 simulations, alongside the training and test accuracies of the trained agents of Section 4.1 for comparison. ",
1449
+ "bbox": [
1450
+ 173,
1451
+ 599,
1452
+ 825,
1453
+ 710
1454
+ ],
1455
+ "page_idx": 12
1456
+ },
1457
+ {
1458
+ "type": "table",
1459
+ "img_path": "images/4818f702a613ac7e52f8690ab546facbc7e7d7d02b696c76a5dc6baf197721bc.jpg",
1460
+ "table_caption": [
1461
+ "Table 5: Communicative success of trained models from Section 4.1 (train and test) as well as models with access to gold classifiers. All accuracies are in percentage format. "
1462
+ ],
1463
+ "table_footnote": [],
1464
+ "table_body": "<table><tr><td> game</td><td>train</td><td>test</td><td>color</td><td>shape</td><td>position</td><td>color &amp; shape</td><td> position &amp; shape</td><td>position &amp; color</td></tr><tr><td>A</td><td>93.7</td><td>93.6</td><td>37.2</td><td>24.8</td><td>69.3</td><td>80.4</td><td>92.1</td><td>95.6</td></tr><tr><td>B</td><td>93.2</td><td>93.4</td><td>93.2</td><td>90.1</td><td>97.2</td><td>98.8</td><td>99.3</td><td>99.4</td></tr><tr><td>C</td><td>86.0</td><td>85.7</td><td>93.2</td><td>90.1</td><td>-</td><td>98.8</td><td>1</td><td>1</td></tr><tr><td>D</td><td>90.4</td><td>89.9</td><td>89.6</td><td>89.2</td><td>1</td><td>98.5</td><td>1</td><td>1</td></tr></table>",
1465
+ "bbox": [
1466
+ 174,
1467
+ 803,
1468
+ 854,
1469
+ 882
1470
+ ],
1471
+ "page_idx": 12
1472
+ }
1473
+ ]
parse/train/HJGv1Z-AW/HJGv1Z-AW_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HJGv1Z-AW/HJGv1Z-AW_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/S1gd7nCcF7/S1gd7nCcF7.md ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SELF-SUPERVISED GENERALISATION WITH META AUXILIARY LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Auxiliary learning has been shown to improve the generalisation performance of a principal task. But typically, this requires manually-defined auxiliary tasks based on domain knowledge. In this paper, we consider that it may be possible to automatically learn these auxiliary tasks to best suit the principal task, towards optimum auxiliary tasks without any human knowledge. We propose a novel method, Meta Auxiliary Learning (MAXL), which we design for the task of image classification, where the auxiliary task is hierarchical sub-class image classification. The role of the meta learner is to determine sub-class target labels to train a multi-task evaluator, such that these labels improve the generalisation performance on the principal task. Experiments on three different CIFAR datasets show that MAXL outperforms baseline auxiliary learning methods, and is competitive even with a method which uses human-defined sub-class hierarchies. MAXL is self-supervised and general, and therefore offers a promising new direction towards automated generalisation.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Auxiliary learning is a method to improve the generalisation of a task. It works by training on additional auxiliary tasks simultaneously with the principal task. Extra data may be available for those auxiliary tasks, but not the principal task. If the auxiliary tasks and the principal task share some common reasoning, then the prediction model is encouraged to learn additional relevant features which otherwise would not be learned from single-task learning. The broader support of these features then assists with generalisation of the principal task.
12
+
13
+ We now rethink this generalisation by considering that not all auxiliary tasks are created equal. In supervised auxiliary learning (Liebel & Korner, 2018; Toshniwal et al., 2017), auxiliary tasks can be ¨ carefully chosen to complement the principal task, but at the expense of a dependency on labelled data. Unsupervised auxiliary learning (Flynn et al., 2016; Zhou et al., 2017; Zhang et al., 2018; Jaderberg et al., 2017) alleviates this, but at the expense of a limited set of auxiliary tasks which may not be well aligned with the principal task. By combining the merits of both supervised and unsupervised auxiliary learning, the ideal auxiliary learning framework is one with the flexibility to automatically determine the optimum auxiliary tasks, but without the requirement of any manuallylabelled data.
14
+
15
+ In this paper, we propose to achieve such a framework with a simple and general meta-learning algorithm which we call Meta AuXiliary Learning (MAXL). Given a principal task, the goal of MAXL is to discover the auxiliary tasks which, when trained alongside the principal task, give the greatest generalisation performance of the principal task on a meta dataset. In our work, we focus on the problem of image classification, where an auxiliary task is required to assign a sub-class label to an image. As such, data is classified both at a coarse level as the principal task, and at a fine level as the auxiliary task. The meta learner’s role is then to determine the target labels for this sub-class labelling, in such a way that the learned features induced by learning these additional, more complex auxiliary tasks generate the best generalisation performance for the principal task.
16
+
17
+ As well as our method being able to automatically learn the optimum auxiliary tasks, we achieve this in an unsupervised manner, giving potential to scale well beyond any datasets without manuallylabelled auxiliary tasks, such as a class hierarchy as in our experiments. And even when such a hierarchy is available, in our experiments we show that MAXL is at least as competitive despite this hierarchy being learned in an unsupervised manner. In our experiments, we define the auxiliary tasks as sub-class labelling with MAXL learning to generate target sub-class labels, but MAXL is general and in future work this could be relaxed to actually learn the auxiliary tasks themselves. The ability to learn these tasks in a purely unsupervised and scalable manner opens up an exciting new way of thinking about how we can achieve generalisation in an automated manner.
18
+
19
+ ![](images/9be7e47f76a69d61e122286e9e1ded5295110c346ed9a4f5ad2eac73b4c4eaa3.jpg)
20
+ Figure 1: Illustration of our proposed MAXL framework. The Multi-task evaluator takes an input image and is trained to predict both the principal class (e.g. Dog), and the auxiliary class (e.g. Border Collie). The principal class has a ground-truth label, but the label for the auxiliary class is determined by the meta generator. The meta generator is trained by outputting auxiliary class labels which, when used to train the multi-task evaluator, improve its prediction performance on the principal task.
21
+
22
+ # 2 RELATED WORK
23
+
24
+ This work brings ideas together from a number of related areas of machine learning.
25
+
26
+ Multi-task & Transfer Learning The aim of multi-task learning (MTL) is to achieve shared representations by simultaneously training a set of related learning tasks. In this case, the learned knowledge used to share across domains is encoded into the feature representations, to improve performance of each individual task, since knowledge distilled from related tasks are interdependent. The success of deep neural networks has led to some recent methods advancing the multi-task architecture design, such as applying a linear combination of task-specific features (Misra et al., 2016; Doersch & Zisserman, 2017; Kokkinos, 2017). Liu et al. (2018) applied soft-attention modules as feature selectors, allowing learning of both task-shared and task-specific features in a selfsupervised, end-to-end manner. Transfer learning is another common approach to improve generalisation, by incorporating knowledge learned from one or more related domains. Pre-training a model with a large-scale dataset such as ImageNet (Deng et al., 2009) has become standard practise in many vision-based applications. The transferability of different convolutional layers in CNNs has also been investigated in Yosinski et al. (2014).
27
+
28
+ Auxiliary Learning Whilst in multi-task learning the goal is high test accuracy across all tasks, auxiliary learning differs in that high test accuracy is only required for a single principal task, and the role of the auxiliary tasks is to assist in generalisation of this principal task. Toshniwal et al. (2017) applied auxiliary supervision with phoneme recognition at intermediate low-level representations of deep networks to improve the performance of conversational speech recognition. Liebel & Korner ¨ (2018) chose auxiliary tasks which can be obtained with low effort, such as global descriptions of a scene, to boost the performance for single scene depth estimation and semantic segmentation. By carefully choosing a pair of learning tasks, we may also perform auxiliary learning without ground truth labels, in an unsupervised manner. Jaderberg et al. (2017) introduced a method for improving the learning agents in Atari games, by building unsupervised auxiliary tasks to predict the onset of immediate rewards from a short historical context. Flynn et al. (2016); Zhou et al. (2017) proposed image synthesis networks to perform unsupervised monocular depth estimation by predicting the relative pose of multiple cameras. Different from these works which require prior knowledge to manually define suitable auxiliary tasks, our proposed method requires no additional task knowledge, since our meta learner generates useful auxiliary knowledge in a purely unsupervised fashion. The most similar work to ours is Zhang et al. (2018), in which meta learning was used in auxiliary data selection. However, this still requires manually-labelled data from which these selections are made, whilst our method is able to generate auxiliary data from scratch.
29
+
30
+ Meta Learning Meta learning (or learning to learn) aims to design a higher-level learning system which itself is trained using the experiences of a lower-level learning system, in an attempt to improve this lower-level system. Early works in meta learning explored automatically learning update rules for neural models (Bengio et al., 1990; 1992; Schmidhuber, 1992). Recent approaches have focused on learning optimisers for deep networks based on LSTMs (Ravi & Larochelle, 2016) or synthetic gradients (Andrychowicz et al., 2016; Jaderberg et al., 2016). Meta learning has also been studied for finding optimal hyper-parameters (Li et al., 2017) and a good initialisation for few-shot learning (Finn et al., 2017). (Santoro et al., 2016) also investigated few shot learning via an external memory module. Vinyals et al. (2016); Snell et al. (2017) realised few shot learning in the instance space via a differentiable nearest-neighbour approach. Our method also performs in the instance space, but induces auxiliary knowledge as an implicit regularisation to improve generalisation of the principal task.
31
+
32
+ # 3 META AUXILIARY LEARNING
33
+
34
+ In this section, we introduce our method for automatically generating optimum auxiliary tasks, which we call Meta AuXiliary Learning (MAXL).
35
+
36
+ # 3.1 PROBLEM SETUP
37
+
38
+ The goal of meta auxiliary learning is to train a meta generator that can generate higher complexity auxiliary tasks, to improve performance of the principal task. To accomplish this, we use two networks: a multi-task evaluator which trains on the principal and auxiliary tasks, and evaluates the performance of the auxiliary tasks on a meta set, and a meta generator which generates these auxiliary tasks. For simplicity, we consider image classification tasks in this section, where the auxiliary task is sub-class labelling, and the meta generator determines target sub-class labels, but the approach can be considered general for any type of task.
39
+
40
+ We denote the multi-task evaluator as a function $f _ { \theta _ { 1 } } ( x )$ that takes an input $x$ with network parameters $\theta _ { 1 }$ , and the meta generator as a function $g _ { \theta _ { 2 } } ( x )$ that takes the same input $x$ with network parameters $\theta _ { 2 }$ . For a dataset with input $x$ and ground-truth label $y$ for the principal task, we split into three subsets: training $( x _ { \mathrm { t r a i n } } , y _ { \mathrm { t r a i n } } )$ , meta-training $( x _ { \mathrm { m e t a } } , y _ { \mathrm { m e t a } } )$ , and test $( x _ { \mathrm { t e s t } } , y _ { \mathrm { t e s t } } )$ . Training data is used for updating $\theta _ { 1 }$ , meta-training data is used for updating the $\theta _ { 2 }$ , and test data is used for overall evaluation.
41
+
42
+ In the multi-task evaluator, we apply a hard parameter sharing approach (Ruder, 2017) in which we predict the principal and auxiliary tasks using the shared set of features $\theta _ { 1 }$ in the multi-task network. At the end of the last feature layer $f _ { \theta _ { 1 } } ( x )$ , we then apply further task-specific layers to output the corresponding prediction for each task. We denote the predicted principal labels by $f _ { \theta _ { 1 } } ^ { \mathrm { p r i } } ( x )$ and predicted auxiliary labels by $f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x )$ .
43
+
44
+ In the meta generator, we pre-define a hierarchical structure $\psi$ which determines the number of subclasses for each class in the principal task. At the end of the last feature layer $g _ { \theta _ { 2 } } ( x )$ , this hierarchy, together with the ground-truth label $y$ for the principal task, are used to generate the target auxiliary labels, denoted by $g _ { \theta _ { 2 } } ^ { \mathrm { g e n } } ( x , y , \psi )$ . We allow for soft assignment labelling rather than enforcing onehot encoding, which enables greater flexibility to learn optimum auxiliary tasks. The meta generator uses a masked SoftMax to ensure that each output node represents a sub-class label for only one class in the principal task, as described further in Section 3.3. The visualisation of the our proposed MAXL approach is shown in Figure 2.
45
+
46
+ ![](images/727e86b2ef0470221fae2f43e47889a0ae8a621f009cf89078060a2777ebee3a.jpg)
47
+ Figure 2: (a) Illustration of the two networks which make up our meta auxiliary learning algorithm. (b) Illustration of vanilla SoftMax and Mask SoftMax with 3 principal classes. Vanilla SoftMax outputs over all 5 auxiliary classes, where as Mask Softmax outputs over a hierarchical structure $\psi \overset { = } { = } [ 2 , 2 , 1 ]$ to constrain the prediction space.
48
+
49
+ # 3.2 MODEL OBJECTIVES
50
+
51
+ The multi-task evaluator is trained in a tightly-coupled manner with the meta generator: the meta generator determines target labels for the multi-task evaluator, which in turn determines the suitability of those labels.
52
+
53
+ Given target labels as determined by the meta generator, the multi-task evaluator is trained to predict these labels, alongside the ground-truth labels for the principal task. For both the principal and auxiliary classification tasks, we apply focal loss (Lin et al., 2017) with a focusing parameter $\gamma = 2$ , defined as:
54
+
55
+ $$
56
+ \mathcal { L } ( \hat { y } , y ) = - y ( 1 - \hat { y } ) ^ { \gamma } \log ( \hat { y } ) ,
57
+ $$
58
+
59
+ where $\hat { y }$ is the predicted label and $y$ is the ground-truth label. The focal loss helps to focus on the incorrectly predicted labels, which we found improved performance during our experimental evaluation compared with the regular cross-entropy log loss.
60
+
61
+ To update parameters $\theta _ { 1 }$ in the multi-task evaluator, we define the multi-task objective as follows:
62
+
63
+ $$
64
+ \underset { \theta _ { 1 } } { \arg \operatorname* { m i n } } \left( \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { p r i } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } ) , y _ { \mathrm { t r a i n } } ^ { ( i ) } ) + \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } ) , g _ { \theta _ { 2 } } ^ { \mathrm { g e n } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } , y _ { \mathrm { t r a i n } } ^ { ( i ) } , \psi ) ) \right) \ ,
65
+ $$
66
+
67
+ where $( i )$ represents the $i ^ { t h }$ batch from the training data.
68
+
69
+ The meta generator is then trained by encouraging target labels for the auxiliary task to be chosen such that, if the multi-task evaluator were to be trained on these labels, the performance on the principal task would be maximised. This requires evaluation on a separate dataset, the meta-training set, to train the meta generator, to ensure that the target auxiliary labels encourage generalisation beyond the data supplied to the multi-task evaluator.
70
+
71
+ To update parameters $\theta _ { 2 }$ in the meta generator, we define the meta objective as follows:
72
+
73
+ $$
74
+ \underset { \theta _ { 2 } } { \arg \operatorname* { m i n } } \mathcal { L } ( f _ { \theta _ { 1 } ^ { + } } ^ { \mathrm { p r i } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , y _ { \mathrm { m e t a } } ^ { ( i ) } ) ~ .
75
+ $$
76
+
77
+ Here $\theta _ { 1 } ^ { + }$ represents the weights of the multi-task network were it to be trained, with one gradient update, using auxiliary labels $y _ { \mathrm { { m e t a } } }$ :
78
+
79
+ $$
80
+ \begin{array} { r } { \theta _ { 1 } ^ { + } = \theta _ { 1 } - \alpha \nabla _ { \theta _ { 1 } } \left( \mathcal { L } \big ( f _ { \theta _ { 1 } } ^ { \mathrm { p r i } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , y _ { \mathrm { m e t a } } ^ { ( i ) } \big ) + \mathcal { L } \big ( f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , g _ { \theta _ { 2 } } ^ { \mathrm { g e n } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } , \psi ) \Big ) \right) , } \end{array}
81
+ $$
82
+
83
+ where $\alpha$ is the learning rate.
84
+
85
+ The trick in this meta objective is that we perform the derivative over a derivative (a Hessian matrix) to update $\theta _ { 2 }$ , by using a retained computational graph of $\theta _ { 1 } ^ { + }$ in order to compute derivatives with respect to $\theta _ { 2 }$ . This second derivative trick in meta learning was also proposed in Finn et al. (2017) and Zhang et al. (2018).
86
+
87
+ However, we found that the generated auxiliary labels can easily collapse (i.e. degenerate by simply learning a similar level of complexity as the principal task), which leaves parameters $\theta _ { 2 }$ in a local minimum without producing any extra useful knowledge. Thus, to encourage the network to learn more complex and informative auxiliary tasks, we further apply an entropy loss $\mathcal { H } ( g _ { \theta _ { 2 } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } , \psi ) )$ as a regularisation term in the meta objective. A detailed explanation of the entropy loss and the collapsing label problem will be given in Section 3.4.
88
+
89
+ Finally, the entire MAXL algorithm is defined as follows:
90
+
91
+ # Algorithm 1: The MAXL algorithm
92
+
93
+ Dataset: $D = \left\{ ( x _ { \mathrm { t r a i n } } , y _ { \mathrm { t r a i n } } ) , ( x _ { \mathrm { m e t a } } , y _ { \mathrm { m e t a } } ) \right\}$
94
+ Initialise: Network parameters: $\theta _ { 1 } , \theta _ { 2 }$ ; Hierarchical structure: $\psi$
95
+ Initialise: Hyper-parameter (learning rate): $\alpha , \beta$ ; Hyper-parameter (task weighting): $\lambda$
96
+ for each training iteration $i$ do $\left\{ \left( x _ { \mathrm { t r a i n } } ^ { ( i ) } , y _ { \mathrm { t r a i n } } ^ { ( i ) } \right) , \big ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } \big ) \right\} \in \left\{ \left( x _ { \mathrm { t r a i n } } , y _ { \mathrm { t r a i n } } \right) , \big ( x _ { \mathrm { m e t a } } , y _ { \mathrm { m e t a } } \big ) \right\}$ $\begin{array} { r } { \theta _ { 1 } \theta _ { 1 } - \alpha \nabla _ { \theta _ { 1 } } ( \mathcal { L } \big ( f _ { \theta _ { 1 } } ^ { \mathrm { p i } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } ) , y _ { \mathrm { t r a i n } } ^ { ( i ) } \big ) + \mathcal { L } \big ( f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } ) , g _ { \theta _ { 2 } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } , y _ { \mathrm { t r a i n } } ^ { ( i ) } , \psi ) \Big ) } \end{array}$ # meta-training step Update: Compute $\begin{array} { r l } & { \theta _ { 1 } ^ { + } = \theta _ { 1 } ^ { ' } - \alpha \nabla _ { \theta _ { 1 } } ( \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { p i } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , y _ { \mathrm { m e t a } } ^ { ( i ) } ) + \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , g _ { \theta _ { 2 } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } , \psi ) ) } \\ & { \mathfrak { i } _ { 2 } \theta _ { 2 } - \beta \nabla _ { \theta _ { 2 } } ( \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { p i } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , y _ { \mathrm { m e t a } } ^ { ( i ) } ) + \lambda \mathcal { H } ( g _ { \theta _ { 2 } } ^ { \mathrm { g e n } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } , \psi ) ) ) } \end{array}$
97
+ end
98
+
99
+ # 3.3 MASK SOFTMAX FOR HIERARCHICAL PREDICTIONS
100
+
101
+ In the prediction layer of the meta generator, we designed a modified SoftMax function to predict target auxiliary labels which conform to a pre-defined hierarchy $\psi$ . As shown in Figure 2 (upper right), the original softmax function does not constrain sub-class labelling to lie within this hierarchy. Our mask SoftMax structure resolves this issue by applying a binary mask to the original SoftMax function.
102
+
103
+ The overall hierarchical structure $\psi$ determines the number of sub-classes $\psi [ i ]$ in each principal class $i$ . As such, the total prediction space for auxiliary labels is $\textstyle \sum _ { i } \psi [ i ]$ . This hierarchy, together with the ground-truth principal class label $y$ of the current image, creates the mask with a binarise function $\bar { \boldsymbol { M } } = \boldsymbol { B } ( \boldsymbol { y } , \bar { \boldsymbol { \psi } } )$ . Using the principal ground-truth label $y$ , the corresponding range of sub-classes $\psi [ y ]$ is selected, and a binary mask $M$ is created with size $\textstyle \sum _ { i } \psi [ i ]$ with a multi one-hot encoding $\begin{array} { r } { \mathbb { 1 } \sum _ { i < y } \psi [ i ] \colon \sum _ { i < y + 1 } \psi [ i ] } \end{array}$ $\scriptstyle \mathbf { 1 } _ { a : b }$ is denoted as a multi one-hot encoding in which indexes from $a$ to $b$ are encoded as 1).
104
+
105
+ Using the example in Figure 2, consider the principal task to have 3 classes with ground truth labels $y = 0 , 1 , 2$ , and hierarchical structure $\psi \stackrel { - } { = } [ 2 , \stackrel { - } { 2 } , 1 ]$ . In this case, the auxiliary prediction space is equal to 5 and the corresponding binary masks are $M = [ 1 , 1 , 0 , 0 , 0 ] , [ 0 , 0 , 1 , 1 , 0 ] , [ 0 , 0 , 0 , 0 , 1 ]$ respectively.
106
+
107
+ Finally, we apply binary mask $M$ with an element-wise multiplication on the original SoftMax function for the final auxiliary task predictions:
108
+
109
+ $$
110
+ p ( \hat { y } _ { i } ) = \frac { \exp \hat { y } _ { i } } { \sum _ { i } \exp \hat { y } _ { i } } , \qquad \mathrm { M a s k ~ S o f t M a x : } \quad p ( \hat { y } _ { i } ) = \frac { \exp M \odot \hat { y } _ { i } } { \sum _ { i } \exp M \odot \hat { y } _ { i } } , \quad M = \mathcal { B } ( y , \psi ) ,
111
+ $$
112
+
113
+ where $p ( \hat { y } _ { i } )$ represents the probability of the predicted principal label $\hat { y }$ over class $i$ , and $\odot$ represents element-wise multiplication.
114
+
115
+ # 3.4 THE COLLAPSING CLASS PROBLEM
116
+
117
+ As previously discussed, we predict each auxiliary label within a hierarchical structure $\psi$ . However, the number of sub-classes defined in $\psi [ i ]$ is the maximum auxiliary label prediction space, with no guarantee that all $\psi [ i ]$ classes will be predicted. This may result in some auxiliary labels defined in $\psi [ i ]$ being overlooked, with the output of the meta generator collapsing into a smaller sub-class space. In experiments, we found that this phenomenon is particularly apparent when we either have a large learning rate for training the meta generator, or a large sub-class prediction space $\psi$ .
118
+
119
+ To avoid the collapsing class problem, we introduced an additional regularisation loss, which we call the entropy loss $\mathcal { H } ( \hat { y } ^ { ( i ) } )$ . This encourages the meta generator to utilise the full prediction space, by encouraging a large prediction entropy across this space.
120
+
121
+ Assuming we have a well-balanced dataset, the entropy loss calculates the KL divergence between the predicted auxiliary label space $\hat { y } ^ { ( i ) }$ , and a uniform distribution $\mathcal { U }$ for each $i ^ { t h }$ batch. This is equivalent to calculating the entropy of the predicted label space, and is defined as:
122
+
123
+ $$
124
+ \mathcal { H } ( \hat { y } ^ { ( i ) } ) = \sum _ { k = 1 } ^ { K } \overline { { y _ { k } } } \log \overline { { y _ { k } } } , \quad \overline { { y _ { k } } } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \hat { y } ^ { ( i ) } .
125
+ $$
126
+
127
+ where $K$ is the number of auxiliary labels and $N$ is the training batch size.
128
+
129
+ The entropy loss is essential to achieve human-level performance, as shown in our experiments. The higher entropy in the auxiliary target labels results in a more complex auxiliary task. This avoids local minima during training, such as assigning a single label to all examples of a principal class.
130
+
131
+ # 4 EXPERIMENTS
132
+
133
+ In this section, we present experimental results to evaluate MAXL with respect to several baselines and datasets on image classification tasks.
134
+
135
+ # 4.1 EXPERIMENTAL SETUP
136
+
137
+ Datasets We evaluated on three different datasets: CIFAR100, CIFAR10, and CIFAR10.1v6 (Recht et al., 2018). CIFAR100 consists of 100 principal classes, whilst CIFAR10 and CIFAR10.1v6 consist of 10 principal classes and have the same training dataset as each other, but two different test datasets. To assess the generalisation across different task complexities, we tested a range of different combinations in the numbers of principal and auxiliary classes. For CIFAR100, we expanded the dataset’s provided 2-level hierarchy (20 and 100 classes) into a 4-level hierarchy (additional 3 and 10 classes), by manually assigning examples for these new hierarchy levels (see Appendix A). Based on the new hierarchy, we then tested on all 6 possible combinations of principal and auxiliary class numbers. Note that for MAXL, the hierarchy was used only to define the structure of $\psi$ and the principal task labels, to ensure a fair comparison with a method using human-defined auxiliary tasks, but the auxiliary task labelling within that structure was learned by MAXL itself. CIFAR10 and CIFAR10.1v6 do not have an associated manually-defined hierarchy, and so we defined a range of hierarchical structures $\psi [ i ] = 2 , 5 , 1 0 , 2 0 , 5 0 , 1 0 0 , \forall i$ .
138
+
139
+ Baselines We compared MAXL to a number of baselines. Single Task trains only with the principal class label. Random Assignment trains with auxiliary classes, and randomly assigns the auxiliary class labels. Prototypical Net is a clustering method based on (Snell et al., 2017), where prototypes for auxiliary classes are defined by embedding examples from meta-training data, which has human-defined auxiliary classes, using a pre-trained ImageNet network. Unsupervised, differentiable, nearest-neighbour clustering is then used to produce the final auxiliary class labelling for the remaining training data. The key difference to MAXL is that, whilst both methods are unsupervised, the auxiliary class labelling with MAXL actually evaluates the generalisation performance of this labelling on the principal task, whilst the Prototypical Net method does not. Finally, Human trains with auxiliary classes, using the human-defined hierarchy. Note that due to the need for a manually-defined hierarchy, Prototypical Net and Human were only evaluated on CIFAR100. For all baselines, we use the same network architecture and training procedure as MAXL’s multi-task evaluator. For the meta-training for MAXL and Prototypical Net, we split each training dataset and used $10 \%$ for meta-training the auxiliary labelling, and $90 \%$ for training the multi-task evaluator. For all other baselines, we used the full training set for training the multi-task evaluator.
140
+
141
+ Training For both the multi-task evaluator and the meta generator use VGG-16 as its core (Simonyan & Zisserman, 2014), together with batch normalisation. For all experiments, we used a learning rate of 0.01 for the multi-task evaluator. For MAXL’s meta generator, we found that a smaller learning rate of $1 0 ^ { - 5 }$ was necessary to help prevent the class collapsing problem. For all training, we drop the learning rate by half after every 50 epochs, and train for a total of 200 epochs, using vanilla stochastic gradient descent. For the meta generator, we apply an $L _ { 1 }$ norm weight decay of $5 \cdot 1 0 ^ { - 4 }$ on the meta generator, with no regularisation on the multi-task evaluator. We chose the weighting of the entropy regularisation loss term to be 0.2 based on empirical performance.
142
+
143
+ # 4.2 TEST PERFORMANCE
144
+
145
+ We now evaluate the performance of MAXL compared to these baselines, on all three datasets. Results for CIFAR100 are presented in Figure 3, and results for CIFAR10 and CIFAR10.1v6 are presented in Appendix B.
146
+
147
+ ![](images/ba3262f7dc28e5b4ee5046e70d3d7172a3449a226d32b38995b81556ee528b59.jpg)
148
+ Figure 3: Learning curves for the CIFAR100 test dataset, comparing MAXL with baseline methods. We provide results in all 6 different combinations of principal and auxiliary class numbers.
149
+
150
+ For CIFAR100, we observe that MAXL performs similarly to when human knowledge is used in 4 out of the 6 hierarchical structures, and performs worse in 2 out of the 6. For all other baselines, MAXL performs at least as well, and in the majority of cases outperforms other baselines by a significant margin. We therefore see that MAXL is able to learn auxiliary tasks effectively by tightly coupling the auxiliary task generation and the principal task training, in a superior manner than when these auxiliary tasks are assigned independently, such as with random assignment or using prototypical net. With performance of MAXL approaching that of a system using a human-defined auxiliary tasks, we see strong evidence that MAXL is able to learn to generalise effectively in an unsupervised manner.
151
+
152
+ # 4.3 EFFECT OF AUXILIARY TASK COMPLEXITY
153
+
154
+ We now evaluate how the complexity of the auxiliary tasks affects the performance of the principal task. In Figure 4 (a), we present results from CIFAR10 and CIFAR10v1.6 showing the performance increase over single-task learning, when there are 10 principal classes, but a range of auxiliary class numbers $( \psi [ i ] \stackrel { } { = } 2 , 5 , 1 0 , 2 0 , 5 \bar { 0 } , 1 0 0 , \forall i )$ . For each data point, the performance is calculated by averaging the test accuracy from the last 5 epochs, after a total of 200 epochs. Experiments were performed both with and without the entropy loss term to show the benefit of this regularisation.
155
+
156
+ We observe an interesting trend in which test performance rises as the number of auxiliary classes increases, but then begins to fall. This suggests that for a given complexity of principal task, there is an optimum complexity in the auxiliary tasks. One explanation for this may be that as the auxiliary tasks increase in complexity, the learned features favour learning these auxiliary tasks rather than the principal task, encouraging further generalisation beyond the features learned only for the principal task. But if the auxiliary task is too complex, then these features begin to overfit and lose the overlap between the reasoning required for the principal and auxiliary tasks, begins to decrease.
157
+
158
+ ![](images/6bc3b5c36a2651f5b22fd1f302e32729193f45fadac730c3aea84650018312cd.jpg)
159
+ Figure 4: Performance improvement in percentages when training with MAXL compared with single-task learning, with 10 principal classes and a range of auxiliary classes.
160
+
161
+ # 4.4 VISUALISATIONS OF GENERATED KNOWLEDGE
162
+
163
+ In Figure 5, we visualise 2D embeddings of examples from the CIFAR100 test dataset, on two different task complexities. This was computed using t-SNE (Maaten & Hinton, 2008) on the final feature layer of the multi-task evaluator, and compared across three methods: our MAXL method, our baseline using human-defined hierarchy, and our baseline using single-task learning.
164
+
165
+ ![](images/46a8f308f35fa53f6ad6b14f92ada0dc6d31c499ebea64196dceb57ec646934e.jpg)
166
+ Figure 5: t-SNE visualisation of the learned final layer of the multi-task evaluator network, trained with two combinations of principal and auxiliary class numbers from CIFAR100. Colours represent the principal classes.
167
+
168
+ This visualisation shows the separability of principal classes after being trained with the multi-task evaluator. We see that both MAXL and Human show better separation of the principal classes than with Single-Task, owing to the generalisation effect of the auxiliary task learning. The distinction between the separability of the MAXL and Human visualisations is not as clear, despite their very similar performance for these two task complexities in Figure 3. But given that MAXL uses the same hierarchical structure as Human, we see from the visualisation that these two methods are clearly learning different representations.
169
+
170
+ We also show examples of images assigned to the same auxiliary class through MAXL’s multi-task evaluator. Figure 6 shows example images with the highest prediction probabilities for three random auxiliary classes from CIFAR100, using the combination of 20 principal classes and 5 auxiliary classes per principal class, which showed the best performance of MAXL in Figure 3. In addition, we also applied MAXL to MNIST, in which 3 auxiliary classes were used for each of the 10 principal classes.
171
+
172
+ ![](images/0b1148d6aa97dee0e59d1c7049362ee17c4d34a79f73ca4fd59a1950a15f582f.jpg)
173
+ Figure 6: Visualisation of 5 test examples with the highest prediction probability, for each of 3 randomly selected auxiliary classes, for a number of different principal classes. We present the visualisation for CIFAR100 (top) when trained with 20 principal classes and 5 auxiliary classes per principal class, and for MNIST (bottom) when trained with 10 principal classes and 3 auxiliary classes per principal class.
174
+
175
+ To our initial surprise, the generated auxiliary labels visualised in both datasets show no clear human-understandable knowledge. In particular, there are no obvious similarities within each auxiliary class whether in terms of shape, colour, style, structure or semantic meaning. However, this makes more sense when we re-consider the task of the meta generator, which is to assign auxiliary labels which assist the principal task. Rather than grouping images in terms of semantic or visual similarity, the meta generator would therefore be more effective it it were to group images in terms of a shared aspect of reasoning which the multi-task evaluator is currently facing difficulty on. If the multi-task evaluator is then able to improve its ability to determine the auxiliary class of an image in such a cluster, then the learned features will help in overcoming this challenging aspect of reasoning. It therefore makes sense that the examples within an auxiliary class do not share semantic or visual similarity, but instead share a more complex underlying property.
176
+
177
+ Further, we discovered that the generated auxiliary knowledge is not deterministic, since the top predicted candidates are different when we re-train the network from scratch. We therefore speculate that using a human-defined hierarchy is just one out of a potentially infinite number of local optima, and on each run of training the meta generator produces another of these local optimums.
178
+
179
+ # 5 CONCLUSION & FUTURE WORK
180
+
181
+ In this paper, we have presented and evaluated Meta AuXiliary Learning (MAXL). MAXL learns to generate optimum auxiliary tasks which, when trained alongside a principal task in a multi-task setup, maximise the generalisation of the principal task across a validation dataset. Rather than employing domain knowledge and human-defined auxiliary tasks as is typically required, MAXL is self-supervised and, combined with its general nature, has the potential to automate the process of generalisation to new levels.
182
+
183
+ Our evaluations on three image datasets have shown the performance of MAXL in an image classification setup, where the auxiliary task is to predict sub-class, hierarchical labels for an image. We have shown that MAXL significantly outperforms other auxiliary learning baselines, and even when human-defined knowledge is used to manually construct the auxiliary tasks, MAXL performs similarly in the majority of experiments.
184
+
185
+ Despite this impressive performance from a self-supervised method, questioning why auxiliary tasks generated by MAXL do not outperform those constructed by a human opens exciting future research in this direction. Perhaps, human-defined auxiliary tasks are optimal themselves and cannot be surpassed. However, we believe this not to be the case since such tasks are typically chosen due to the availability of labelled data for these tasks, and not necessarily their optimality when combined with the principal task. Alternatively, perhaps the power of the human knowledge is not from the domain specific labels, but from higher-level reasoning about how auxiliary tasks should be structured. In our experiments, training MAXL using the same structure as a human-defined hierarchy, but learning its own auxiliary labels, typically led to similar performance as when the human-defined labels were used.
186
+
187
+ The general nature of MAXL also opens up questions about how self-supervised auxiliary learning may be used to learn generic auxiliary tasks beyond sub-class labelling. During our experiments, we also ran preliminary experiments on predicting arbitrary vectors as the auxiliary task, but results so far have been inconclusive. However, the ability of MAXL to potentially learn flexible auxiliary tasks which can automatically be tuned for the principal task now offers an exciting direction towards automated generalisation across a wide range of more complex tasks.
188
+
189
+ # REFERENCES
190
+
191
+ Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, Brendan Shillingford, and Nando De Freitas. Learning to learn by gradient descent by gradient descent. In Advances in Neural Information Processing Systems, pp. 3981–3989, 2016.
192
+ Samy Bengio, Yoshua Bengio, Jocelyn Cloutier, and Jan Gecsei. On the optimization of a synaptic learning rule. In Preprints Conf. Optimality in Artificial and Biological Neural Networks, pp. 6–8. Univ. of Texas, 1992.
193
+ Yoshua Bengio, Samy Bengio, and Jocelyn Cloutier. Learning a synaptic learning rule. Universite´ de Montreal, D ´ epartement d’informatique et de recherche op ´ erationnelle, 1990. ´
194
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. Ieee, 2009.
195
+ Carl Doersch and Andrew Zisserman. Multi-task self-supervised visual learning. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017.
196
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pp. 1126–1135, 2017.
197
+ John Flynn, Ivan Neulander, James Philbin, and Noah Snavely. Deepstereo: Learning to predict new views from the world’s imagery. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5515–5524, 2016.
198
+ Max Jaderberg, Wojciech Marian Czarnecki, Simon Osindero, Oriol Vinyals, Alex Graves, David Silver, and Koray Kavukcuoglu. Decoupled neural interfaces using synthetic gradients. arXiv preprint arXiv:1608.05343, 2016.
199
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. International Conference on Learning Representations, 2017.
200
+ Iasonas Kokkinos. Ubernet: Training a universal convolutional neural network for low-, mid-, and high-level vision using diverse datasets and limited memory. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
201
+ Zhenguo Li, Fengwei Zhou, Fei Chen, and Hang Li. Meta-sgd: Learning to learn quickly for few shot learning. arXiv preprint arXiv:1707.09835, 2017.
202
+ Lukas Liebel and Marco Korner. Auxiliary tasks in multi-task learning. ¨ arXiv preprint arXiv:1805.06334, 2018.
203
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. arXiv preprint arXiv:1708.02002, 2017.
204
+ Shikun Liu, Edward Johns, and Andrew J Davison. End-to-end multi-task learning with attention. arXiv preprint arXiv:1803.10704, 2018.
205
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
206
+ Ishan Misra, Abhinav Shrivastava, Abhinav Gupta, and Martial Hebert. Cross-stitch networks for multi-task learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3994–4003, 2016.
207
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. 2016.
208
+ Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do cifar-10 classifiers generalize to cifar-10? arXiv preprint arXiv:1806.00451, 2018.
209
+ Sebastian Ruder. An overview of multi-task learning in deep neural networks. arXiv preprint arXiv:1706.05098, 2017.
210
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Oneshot learning with memory-augmented neural networks. arXiv preprint arXiv:1605.06065, 2016.
211
+ Jurgen Schmidhuber. Learning complex, extended sequences using the principle of history com- ¨ pression. Neural Computation, 4(2):234–242, 1992.
212
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
213
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, pp. 4077–4087, 2017.
214
+ Shubham Toshniwal, Hao Tang, Liang Lu, and Karen Livescu. Multitask learning with low-level auxiliary tasks for encoder-decoder based speech recognition. arXiv preprint arXiv:1704.01631, 2017.
215
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pp. 3630–3638, 2016.
216
+ Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014.
217
+ Yabin Zhang, Hui Tang, and Kui Jia. Fine-grained visual categorization using meta-learning optimization with sample selection of auxiliary data. arXiv preprint arXiv:1807.10916, 2018.
218
+ Tinghui Zhou, Matthew Brown, Noah Snavely, and David G Lowe. Unsupervised learning of depth and ego-motion from video. In CVPR, 2017.
219
+
220
+ # A 4-LEVEL CIFAR100 DATASET
221
+
222
+ Table 1: Building a 4-level hierarchy for image classification task based on CIFAR100 dataset. Originally, a 20-class and 100-class heirarchiy was provided, and we manually introduced a 3-class and 10 class layer.
223
+
224
+ <table><tr><td>3 Class</td><td>10 Class</td><td>20 Class</td><td>100 Class</td></tr><tr><td rowspan="10">animals</td><td rowspan="2">large animals</td><td>reptiles</td><td>crocodile,dinosaur,lizard,snake,turtle</td></tr><tr><td>large carnivores</td><td>bear,leopard, lion, tiger, wolf</td></tr><tr><td rowspan="2"></td><td></td><td>large omnivores and herbivores camel,catle,chimpanzee,elephant,kangaroo</td></tr><tr><td>aquatic mammals</td><td>beaver,dolphin,otter,seal, whale</td></tr><tr><td rowspan="2"></td><td>medium-sized mammals</td><td>fox,porcupine,possum, raccoon, skunk</td></tr><tr><td>small mammals</td><td>hamster,mouse,rabbit, shrew,squirrel</td></tr><tr><td rowspan="2"></td><td>fish</td><td>aquarium fish,flatfish,ray,shark,trout</td></tr><tr><td>insects</td><td>bee, beetle, butterfly,caterpillar,cockroach</td></tr><tr><td rowspan="2">people</td><td>non-insect invertebrates</td><td>crab,lobster,snail, spider, worm</td></tr><tr><td>people</td><td>baby,boy,girl,man,woman</td></tr><tr><td rowspan="3">vegetations</td><td rowspan="3">vegetations</td><td>flowers</td><td>orchids, poppies,roses,sunflowers,tulips</td></tr><tr><td>fruit and vegetables</td><td>apples,mushrooms,oranges, pears, peppers</td></tr><tr><td>trees</td><td>maple,oak,palm, pine,willow</td></tr><tr><td rowspan="7">objects and scenes construction</td><td rowspan="3"></td><td>food containers</td><td>bottles,bowls,cans,cups,plates</td></tr><tr><td>household objects household electrical devices</td><td>clock,keyboard,lamp,telephone,television</td></tr><tr><td>household furniture</td><td>bed,chair,couch,table,wardrobe</td></tr><tr><td></td><td>large man-made outdoor things</td><td>sbridge,castle,house,road,skyscraper</td></tr><tr><td>natural scenes</td><td>large natural outdoor scenes</td><td>cloud,forest, mountain, plain, sea</td></tr><tr><td rowspan="2">vehicles</td><td>vehicles 1</td><td>bicycle, bus, motorcycle,pickup truck, train</td></tr><tr><td>vehicles 2</td><td>lawn-mower, rocket, streetcar, tank, tractor</td></tr></table>
225
+
226
+ # B LEARNING CURVES FOR CIFAR10/10.1V6
227
+
228
+ ![](images/5683941fcf7c15570684d5af976f175c72cd2f1ac4fcb778a27b828a724a25e3.jpg)
229
+ Figure 7: Testing performance on CIFAR10 (bottom) and CIFAR10.1v6 (top) datasets, across 6 different numbers of auxiliary classes.
parse/train/S1gd7nCcF7/S1gd7nCcF7_content_list.json ADDED
@@ -0,0 +1,1100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "SELF-SUPERVISED GENERALISATION WITH META AUXILIARY LEARNING ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 174,
8
+ 99,
9
+ 694,
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
+ 171,
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": "Auxiliary learning has been shown to improve the generalisation performance of a principal task. But typically, this requires manually-defined auxiliary tasks based on domain knowledge. In this paper, we consider that it may be possible to automatically learn these auxiliary tasks to best suit the principal task, towards optimum auxiliary tasks without any human knowledge. We propose a novel method, Meta Auxiliary Learning (MAXL), which we design for the task of image classification, where the auxiliary task is hierarchical sub-class image classification. The role of the meta learner is to determine sub-class target labels to train a multi-task evaluator, such that these labels improve the generalisation performance on the principal task. Experiments on three different CIFAR datasets show that MAXL outperforms baseline auxiliary learning methods, and is competitive even with a method which uses human-defined sub-class hierarchies. MAXL is self-supervised and general, and therefore offers a promising new direction towards automated generalisation. ",
40
+ "bbox": [
41
+ 233,
42
+ 262,
43
+ 764,
44
+ 454
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 176,
54
+ 478,
55
+ 336,
56
+ 493
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Auxiliary learning is a method to improve the generalisation of a task. It works by training on additional auxiliary tasks simultaneously with the principal task. Extra data may be available for those auxiliary tasks, but not the principal task. If the auxiliary tasks and the principal task share some common reasoning, then the prediction model is encouraged to learn additional relevant features which otherwise would not be learned from single-task learning. The broader support of these features then assists with generalisation of the principal task. ",
63
+ "bbox": [
64
+ 174,
65
+ 510,
66
+ 823,
67
+ 593
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "We now rethink this generalisation by considering that not all auxiliary tasks are created equal. In supervised auxiliary learning (Liebel & Korner, 2018; Toshniwal et al., 2017), auxiliary tasks can be ¨ carefully chosen to complement the principal task, but at the expense of a dependency on labelled data. Unsupervised auxiliary learning (Flynn et al., 2016; Zhou et al., 2017; Zhang et al., 2018; Jaderberg et al., 2017) alleviates this, but at the expense of a limited set of auxiliary tasks which may not be well aligned with the principal task. By combining the merits of both supervised and unsupervised auxiliary learning, the ideal auxiliary learning framework is one with the flexibility to automatically determine the optimum auxiliary tasks, but without the requirement of any manuallylabelled data. ",
74
+ "bbox": [
75
+ 174,
76
+ 602,
77
+ 825,
78
+ 727
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "In this paper, we propose to achieve such a framework with a simple and general meta-learning algorithm which we call Meta AuXiliary Learning (MAXL). Given a principal task, the goal of MAXL is to discover the auxiliary tasks which, when trained alongside the principal task, give the greatest generalisation performance of the principal task on a meta dataset. In our work, we focus on the problem of image classification, where an auxiliary task is required to assign a sub-class label to an image. As such, data is classified both at a coarse level as the principal task, and at a fine level as the auxiliary task. The meta learner’s role is then to determine the target labels for this sub-class labelling, in such a way that the learned features induced by learning these additional, more complex auxiliary tasks generate the best generalisation performance for the principal task. ",
85
+ "bbox": [
86
+ 174,
87
+ 734,
88
+ 825,
89
+ 859
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "As well as our method being able to automatically learn the optimum auxiliary tasks, we achieve this in an unsupervised manner, giving potential to scale well beyond any datasets without manuallylabelled auxiliary tasks, such as a class hierarchy as in our experiments. And even when such a hierarchy is available, in our experiments we show that MAXL is at least as competitive despite this hierarchy being learned in an unsupervised manner. In our experiments, we define the auxiliary tasks as sub-class labelling with MAXL learning to generate target sub-class labels, but MAXL is general and in future work this could be relaxed to actually learn the auxiliary tasks themselves. The ability to learn these tasks in a purely unsupervised and scalable manner opens up an exciting new way of thinking about how we can achieve generalisation in an automated manner. ",
96
+ "bbox": [
97
+ 174,
98
+ 868,
99
+ 823,
100
+ 922
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "",
107
+ "bbox": [
108
+ 173,
109
+ 103,
110
+ 825,
111
+ 174
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "image",
117
+ "img_path": "images/9be7e47f76a69d61e122286e9e1ded5295110c346ed9a4f5ad2eac73b4c4eaa3.jpg",
118
+ "image_caption": [
119
+ "Figure 1: Illustration of our proposed MAXL framework. The Multi-task evaluator takes an input image and is trained to predict both the principal class (e.g. Dog), and the auxiliary class (e.g. Border Collie). The principal class has a ground-truth label, but the label for the auxiliary class is determined by the meta generator. The meta generator is trained by outputting auxiliary class labels which, when used to train the multi-task evaluator, improve its prediction performance on the principal task. "
120
+ ],
121
+ "image_footnote": [],
122
+ "bbox": [
123
+ 176,
124
+ 185,
125
+ 821,
126
+ 383
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "2 RELATED WORK ",
133
+ "text_level": 1,
134
+ "bbox": [
135
+ 176,
136
+ 510,
137
+ 344,
138
+ 526
139
+ ],
140
+ "page_idx": 1
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "This work brings ideas together from a number of related areas of machine learning. ",
145
+ "bbox": [
146
+ 176,
147
+ 542,
148
+ 723,
149
+ 558
150
+ ],
151
+ "page_idx": 1
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": "Multi-task & Transfer Learning The aim of multi-task learning (MTL) is to achieve shared representations by simultaneously training a set of related learning tasks. In this case, the learned knowledge used to share across domains is encoded into the feature representations, to improve performance of each individual task, since knowledge distilled from related tasks are interdependent. The success of deep neural networks has led to some recent methods advancing the multi-task architecture design, such as applying a linear combination of task-specific features (Misra et al., 2016; Doersch & Zisserman, 2017; Kokkinos, 2017). Liu et al. (2018) applied soft-attention modules as feature selectors, allowing learning of both task-shared and task-specific features in a selfsupervised, end-to-end manner. Transfer learning is another common approach to improve generalisation, by incorporating knowledge learned from one or more related domains. Pre-training a model with a large-scale dataset such as ImageNet (Deng et al., 2009) has become standard practise in many vision-based applications. The transferability of different convolutional layers in CNNs has also been investigated in Yosinski et al. (2014). ",
156
+ "bbox": [
157
+ 174,
158
+ 574,
159
+ 825,
160
+ 753
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "Auxiliary Learning Whilst in multi-task learning the goal is high test accuracy across all tasks, auxiliary learning differs in that high test accuracy is only required for a single principal task, and the role of the auxiliary tasks is to assist in generalisation of this principal task. Toshniwal et al. (2017) applied auxiliary supervision with phoneme recognition at intermediate low-level representations of deep networks to improve the performance of conversational speech recognition. Liebel & Korner ¨ (2018) chose auxiliary tasks which can be obtained with low effort, such as global descriptions of a scene, to boost the performance for single scene depth estimation and semantic segmentation. By carefully choosing a pair of learning tasks, we may also perform auxiliary learning without ground truth labels, in an unsupervised manner. Jaderberg et al. (2017) introduced a method for improving the learning agents in Atari games, by building unsupervised auxiliary tasks to predict the onset of immediate rewards from a short historical context. Flynn et al. (2016); Zhou et al. (2017) proposed image synthesis networks to perform unsupervised monocular depth estimation by predicting the relative pose of multiple cameras. Different from these works which require prior knowledge to manually define suitable auxiliary tasks, our proposed method requires no additional task knowledge, since our meta learner generates useful auxiliary knowledge in a purely unsupervised fashion. The most similar work to ours is Zhang et al. (2018), in which meta learning was used in auxiliary data selection. However, this still requires manually-labelled data from which these selections are made, whilst our method is able to generate auxiliary data from scratch. ",
167
+ "bbox": [
168
+ 174,
169
+ 770,
170
+ 825,
171
+ 924
172
+ ],
173
+ "page_idx": 1
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "",
178
+ "bbox": [
179
+ 174,
180
+ 103,
181
+ 825,
182
+ 202
183
+ ],
184
+ "page_idx": 2
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "Meta Learning Meta learning (or learning to learn) aims to design a higher-level learning system which itself is trained using the experiences of a lower-level learning system, in an attempt to improve this lower-level system. Early works in meta learning explored automatically learning update rules for neural models (Bengio et al., 1990; 1992; Schmidhuber, 1992). Recent approaches have focused on learning optimisers for deep networks based on LSTMs (Ravi & Larochelle, 2016) or synthetic gradients (Andrychowicz et al., 2016; Jaderberg et al., 2016). Meta learning has also been studied for finding optimal hyper-parameters (Li et al., 2017) and a good initialisation for few-shot learning (Finn et al., 2017). (Santoro et al., 2016) also investigated few shot learning via an external memory module. Vinyals et al. (2016); Snell et al. (2017) realised few shot learning in the instance space via a differentiable nearest-neighbour approach. Our method also performs in the instance space, but induces auxiliary knowledge as an implicit regularisation to improve generalisation of the principal task. ",
189
+ "bbox": [
190
+ 174,
191
+ 220,
192
+ 825,
193
+ 388
194
+ ],
195
+ "page_idx": 2
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "3 META AUXILIARY LEARNING ",
200
+ "text_level": 1,
201
+ "bbox": [
202
+ 176,
203
+ 414,
204
+ 450,
205
+ 430
206
+ ],
207
+ "page_idx": 2
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "In this section, we introduce our method for automatically generating optimum auxiliary tasks, which we call Meta AuXiliary Learning (MAXL). ",
212
+ "bbox": [
213
+ 174,
214
+ 449,
215
+ 823,
216
+ 478
217
+ ],
218
+ "page_idx": 2
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "3.1 PROBLEM SETUP ",
223
+ "text_level": 1,
224
+ "bbox": [
225
+ 176,
226
+ 500,
227
+ 333,
228
+ 513
229
+ ],
230
+ "page_idx": 2
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "The goal of meta auxiliary learning is to train a meta generator that can generate higher complexity auxiliary tasks, to improve performance of the principal task. To accomplish this, we use two networks: a multi-task evaluator which trains on the principal and auxiliary tasks, and evaluates the performance of the auxiliary tasks on a meta set, and a meta generator which generates these auxiliary tasks. For simplicity, we consider image classification tasks in this section, where the auxiliary task is sub-class labelling, and the meta generator determines target sub-class labels, but the approach can be considered general for any type of task. ",
235
+ "bbox": [
236
+ 174,
237
+ 529,
238
+ 825,
239
+ 626
240
+ ],
241
+ "page_idx": 2
242
+ },
243
+ {
244
+ "type": "text",
245
+ "text": "We denote the multi-task evaluator as a function $f _ { \\theta _ { 1 } } ( x )$ that takes an input $x$ with network parameters $\\theta _ { 1 }$ , and the meta generator as a function $g _ { \\theta _ { 2 } } ( x )$ that takes the same input $x$ with network parameters $\\theta _ { 2 }$ . For a dataset with input $x$ and ground-truth label $y$ for the principal task, we split into three subsets: training $( x _ { \\mathrm { t r a i n } } , y _ { \\mathrm { t r a i n } } )$ , meta-training $( x _ { \\mathrm { m e t a } } , y _ { \\mathrm { m e t a } } )$ , and test $( x _ { \\mathrm { t e s t } } , y _ { \\mathrm { t e s t } } )$ . Training data is used for updating $\\theta _ { 1 }$ , meta-training data is used for updating the $\\theta _ { 2 }$ , and test data is used for overall evaluation. ",
246
+ "bbox": [
247
+ 174,
248
+ 635,
249
+ 825,
250
+ 718
251
+ ],
252
+ "page_idx": 2
253
+ },
254
+ {
255
+ "type": "text",
256
+ "text": "In the multi-task evaluator, we apply a hard parameter sharing approach (Ruder, 2017) in which we predict the principal and auxiliary tasks using the shared set of features $\\theta _ { 1 }$ in the multi-task network. At the end of the last feature layer $f _ { \\theta _ { 1 } } ( x )$ , we then apply further task-specific layers to output the corresponding prediction for each task. We denote the predicted principal labels by $f _ { \\theta _ { 1 } } ^ { \\mathrm { p r i } } ( x )$ and predicted auxiliary labels by $f _ { \\theta _ { 1 } } ^ { \\mathrm { a u x } } ( x )$ . ",
257
+ "bbox": [
258
+ 174,
259
+ 728,
260
+ 825,
261
+ 805
262
+ ],
263
+ "page_idx": 2
264
+ },
265
+ {
266
+ "type": "text",
267
+ "text": "In the meta generator, we pre-define a hierarchical structure $\\psi$ which determines the number of subclasses for each class in the principal task. At the end of the last feature layer $g _ { \\theta _ { 2 } } ( x )$ , this hierarchy, together with the ground-truth label $y$ for the principal task, are used to generate the target auxiliary labels, denoted by $g _ { \\theta _ { 2 } } ^ { \\mathrm { g e n } } ( x , y , \\psi )$ . We allow for soft assignment labelling rather than enforcing onehot encoding, which enables greater flexibility to learn optimum auxiliary tasks. The meta generator uses a masked SoftMax to ensure that each output node represents a sub-class label for only one class in the principal task, as described further in Section 3.3. The visualisation of the our proposed MAXL approach is shown in Figure 2. ",
268
+ "bbox": [
269
+ 174,
270
+ 811,
271
+ 823,
272
+ 924
273
+ ],
274
+ "page_idx": 2
275
+ },
276
+ {
277
+ "type": "image",
278
+ "img_path": "images/727e86b2ef0470221fae2f43e47889a0ae8a621f009cf89078060a2777ebee3a.jpg",
279
+ "image_caption": [
280
+ "Figure 2: (a) Illustration of the two networks which make up our meta auxiliary learning algorithm. (b) Illustration of vanilla SoftMax and Mask SoftMax with 3 principal classes. Vanilla SoftMax outputs over all 5 auxiliary classes, where as Mask Softmax outputs over a hierarchical structure $\\psi \\overset { = } { = } [ 2 , 2 , 1 ]$ to constrain the prediction space. "
281
+ ],
282
+ "image_footnote": [],
283
+ "bbox": [
284
+ 187,
285
+ 101,
286
+ 812,
287
+ 337
288
+ ],
289
+ "page_idx": 3
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "3.2 MODEL OBJECTIVES ",
294
+ "text_level": 1,
295
+ "bbox": [
296
+ 174,
297
+ 429,
298
+ 359,
299
+ 444
300
+ ],
301
+ "page_idx": 3
302
+ },
303
+ {
304
+ "type": "text",
305
+ "text": "The multi-task evaluator is trained in a tightly-coupled manner with the meta generator: the meta generator determines target labels for the multi-task evaluator, which in turn determines the suitability of those labels. ",
306
+ "bbox": [
307
+ 173,
308
+ 455,
309
+ 825,
310
+ 497
311
+ ],
312
+ "page_idx": 3
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "Given target labels as determined by the meta generator, the multi-task evaluator is trained to predict these labels, alongside the ground-truth labels for the principal task. For both the principal and auxiliary classification tasks, we apply focal loss (Lin et al., 2017) with a focusing parameter $\\gamma = 2$ , defined as: ",
317
+ "bbox": [
318
+ 173,
319
+ 503,
320
+ 825,
321
+ 559
322
+ ],
323
+ "page_idx": 3
324
+ },
325
+ {
326
+ "type": "equation",
327
+ "img_path": "images/0a255aaf8e97891ed8eb4eca1f730fc8d8d6d199ea07301e047bfc92b8c52534.jpg",
328
+ "text": "$$\n\\mathcal { L } ( \\hat { y } , y ) = - y ( 1 - \\hat { y } ) ^ { \\gamma } \\log ( \\hat { y } ) ,\n$$",
329
+ "text_format": "latex",
330
+ "bbox": [
331
+ 397,
332
+ 559,
333
+ 599,
334
+ 577
335
+ ],
336
+ "page_idx": 3
337
+ },
338
+ {
339
+ "type": "text",
340
+ "text": "where $\\hat { y }$ is the predicted label and $y$ is the ground-truth label. The focal loss helps to focus on the incorrectly predicted labels, which we found improved performance during our experimental evaluation compared with the regular cross-entropy log loss. ",
341
+ "bbox": [
342
+ 174,
343
+ 585,
344
+ 825,
345
+ 628
346
+ ],
347
+ "page_idx": 3
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "To update parameters $\\theta _ { 1 }$ in the multi-task evaluator, we define the multi-task objective as follows: ",
352
+ "bbox": [
353
+ 169,
354
+ 635,
355
+ 812,
356
+ 650
357
+ ],
358
+ "page_idx": 3
359
+ },
360
+ {
361
+ "type": "equation",
362
+ "img_path": "images/a46e0024cc6ea7929bc8527aa6c240bd5f300aec526cb9f4e2cb233518a1476a.jpg",
363
+ "text": "$$\n\\underset { \\theta _ { 1 } } { \\arg \\operatorname* { m i n } } \\left( \\mathcal { L } ( f _ { \\theta _ { 1 } } ^ { \\mathrm { p r i } } ( x _ { \\mathrm { t r a i n } } ^ { ( i ) } ) , y _ { \\mathrm { t r a i n } } ^ { ( i ) } ) + \\mathcal { L } ( f _ { \\theta _ { 1 } } ^ { \\mathrm { a u x } } ( x _ { \\mathrm { t r a i n } } ^ { ( i ) } ) , g _ { \\theta _ { 2 } } ^ { \\mathrm { g e n } } ( x _ { \\mathrm { t r a i n } } ^ { ( i ) } , y _ { \\mathrm { t r a i n } } ^ { ( i ) } , \\psi ) ) \\right) \\ ,\n$$",
364
+ "text_format": "latex",
365
+ "bbox": [
366
+ 264,
367
+ 655,
368
+ 728,
369
+ 686
370
+ ],
371
+ "page_idx": 3
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "where $( i )$ represents the $i ^ { t h }$ batch from the training data. ",
376
+ "bbox": [
377
+ 173,
378
+ 702,
379
+ 544,
380
+ 718
381
+ ],
382
+ "page_idx": 3
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "The meta generator is then trained by encouraging target labels for the auxiliary task to be chosen such that, if the multi-task evaluator were to be trained on these labels, the performance on the principal task would be maximised. This requires evaluation on a separate dataset, the meta-training set, to train the meta generator, to ensure that the target auxiliary labels encourage generalisation beyond the data supplied to the multi-task evaluator. ",
387
+ "bbox": [
388
+ 173,
389
+ 723,
390
+ 826,
391
+ 794
392
+ ],
393
+ "page_idx": 3
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "To update parameters $\\theta _ { 2 }$ in the meta generator, we define the meta objective as follows: ",
398
+ "bbox": [
399
+ 173,
400
+ 800,
401
+ 745,
402
+ 815
403
+ ],
404
+ "page_idx": 3
405
+ },
406
+ {
407
+ "type": "equation",
408
+ "img_path": "images/d6ed2aba8bf751fe6ef1017768eaddbd5869ecbc17625fafa91b01de51700de0.jpg",
409
+ "text": "$$\n\\underset { \\theta _ { 2 } } { \\arg \\operatorname* { m i n } } \\mathcal { L } ( f _ { \\theta _ { 1 } ^ { + } } ^ { \\mathrm { p r i } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } ) , y _ { \\mathrm { m e t a } } ^ { ( i ) } ) ~ .\n$$",
410
+ "text_format": "latex",
411
+ "bbox": [
412
+ 398,
413
+ 821,
414
+ 598,
415
+ 851
416
+ ],
417
+ "page_idx": 3
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "Here $\\theta _ { 1 } ^ { + }$ represents the weights of the multi-task network were it to be trained, with one gradient update, using auxiliary labels $y _ { \\mathrm { { m e t a } } }$ : ",
422
+ "bbox": [
423
+ 169,
424
+ 866,
425
+ 825,
426
+ 896
427
+ ],
428
+ "page_idx": 3
429
+ },
430
+ {
431
+ "type": "equation",
432
+ "img_path": "images/0418d318a52594eb0ca1d682a0ba2db87984f75c33a411f4806a9414649a6044.jpg",
433
+ "text": "$$\n\\begin{array} { r } { \\theta _ { 1 } ^ { + } = \\theta _ { 1 } - \\alpha \\nabla _ { \\theta _ { 1 } } \\left( \\mathcal { L } \\big ( f _ { \\theta _ { 1 } } ^ { \\mathrm { p r i } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } ) , y _ { \\mathrm { m e t a } } ^ { ( i ) } \\big ) + \\mathcal { L } \\big ( f _ { \\theta _ { 1 } } ^ { \\mathrm { a u x } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } ) , g _ { \\theta _ { 2 } } ^ { \\mathrm { g e n } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } , y _ { \\mathrm { m e t a } } ^ { ( i ) } , \\psi ) \\Big ) \\right) , } \\end{array}\n$$",
434
+ "text_format": "latex",
435
+ "bbox": [
436
+ 236,
437
+ 901,
438
+ 758,
439
+ 929
440
+ ],
441
+ "page_idx": 3
442
+ },
443
+ {
444
+ "type": "text",
445
+ "text": "where $\\alpha$ is the learning rate. ",
446
+ "bbox": [
447
+ 174,
448
+ 103,
449
+ 357,
450
+ 118
451
+ ],
452
+ "page_idx": 4
453
+ },
454
+ {
455
+ "type": "text",
456
+ "text": "The trick in this meta objective is that we perform the derivative over a derivative (a Hessian matrix) to update $\\theta _ { 2 }$ , by using a retained computational graph of $\\theta _ { 1 } ^ { + }$ in order to compute derivatives with respect to $\\theta _ { 2 }$ . This second derivative trick in meta learning was also proposed in Finn et al. (2017) and Zhang et al. (2018). ",
457
+ "bbox": [
458
+ 174,
459
+ 125,
460
+ 825,
461
+ 181
462
+ ],
463
+ "page_idx": 4
464
+ },
465
+ {
466
+ "type": "text",
467
+ "text": "However, we found that the generated auxiliary labels can easily collapse (i.e. degenerate by simply learning a similar level of complexity as the principal task), which leaves parameters $\\theta _ { 2 }$ in a local minimum without producing any extra useful knowledge. Thus, to encourage the network to learn more complex and informative auxiliary tasks, we further apply an entropy loss $\\mathcal { H } ( g _ { \\theta _ { 2 } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } , y _ { \\mathrm { m e t a } } ^ { ( i ) } , \\psi ) )$ as a regularisation term in the meta objective. A detailed explanation of the entropy loss and the collapsing label problem will be given in Section 3.4. ",
468
+ "bbox": [
469
+ 173,
470
+ 188,
471
+ 825,
472
+ 275
473
+ ],
474
+ "page_idx": 4
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "Finally, the entire MAXL algorithm is defined as follows: ",
479
+ "bbox": [
480
+ 174,
481
+ 281,
482
+ 550,
483
+ 296
484
+ ],
485
+ "page_idx": 4
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "Algorithm 1: The MAXL algorithm ",
490
+ "text_level": 1,
491
+ "bbox": [
492
+ 176,
493
+ 309,
494
+ 415,
495
+ 324
496
+ ],
497
+ "page_idx": 4
498
+ },
499
+ {
500
+ "type": "text",
501
+ "text": "Dataset: $D = \\left\\{ ( x _ { \\mathrm { t r a i n } } , y _ { \\mathrm { t r a i n } } ) , ( x _ { \\mathrm { m e t a } } , y _ { \\mathrm { m e t a } } ) \\right\\}$ \nInitialise: Network parameters: $\\theta _ { 1 } , \\theta _ { 2 }$ ; Hierarchical structure: $\\psi$ \nInitialise: Hyper-parameter (learning rate): $\\alpha , \\beta$ ; Hyper-parameter (task weighting): $\\lambda$ \nfor each training iteration $i$ do $\\left\\{ \\left( x _ { \\mathrm { t r a i n } } ^ { ( i ) } , y _ { \\mathrm { t r a i n } } ^ { ( i ) } \\right) , \\big ( x _ { \\mathrm { m e t a } } ^ { ( i ) } , y _ { \\mathrm { m e t a } } ^ { ( i ) } \\big ) \\right\\} \\in \\left\\{ \\left( x _ { \\mathrm { t r a i n } } , y _ { \\mathrm { t r a i n } } \\right) , \\big ( x _ { \\mathrm { m e t a } } , y _ { \\mathrm { m e t a } } \\big ) \\right\\}$ $\\begin{array} { r } { \\theta _ { 1 } \\theta _ { 1 } - \\alpha \\nabla _ { \\theta _ { 1 } } ( \\mathcal { L } \\big ( f _ { \\theta _ { 1 } } ^ { \\mathrm { p i } } ( x _ { \\mathrm { t r a i n } } ^ { ( i ) } ) , y _ { \\mathrm { t r a i n } } ^ { ( i ) } \\big ) + \\mathcal { L } \\big ( f _ { \\theta _ { 1 } } ^ { \\mathrm { a u x } } ( x _ { \\mathrm { t r a i n } } ^ { ( i ) } ) , g _ { \\theta _ { 2 } } ( x _ { \\mathrm { t r a i n } } ^ { ( i ) } , y _ { \\mathrm { t r a i n } } ^ { ( i ) } , \\psi ) \\Big ) } \\end{array}$ # meta-training step Update: Compute $\\begin{array} { r l } & { \\theta _ { 1 } ^ { + } = \\theta _ { 1 } ^ { ' } - \\alpha \\nabla _ { \\theta _ { 1 } } ( \\mathcal { L } ( f _ { \\theta _ { 1 } } ^ { \\mathrm { p i } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } ) , y _ { \\mathrm { m e t a } } ^ { ( i ) } ) + \\mathcal { L } ( f _ { \\theta _ { 1 } } ^ { \\mathrm { a u x } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } ) , g _ { \\theta _ { 2 } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } , y _ { \\mathrm { m e t a } } ^ { ( i ) } , \\psi ) ) } \\\\ & { \\mathfrak { i } _ { 2 } \\theta _ { 2 } - \\beta \\nabla _ { \\theta _ { 2 } } ( \\mathcal { L } ( f _ { \\theta _ { 1 } } ^ { \\mathrm { p i } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } ) , y _ { \\mathrm { m e t a } } ^ { ( i ) } ) + \\lambda \\mathcal { H } ( g _ { \\theta _ { 2 } } ^ { \\mathrm { g e n } } ( x _ { \\mathrm { m e t a } } ^ { ( i ) } , y _ { \\mathrm { m e t a } } ^ { ( i ) } , \\psi ) ) ) } \\end{array}$ \nend ",
502
+ "bbox": [
503
+ 173,
504
+ 328,
505
+ 776,
506
+ 531
507
+ ],
508
+ "page_idx": 4
509
+ },
510
+ {
511
+ "type": "text",
512
+ "text": "3.3 MASK SOFTMAX FOR HIERARCHICAL PREDICTIONS ",
513
+ "text_level": 1,
514
+ "bbox": [
515
+ 174,
516
+ 550,
517
+ 581,
518
+ 565
519
+ ],
520
+ "page_idx": 4
521
+ },
522
+ {
523
+ "type": "text",
524
+ "text": "In the prediction layer of the meta generator, we designed a modified SoftMax function to predict target auxiliary labels which conform to a pre-defined hierarchy $\\psi$ . As shown in Figure 2 (upper right), the original softmax function does not constrain sub-class labelling to lie within this hierarchy. Our mask SoftMax structure resolves this issue by applying a binary mask to the original SoftMax function. ",
525
+ "bbox": [
526
+ 173,
527
+ 575,
528
+ 825,
529
+ 646
530
+ ],
531
+ "page_idx": 4
532
+ },
533
+ {
534
+ "type": "text",
535
+ "text": "The overall hierarchical structure $\\psi$ determines the number of sub-classes $\\psi [ i ]$ in each principal class $i$ . As such, the total prediction space for auxiliary labels is $\\textstyle \\sum _ { i } \\psi [ i ]$ . This hierarchy, together with the ground-truth principal class label $y$ of the current image, creates the mask with a binarise function $\\bar { \\boldsymbol { M } } = \\boldsymbol { B } ( \\boldsymbol { y } , \\bar { \\boldsymbol { \\psi } } )$ . Using the principal ground-truth label $y$ , the corresponding range of sub-classes $\\psi [ y ]$ is selected, and a binary mask $M$ is created with size $\\textstyle \\sum _ { i } \\psi [ i ]$ with a multi one-hot encoding $\\begin{array} { r } { \\mathbb { 1 } \\sum _ { i < y } \\psi [ i ] \\colon \\sum _ { i < y + 1 } \\psi [ i ] } \\end{array}$ $\\scriptstyle \\mathbf { 1 } _ { a : b }$ is denoted as a multi one-hot encoding in which indexes from $a$ to $b$ are encoded as 1). ",
536
+ "bbox": [
537
+ 173,
538
+ 652,
539
+ 825,
540
+ 753
541
+ ],
542
+ "page_idx": 4
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "Using the example in Figure 2, consider the principal task to have 3 classes with ground truth labels $y = 0 , 1 , 2$ , and hierarchical structure $\\psi \\stackrel { - } { = } [ 2 , \\stackrel { - } { 2 } , 1 ]$ . In this case, the auxiliary prediction space is equal to 5 and the corresponding binary masks are $M = [ 1 , 1 , 0 , 0 , 0 ] , [ 0 , 0 , 1 , 1 , 0 ] , [ 0 , 0 , 0 , 0 , 1 ]$ respectively. ",
547
+ "bbox": [
548
+ 174,
549
+ 760,
550
+ 825,
551
+ 816
552
+ ],
553
+ "page_idx": 4
554
+ },
555
+ {
556
+ "type": "text",
557
+ "text": "Finally, we apply binary mask $M$ with an element-wise multiplication on the original SoftMax function for the final auxiliary task predictions: ",
558
+ "bbox": [
559
+ 176,
560
+ 821,
561
+ 823,
562
+ 852
563
+ ],
564
+ "page_idx": 4
565
+ },
566
+ {
567
+ "type": "equation",
568
+ "img_path": "images/b16eb9b12692bf95db03b4553b36b920a8d628786fe877849ce784ecd3550ff3.jpg",
569
+ "text": "$$\np ( \\hat { y } _ { i } ) = \\frac { \\exp \\hat { y } _ { i } } { \\sum _ { i } \\exp \\hat { y } _ { i } } , \\qquad \\mathrm { M a s k ~ S o f t M a x : } \\quad p ( \\hat { y } _ { i } ) = \\frac { \\exp M \\odot \\hat { y } _ { i } } { \\sum _ { i } \\exp M \\odot \\hat { y } _ { i } } , \\quad M = \\mathcal { B } ( y , \\psi ) ,\n$$",
570
+ "text_format": "latex",
571
+ "bbox": [
572
+ 240,
573
+ 856,
574
+ 823,
575
+ 891
576
+ ],
577
+ "page_idx": 4
578
+ },
579
+ {
580
+ "type": "text",
581
+ "text": "where $p ( \\hat { y } _ { i } )$ represents the probability of the predicted principal label $\\hat { y }$ over class $i$ , and $\\odot$ represents element-wise multiplication. ",
582
+ "bbox": [
583
+ 174,
584
+ 895,
585
+ 823,
586
+ 924
587
+ ],
588
+ "page_idx": 4
589
+ },
590
+ {
591
+ "type": "text",
592
+ "text": "3.4 THE COLLAPSING CLASS PROBLEM ",
593
+ "text_level": 1,
594
+ "bbox": [
595
+ 176,
596
+ 103,
597
+ 462,
598
+ 117
599
+ ],
600
+ "page_idx": 5
601
+ },
602
+ {
603
+ "type": "text",
604
+ "text": "As previously discussed, we predict each auxiliary label within a hierarchical structure $\\psi$ . However, the number of sub-classes defined in $\\psi [ i ]$ is the maximum auxiliary label prediction space, with no guarantee that all $\\psi [ i ]$ classes will be predicted. This may result in some auxiliary labels defined in $\\psi [ i ]$ being overlooked, with the output of the meta generator collapsing into a smaller sub-class space. In experiments, we found that this phenomenon is particularly apparent when we either have a large learning rate for training the meta generator, or a large sub-class prediction space $\\psi$ . ",
605
+ "bbox": [
606
+ 174,
607
+ 128,
608
+ 825,
609
+ 214
610
+ ],
611
+ "page_idx": 5
612
+ },
613
+ {
614
+ "type": "text",
615
+ "text": "To avoid the collapsing class problem, we introduced an additional regularisation loss, which we call the entropy loss $\\mathcal { H } ( \\hat { y } ^ { ( i ) } )$ . This encourages the meta generator to utilise the full prediction space, by encouraging a large prediction entropy across this space. ",
616
+ "bbox": [
617
+ 174,
618
+ 220,
619
+ 825,
620
+ 265
621
+ ],
622
+ "page_idx": 5
623
+ },
624
+ {
625
+ "type": "text",
626
+ "text": "Assuming we have a well-balanced dataset, the entropy loss calculates the KL divergence between the predicted auxiliary label space $\\hat { y } ^ { ( i ) }$ , and a uniform distribution $\\mathcal { U }$ for each $i ^ { t h }$ batch. This is equivalent to calculating the entropy of the predicted label space, and is defined as: ",
627
+ "bbox": [
628
+ 174,
629
+ 271,
630
+ 825,
631
+ 315
632
+ ],
633
+ "page_idx": 5
634
+ },
635
+ {
636
+ "type": "equation",
637
+ "img_path": "images/d1157113428b0d17c6103bd08003e616355d20ed8f36571b36eea736d2c7f733.jpg",
638
+ "text": "$$\n\\mathcal { H } ( \\hat { y } ^ { ( i ) } ) = \\sum _ { k = 1 } ^ { K } \\overline { { y _ { k } } } \\log \\overline { { y _ { k } } } , \\quad \\overline { { y _ { k } } } = \\frac { 1 } { N } \\sum _ { i = 1 } ^ { N } \\hat { y } ^ { ( i ) } .\n$$",
639
+ "text_format": "latex",
640
+ "bbox": [
641
+ 349,
642
+ 321,
643
+ 648,
644
+ 366
645
+ ],
646
+ "page_idx": 5
647
+ },
648
+ {
649
+ "type": "text",
650
+ "text": "where $K$ is the number of auxiliary labels and $N$ is the training batch size. ",
651
+ "bbox": [
652
+ 176,
653
+ 371,
654
+ 661,
655
+ 387
656
+ ],
657
+ "page_idx": 5
658
+ },
659
+ {
660
+ "type": "text",
661
+ "text": "The entropy loss is essential to achieve human-level performance, as shown in our experiments. The higher entropy in the auxiliary target labels results in a more complex auxiliary task. This avoids local minima during training, such as assigning a single label to all examples of a principal class. ",
662
+ "bbox": [
663
+ 174,
664
+ 393,
665
+ 825,
666
+ 435
667
+ ],
668
+ "page_idx": 5
669
+ },
670
+ {
671
+ "type": "text",
672
+ "text": "4 EXPERIMENTS ",
673
+ "text_level": 1,
674
+ "bbox": [
675
+ 176,
676
+ 457,
677
+ 326,
678
+ 472
679
+ ],
680
+ "page_idx": 5
681
+ },
682
+ {
683
+ "type": "text",
684
+ "text": "In this section, we present experimental results to evaluate MAXL with respect to several baselines and datasets on image classification tasks. ",
685
+ "bbox": [
686
+ 173,
687
+ 488,
688
+ 823,
689
+ 516
690
+ ],
691
+ "page_idx": 5
692
+ },
693
+ {
694
+ "type": "text",
695
+ "text": "4.1 EXPERIMENTAL SETUP ",
696
+ "text_level": 1,
697
+ "bbox": [
698
+ 176,
699
+ 534,
700
+ 375,
701
+ 549
702
+ ],
703
+ "page_idx": 5
704
+ },
705
+ {
706
+ "type": "text",
707
+ "text": "Datasets We evaluated on three different datasets: CIFAR100, CIFAR10, and CIFAR10.1v6 (Recht et al., 2018). CIFAR100 consists of 100 principal classes, whilst CIFAR10 and CIFAR10.1v6 consist of 10 principal classes and have the same training dataset as each other, but two different test datasets. To assess the generalisation across different task complexities, we tested a range of different combinations in the numbers of principal and auxiliary classes. For CIFAR100, we expanded the dataset’s provided 2-level hierarchy (20 and 100 classes) into a 4-level hierarchy (additional 3 and 10 classes), by manually assigning examples for these new hierarchy levels (see Appendix A). Based on the new hierarchy, we then tested on all 6 possible combinations of principal and auxiliary class numbers. Note that for MAXL, the hierarchy was used only to define the structure of $\\psi$ and the principal task labels, to ensure a fair comparison with a method using human-defined auxiliary tasks, but the auxiliary task labelling within that structure was learned by MAXL itself. CIFAR10 and CIFAR10.1v6 do not have an associated manually-defined hierarchy, and so we defined a range of hierarchical structures $\\psi [ i ] = 2 , 5 , 1 0 , 2 0 , 5 0 , 1 0 0 , \\forall i$ . ",
708
+ "bbox": [
709
+ 173,
710
+ 560,
711
+ 825,
712
+ 741
713
+ ],
714
+ "page_idx": 5
715
+ },
716
+ {
717
+ "type": "text",
718
+ "text": "Baselines We compared MAXL to a number of baselines. Single Task trains only with the principal class label. Random Assignment trains with auxiliary classes, and randomly assigns the auxiliary class labels. Prototypical Net is a clustering method based on (Snell et al., 2017), where prototypes for auxiliary classes are defined by embedding examples from meta-training data, which has human-defined auxiliary classes, using a pre-trained ImageNet network. Unsupervised, differentiable, nearest-neighbour clustering is then used to produce the final auxiliary class labelling for the remaining training data. The key difference to MAXL is that, whilst both methods are unsupervised, the auxiliary class labelling with MAXL actually evaluates the generalisation performance of this labelling on the principal task, whilst the Prototypical Net method does not. Finally, Human trains with auxiliary classes, using the human-defined hierarchy. Note that due to the need for a manually-defined hierarchy, Prototypical Net and Human were only evaluated on CIFAR100. For all baselines, we use the same network architecture and training procedure as MAXL’s multi-task evaluator. For the meta-training for MAXL and Prototypical Net, we split each training dataset and used $10 \\%$ for meta-training the auxiliary labelling, and $90 \\%$ for training the multi-task evaluator. For all other baselines, we used the full training set for training the multi-task evaluator. ",
719
+ "bbox": [
720
+ 174,
721
+ 757,
722
+ 825,
723
+ 922
724
+ ],
725
+ "page_idx": 5
726
+ },
727
+ {
728
+ "type": "text",
729
+ "text": "",
730
+ "bbox": [
731
+ 176,
732
+ 103,
733
+ 823,
734
+ 146
735
+ ],
736
+ "page_idx": 6
737
+ },
738
+ {
739
+ "type": "text",
740
+ "text": "Training For both the multi-task evaluator and the meta generator use VGG-16 as its core (Simonyan & Zisserman, 2014), together with batch normalisation. For all experiments, we used a learning rate of 0.01 for the multi-task evaluator. For MAXL’s meta generator, we found that a smaller learning rate of $1 0 ^ { - 5 }$ was necessary to help prevent the class collapsing problem. For all training, we drop the learning rate by half after every 50 epochs, and train for a total of 200 epochs, using vanilla stochastic gradient descent. For the meta generator, we apply an $L _ { 1 }$ norm weight decay of $5 \\cdot 1 0 ^ { - 4 }$ on the meta generator, with no regularisation on the multi-task evaluator. We chose the weighting of the entropy regularisation loss term to be 0.2 based on empirical performance. ",
741
+ "bbox": [
742
+ 174,
743
+ 162,
744
+ 825,
745
+ 273
746
+ ],
747
+ "page_idx": 6
748
+ },
749
+ {
750
+ "type": "text",
751
+ "text": "4.2 TEST PERFORMANCE ",
752
+ "text_level": 1,
753
+ "bbox": [
754
+ 176,
755
+ 292,
756
+ 362,
757
+ 306
758
+ ],
759
+ "page_idx": 6
760
+ },
761
+ {
762
+ "type": "text",
763
+ "text": "We now evaluate the performance of MAXL compared to these baselines, on all three datasets. Results for CIFAR100 are presented in Figure 3, and results for CIFAR10 and CIFAR10.1v6 are presented in Appendix B. ",
764
+ "bbox": [
765
+ 174,
766
+ 319,
767
+ 825,
768
+ 361
769
+ ],
770
+ "page_idx": 6
771
+ },
772
+ {
773
+ "type": "image",
774
+ "img_path": "images/ba3262f7dc28e5b4ee5046e70d3d7172a3449a226d32b38995b81556ee528b59.jpg",
775
+ "image_caption": [
776
+ "Figure 3: Learning curves for the CIFAR100 test dataset, comparing MAXL with baseline methods. We provide results in all 6 different combinations of principal and auxiliary class numbers. "
777
+ ],
778
+ "image_footnote": [],
779
+ "bbox": [
780
+ 179,
781
+ 376,
782
+ 818,
783
+ 641
784
+ ],
785
+ "page_idx": 6
786
+ },
787
+ {
788
+ "type": "text",
789
+ "text": "For CIFAR100, we observe that MAXL performs similarly to when human knowledge is used in 4 out of the 6 hierarchical structures, and performs worse in 2 out of the 6. For all other baselines, MAXL performs at least as well, and in the majority of cases outperforms other baselines by a significant margin. We therefore see that MAXL is able to learn auxiliary tasks effectively by tightly coupling the auxiliary task generation and the principal task training, in a superior manner than when these auxiliary tasks are assigned independently, such as with random assignment or using prototypical net. With performance of MAXL approaching that of a system using a human-defined auxiliary tasks, we see strong evidence that MAXL is able to learn to generalise effectively in an unsupervised manner. ",
790
+ "bbox": [
791
+ 174,
792
+ 696,
793
+ 825,
794
+ 823
795
+ ],
796
+ "page_idx": 6
797
+ },
798
+ {
799
+ "type": "text",
800
+ "text": "4.3 EFFECT OF AUXILIARY TASK COMPLEXITY ",
801
+ "text_level": 1,
802
+ "bbox": [
803
+ 176,
804
+ 840,
805
+ 513,
806
+ 854
807
+ ],
808
+ "page_idx": 6
809
+ },
810
+ {
811
+ "type": "text",
812
+ "text": "We now evaluate how the complexity of the auxiliary tasks affects the performance of the principal task. In Figure 4 (a), we present results from CIFAR10 and CIFAR10v1.6 showing the performance increase over single-task learning, when there are 10 principal classes, but a range of auxiliary class numbers $( \\psi [ i ] \\stackrel { } { = } 2 , 5 , 1 0 , 2 0 , 5 \\bar { 0 } , 1 0 0 , \\forall i )$ . For each data point, the performance is calculated by averaging the test accuracy from the last 5 epochs, after a total of 200 epochs. Experiments were performed both with and without the entropy loss term to show the benefit of this regularisation. ",
813
+ "bbox": [
814
+ 176,
815
+ 867,
816
+ 823,
817
+ 924
818
+ ],
819
+ "page_idx": 6
820
+ },
821
+ {
822
+ "type": "text",
823
+ "text": "",
824
+ "bbox": [
825
+ 173,
826
+ 103,
827
+ 823,
828
+ 132
829
+ ],
830
+ "page_idx": 7
831
+ },
832
+ {
833
+ "type": "text",
834
+ "text": "We observe an interesting trend in which test performance rises as the number of auxiliary classes increases, but then begins to fall. This suggests that for a given complexity of principal task, there is an optimum complexity in the auxiliary tasks. One explanation for this may be that as the auxiliary tasks increase in complexity, the learned features favour learning these auxiliary tasks rather than the principal task, encouraging further generalisation beyond the features learned only for the principal task. But if the auxiliary task is too complex, then these features begin to overfit and lose the overlap between the reasoning required for the principal and auxiliary tasks, begins to decrease. ",
835
+ "bbox": [
836
+ 173,
837
+ 140,
838
+ 825,
839
+ 238
840
+ ],
841
+ "page_idx": 7
842
+ },
843
+ {
844
+ "type": "image",
845
+ "img_path": "images/6bc3b5c36a2651f5b22fd1f302e32729193f45fadac730c3aea84650018312cd.jpg",
846
+ "image_caption": [
847
+ "Figure 4: Performance improvement in percentages when training with MAXL compared with single-task learning, with 10 principal classes and a range of auxiliary classes. "
848
+ ],
849
+ "image_footnote": [],
850
+ "bbox": [
851
+ 253,
852
+ 257,
853
+ 720,
854
+ 382
855
+ ],
856
+ "page_idx": 7
857
+ },
858
+ {
859
+ "type": "text",
860
+ "text": "4.4 VISUALISATIONS OF GENERATED KNOWLEDGE ",
861
+ "text_level": 1,
862
+ "bbox": [
863
+ 174,
864
+ 453,
865
+ 544,
866
+ 467
867
+ ],
868
+ "page_idx": 7
869
+ },
870
+ {
871
+ "type": "text",
872
+ "text": "In Figure 5, we visualise 2D embeddings of examples from the CIFAR100 test dataset, on two different task complexities. This was computed using t-SNE (Maaten & Hinton, 2008) on the final feature layer of the multi-task evaluator, and compared across three methods: our MAXL method, our baseline using human-defined hierarchy, and our baseline using single-task learning. ",
873
+ "bbox": [
874
+ 174,
875
+ 481,
876
+ 825,
877
+ 537
878
+ ],
879
+ "page_idx": 7
880
+ },
881
+ {
882
+ "type": "image",
883
+ "img_path": "images/46a8f308f35fa53f6ad6b14f92ada0dc6d31c499ebea64196dceb57ec646934e.jpg",
884
+ "image_caption": [
885
+ "Figure 5: t-SNE visualisation of the learned final layer of the multi-task evaluator network, trained with two combinations of principal and auxiliary class numbers from CIFAR100. Colours represent the principal classes. "
886
+ ],
887
+ "image_footnote": [],
888
+ "bbox": [
889
+ 186,
890
+ 551,
891
+ 812,
892
+ 664
893
+ ],
894
+ "page_idx": 7
895
+ },
896
+ {
897
+ "type": "text",
898
+ "text": "This visualisation shows the separability of principal classes after being trained with the multi-task evaluator. We see that both MAXL and Human show better separation of the principal classes than with Single-Task, owing to the generalisation effect of the auxiliary task learning. The distinction between the separability of the MAXL and Human visualisations is not as clear, despite their very similar performance for these two task complexities in Figure 3. But given that MAXL uses the same hierarchical structure as Human, we see from the visualisation that these two methods are clearly learning different representations. ",
899
+ "bbox": [
900
+ 173,
901
+ 734,
902
+ 825,
903
+ 832
904
+ ],
905
+ "page_idx": 7
906
+ },
907
+ {
908
+ "type": "text",
909
+ "text": "We also show examples of images assigned to the same auxiliary class through MAXL’s multi-task evaluator. Figure 6 shows example images with the highest prediction probabilities for three random auxiliary classes from CIFAR100, using the combination of 20 principal classes and 5 auxiliary classes per principal class, which showed the best performance of MAXL in Figure 3. In addition, we also applied MAXL to MNIST, in which 3 auxiliary classes were used for each of the 10 principal classes. ",
910
+ "bbox": [
911
+ 174,
912
+ 840,
913
+ 825,
914
+ 922
915
+ ],
916
+ "page_idx": 7
917
+ },
918
+ {
919
+ "type": "image",
920
+ "img_path": "images/0b1148d6aa97dee0e59d1c7049362ee17c4d34a79f73ca4fd59a1950a15f582f.jpg",
921
+ "image_caption": [
922
+ "Figure 6: Visualisation of 5 test examples with the highest prediction probability, for each of 3 randomly selected auxiliary classes, for a number of different principal classes. We present the visualisation for CIFAR100 (top) when trained with 20 principal classes and 5 auxiliary classes per principal class, and for MNIST (bottom) when trained with 10 principal classes and 3 auxiliary classes per principal class. "
923
+ ],
924
+ "image_footnote": [],
925
+ "bbox": [
926
+ 179,
927
+ 104,
928
+ 818,
929
+ 450
930
+ ],
931
+ "page_idx": 8
932
+ },
933
+ {
934
+ "type": "text",
935
+ "text": "To our initial surprise, the generated auxiliary labels visualised in both datasets show no clear human-understandable knowledge. In particular, there are no obvious similarities within each auxiliary class whether in terms of shape, colour, style, structure or semantic meaning. However, this makes more sense when we re-consider the task of the meta generator, which is to assign auxiliary labels which assist the principal task. Rather than grouping images in terms of semantic or visual similarity, the meta generator would therefore be more effective it it were to group images in terms of a shared aspect of reasoning which the multi-task evaluator is currently facing difficulty on. If the multi-task evaluator is then able to improve its ability to determine the auxiliary class of an image in such a cluster, then the learned features will help in overcoming this challenging aspect of reasoning. It therefore makes sense that the examples within an auxiliary class do not share semantic or visual similarity, but instead share a more complex underlying property. ",
936
+ "bbox": [
937
+ 174,
938
+ 561,
939
+ 825,
940
+ 715
941
+ ],
942
+ "page_idx": 8
943
+ },
944
+ {
945
+ "type": "text",
946
+ "text": "Further, we discovered that the generated auxiliary knowledge is not deterministic, since the top predicted candidates are different when we re-train the network from scratch. We therefore speculate that using a human-defined hierarchy is just one out of a potentially infinite number of local optima, and on each run of training the meta generator produces another of these local optimums. ",
947
+ "bbox": [
948
+ 174,
949
+ 724,
950
+ 825,
951
+ 780
952
+ ],
953
+ "page_idx": 8
954
+ },
955
+ {
956
+ "type": "text",
957
+ "text": "5 CONCLUSION & FUTURE WORK ",
958
+ "text_level": 1,
959
+ "bbox": [
960
+ 176,
961
+ 805,
962
+ 472,
963
+ 820
964
+ ],
965
+ "page_idx": 8
966
+ },
967
+ {
968
+ "type": "text",
969
+ "text": "In this paper, we have presented and evaluated Meta AuXiliary Learning (MAXL). MAXL learns to generate optimum auxiliary tasks which, when trained alongside a principal task in a multi-task setup, maximise the generalisation of the principal task across a validation dataset. Rather than employing domain knowledge and human-defined auxiliary tasks as is typically required, MAXL is self-supervised and, combined with its general nature, has the potential to automate the process of generalisation to new levels. ",
970
+ "bbox": [
971
+ 174,
972
+ 839,
973
+ 825,
974
+ 922
975
+ ],
976
+ "page_idx": 8
977
+ },
978
+ {
979
+ "type": "text",
980
+ "text": "Our evaluations on three image datasets have shown the performance of MAXL in an image classification setup, where the auxiliary task is to predict sub-class, hierarchical labels for an image. We have shown that MAXL significantly outperforms other auxiliary learning baselines, and even when human-defined knowledge is used to manually construct the auxiliary tasks, MAXL performs similarly in the majority of experiments. ",
981
+ "bbox": [
982
+ 174,
983
+ 103,
984
+ 823,
985
+ 172
986
+ ],
987
+ "page_idx": 9
988
+ },
989
+ {
990
+ "type": "text",
991
+ "text": "Despite this impressive performance from a self-supervised method, questioning why auxiliary tasks generated by MAXL do not outperform those constructed by a human opens exciting future research in this direction. Perhaps, human-defined auxiliary tasks are optimal themselves and cannot be surpassed. However, we believe this not to be the case since such tasks are typically chosen due to the availability of labelled data for these tasks, and not necessarily their optimality when combined with the principal task. Alternatively, perhaps the power of the human knowledge is not from the domain specific labels, but from higher-level reasoning about how auxiliary tasks should be structured. In our experiments, training MAXL using the same structure as a human-defined hierarchy, but learning its own auxiliary labels, typically led to similar performance as when the human-defined labels were used. ",
992
+ "bbox": [
993
+ 174,
994
+ 181,
995
+ 825,
996
+ 319
997
+ ],
998
+ "page_idx": 9
999
+ },
1000
+ {
1001
+ "type": "text",
1002
+ "text": "The general nature of MAXL also opens up questions about how self-supervised auxiliary learning may be used to learn generic auxiliary tasks beyond sub-class labelling. During our experiments, we also ran preliminary experiments on predicting arbitrary vectors as the auxiliary task, but results so far have been inconclusive. However, the ability of MAXL to potentially learn flexible auxiliary tasks which can automatically be tuned for the principal task now offers an exciting direction towards automated generalisation across a wide range of more complex tasks. ",
1003
+ "bbox": [
1004
+ 174,
1005
+ 327,
1006
+ 825,
1007
+ 410
1008
+ ],
1009
+ "page_idx": 9
1010
+ },
1011
+ {
1012
+ "type": "text",
1013
+ "text": "REFERENCES ",
1014
+ "text_level": 1,
1015
+ "bbox": [
1016
+ 174,
1017
+ 431,
1018
+ 285,
1019
+ 446
1020
+ ],
1021
+ "page_idx": 9
1022
+ },
1023
+ {
1024
+ "type": "text",
1025
+ "text": "Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, Brendan Shillingford, and Nando De Freitas. Learning to learn by gradient descent by gradient descent. In Advances in Neural Information Processing Systems, pp. 3981–3989, 2016. \nSamy Bengio, Yoshua Bengio, Jocelyn Cloutier, and Jan Gecsei. On the optimization of a synaptic learning rule. In Preprints Conf. Optimality in Artificial and Biological Neural Networks, pp. 6–8. Univ. of Texas, 1992. \nYoshua Bengio, Samy Bengio, and Jocelyn Cloutier. Learning a synaptic learning rule. Universite´ de Montreal, D ´ epartement d’informatique et de recherche op ´ erationnelle, 1990. ´ \nJia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. Ieee, 2009. \nCarl Doersch and Andrew Zisserman. Multi-task self-supervised visual learning. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017. \nChelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pp. 1126–1135, 2017. \nJohn Flynn, Ivan Neulander, James Philbin, and Noah Snavely. Deepstereo: Learning to predict new views from the world’s imagery. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5515–5524, 2016. \nMax Jaderberg, Wojciech Marian Czarnecki, Simon Osindero, Oriol Vinyals, Alex Graves, David Silver, and Koray Kavukcuoglu. Decoupled neural interfaces using synthetic gradients. arXiv preprint arXiv:1608.05343, 2016. \nMax Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. International Conference on Learning Representations, 2017. \nIasonas Kokkinos. Ubernet: Training a universal convolutional neural network for low-, mid-, and high-level vision using diverse datasets and limited memory. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017. \nZhenguo Li, Fengwei Zhou, Fei Chen, and Hang Li. Meta-sgd: Learning to learn quickly for few shot learning. arXiv preprint arXiv:1707.09835, 2017. \nLukas Liebel and Marco Korner. Auxiliary tasks in multi-task learning. ¨ arXiv preprint arXiv:1805.06334, 2018. \nTsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. arXiv preprint arXiv:1708.02002, 2017. \nShikun Liu, Edward Johns, and Andrew J Davison. End-to-end multi-task learning with attention. arXiv preprint arXiv:1803.10704, 2018. \nLaurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008. \nIshan Misra, Abhinav Shrivastava, Abhinav Gupta, and Martial Hebert. Cross-stitch networks for multi-task learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3994–4003, 2016. \nSachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. 2016. \nBenjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do cifar-10 classifiers generalize to cifar-10? arXiv preprint arXiv:1806.00451, 2018. \nSebastian Ruder. An overview of multi-task learning in deep neural networks. arXiv preprint arXiv:1706.05098, 2017. \nAdam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Oneshot learning with memory-augmented neural networks. arXiv preprint arXiv:1605.06065, 2016. \nJurgen Schmidhuber. Learning complex, extended sequences using the principle of history com- ¨ pression. Neural Computation, 4(2):234–242, 1992. \nKaren Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. \nJake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, pp. 4077–4087, 2017. \nShubham Toshniwal, Hao Tang, Liang Lu, and Karen Livescu. Multitask learning with low-level auxiliary tasks for encoder-decoder based speech recognition. arXiv preprint arXiv:1704.01631, 2017. \nOriol 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. \nJason 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. \nYabin Zhang, Hui Tang, and Kui Jia. Fine-grained visual categorization using meta-learning optimization with sample selection of auxiliary data. arXiv preprint arXiv:1807.10916, 2018. \nTinghui Zhou, Matthew Brown, Noah Snavely, and David G Lowe. Unsupervised learning of depth and ego-motion from video. In CVPR, 2017. ",
1026
+ "bbox": [
1027
+ 169,
1028
+ 449,
1029
+ 826,
1030
+ 929
1031
+ ],
1032
+ "page_idx": 9
1033
+ },
1034
+ {
1035
+ "type": "text",
1036
+ "text": "",
1037
+ "bbox": [
1038
+ 171,
1039
+ 85,
1040
+ 828,
1041
+ 797
1042
+ ],
1043
+ "page_idx": 10
1044
+ },
1045
+ {
1046
+ "type": "text",
1047
+ "text": "A 4-LEVEL CIFAR100 DATASET ",
1048
+ "text_level": 1,
1049
+ "bbox": [
1050
+ 176,
1051
+ 102,
1052
+ 462,
1053
+ 118
1054
+ ],
1055
+ "page_idx": 11
1056
+ },
1057
+ {
1058
+ "type": "table",
1059
+ "img_path": "images/9f61b436c49056f3b3628d53b40e15f6daf2662e3105bb8695f2c20959bc81b7.jpg",
1060
+ "table_caption": [
1061
+ "Table 1: Building a 4-level hierarchy for image classification task based on CIFAR100 dataset. Originally, a 20-class and 100-class heirarchiy was provided, and we manually introduced a 3-class and 10 class layer. "
1062
+ ],
1063
+ "table_footnote": [],
1064
+ "table_body": "<table><tr><td>3 Class</td><td>10 Class</td><td>20 Class</td><td>100 Class</td></tr><tr><td rowspan=\"10\">animals</td><td rowspan=\"2\">large animals</td><td>reptiles</td><td>crocodile,dinosaur,lizard,snake,turtle</td></tr><tr><td>large carnivores</td><td>bear,leopard, lion, tiger, wolf</td></tr><tr><td rowspan=\"2\"></td><td></td><td>large omnivores and herbivores camel,catle,chimpanzee,elephant,kangaroo</td></tr><tr><td>aquatic mammals</td><td>beaver,dolphin,otter,seal, whale</td></tr><tr><td rowspan=\"2\"></td><td>medium-sized mammals</td><td>fox,porcupine,possum, raccoon, skunk</td></tr><tr><td>small mammals</td><td>hamster,mouse,rabbit, shrew,squirrel</td></tr><tr><td rowspan=\"2\"></td><td>fish</td><td>aquarium fish,flatfish,ray,shark,trout</td></tr><tr><td>insects</td><td>bee, beetle, butterfly,caterpillar,cockroach</td></tr><tr><td rowspan=\"2\">people</td><td>non-insect invertebrates</td><td>crab,lobster,snail, spider, worm</td></tr><tr><td>people</td><td>baby,boy,girl,man,woman</td></tr><tr><td rowspan=\"3\">vegetations</td><td rowspan=\"3\">vegetations</td><td>flowers</td><td>orchids, poppies,roses,sunflowers,tulips</td></tr><tr><td>fruit and vegetables</td><td>apples,mushrooms,oranges, pears, peppers</td></tr><tr><td>trees</td><td>maple,oak,palm, pine,willow</td></tr><tr><td rowspan=\"7\">objects and scenes construction</td><td rowspan=\"3\"></td><td>food containers</td><td>bottles,bowls,cans,cups,plates</td></tr><tr><td>household objects household electrical devices</td><td>clock,keyboard,lamp,telephone,television</td></tr><tr><td>household furniture</td><td>bed,chair,couch,table,wardrobe</td></tr><tr><td></td><td>large man-made outdoor things</td><td>sbridge,castle,house,road,skyscraper</td></tr><tr><td>natural scenes</td><td>large natural outdoor scenes</td><td>cloud,forest, mountain, plain, sea</td></tr><tr><td rowspan=\"2\">vehicles</td><td>vehicles 1</td><td>bicycle, bus, motorcycle,pickup truck, train</td></tr><tr><td>vehicles 2</td><td>lawn-mower, rocket, streetcar, tank, tractor</td></tr></table>",
1065
+ "bbox": [
1066
+ 184,
1067
+ 191,
1068
+ 810,
1069
+ 584
1070
+ ],
1071
+ "page_idx": 11
1072
+ },
1073
+ {
1074
+ "type": "text",
1075
+ "text": "B LEARNING CURVES FOR CIFAR10/10.1V6 ",
1076
+ "text_level": 1,
1077
+ "bbox": [
1078
+ 173,
1079
+ 102,
1080
+ 566,
1081
+ 118
1082
+ ],
1083
+ "page_idx": 12
1084
+ },
1085
+ {
1086
+ "type": "image",
1087
+ "img_path": "images/5683941fcf7c15570684d5af976f175c72cd2f1ac4fcb778a27b828a724a25e3.jpg",
1088
+ "image_caption": [
1089
+ "Figure 7: Testing performance on CIFAR10 (bottom) and CIFAR10.1v6 (top) datasets, across 6 different numbers of auxiliary classes. "
1090
+ ],
1091
+ "image_footnote": [],
1092
+ "bbox": [
1093
+ 173,
1094
+ 131,
1095
+ 820,
1096
+ 689
1097
+ ],
1098
+ "page_idx": 12
1099
+ }
1100
+ ]
parse/train/S1gd7nCcF7/S1gd7nCcF7_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/S1gd7nCcF7/S1gd7nCcF7_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/rkgbYyHtwB/rkgbYyHtwB.md ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DISAGREEMENT-REGULARIZED IMITATION LEARNING
2
+
3
+ Kiante Brantley ´ ∗ University of Maryland kdbrant@cs.umd.edu
4
+
5
+ Wen Sun Microsoft Research sun.wen@microsoft.com
6
+
7
+ Mikael Henaff Microsoft Research mihenaff@microsoft.com
8
+
9
+ # ABSTRACT
10
+
11
+ We present a simple and effective algorithm designed to address the covariate shift problem in imitation learning. It operates by training an ensemble of policies on the expert demonstration data, and using the variance of their predictions as a cost which is minimized with RL together with a supervised behavioral cloning cost. Unlike adversarial imitation methods, it uses a fixed reward function which is easy to optimize. We prove a regret bound for the algorithm which is linear in the time horizon multiplied by a coefficient which we show to be low for certain problems on which behavioral cloning fails. We evaluate our algorithm empirically across multiple pixel-based Atari environments and continuous control tasks, and show that it matches or significantly outperforms behavioral cloning and generative adversarial imitation learning.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Training artificial agents to perform complex tasks is essential for many applications in robotics, video games and dialogue. If success on the task can be accurately described using a reward or cost function, reinforcement learning (RL) methods offer an approach to learning policies which has proven to be successful in a wide variety of applications (Mnih et al., 2015; 2016; Lillicrap et al., 2016; Hessel et al., 2018). However, in other cases the desired behavior may only be roughly specified and it is unclear how to design a reward function to characterize it. For example, training a video game agent to adopt more human-like behavior using RL would require designing a reward function which characterizes behaviors as more or less human-like, which is difficult.
16
+
17
+ Imitation learning (IL) offers an elegant approach whereby agents are trained to mimic the demonstrations of an expert rather than optimizing a reward function. Its simplest form consists of training a policy to predict the expert’s actions from states in the demonstration data using supervised learning. While appealingly simple, this approach suffers from the fact that the distribution over states observed at execution time can differ from the distribution observed during training. Minor errors which initially produce small deviations become magnified as the policy encounters states further and further from its training distribution. This phenomenon, initially noted in the early work of (Pomerleau, 1989), was formalized in the work of (Ross & Bagnell, 2010) who proved a quadratic $\mathcal { O } ( \epsilon T ^ { 2 } )$ bound on the regret and showed that this bound is tight. The subsequent work of (Ross et al., 2011) showed that if the policy is allowed to further interact with the environment and make queries to the expert policy, it is possible to obtain a linear bound on the regret. However, the ability to query an expert can often be a strong assumption.
18
+
19
+ In this work, we propose a new and simple algorithm called DRIL (Disagreement-Regularized Imitation Learning) to address the covariate shift problem in imitation learning, in the setting where the agent is allowed to interact with its environment. Importantly, the algorithm does not require any additional interaction with the expert. It operates by training an ensemble of policies on the demonstration data, and using the disagreement in their predictions as a cost which is optimized through RL together with a supervised behavioral cloning cost. The motivation is that the policies in the ensemble will tend to agree on the set of states covered by the expert, leading to low cost, but are more likely to disagree on states not covered by the expert, leading to high cost. The RL cost thus guides the agent back towards the distribution of the expert, while the supervised cost ensures that it mimics the expert within the expert’s distribution.
20
+
21
+ Our theoretical results show that, subject to realizability and optimization oracle assumptions1, our algorithm obtains a $\mathcal { O } ( \epsilon \kappa T )$ regret bound, where $\kappa$ is a measure which quantifies a tradeoff between the concentration of the demonstration data and the diversity of the ensemble outside the demonstration data. We evaluate DRIL empirically across multiple pixel-based Atari environments and continuous control tasks, and show that it matches or significantly outperforms behavioral cloning and generative adversarial imitation learning, often recovering expert performance with only a few trajectories.
22
+
23
+ # 2 PRELIMINARIES
24
+
25
+ We consider episodic finite horizon MDP in this work. Denote by $s$ the state space, $\mathcal { A }$ the action space, and $\Pi$ the class of policies the learner is considering. Let $T$ denote the task horizon and $\pi ^ { \star }$ the expert policy whose behavior the learner is trying to mimic. For any policy $\pi$ , let $d _ { \pi }$ denote the distribution over states induced by following $\pi$ . Denote $C ( s , a )$ the expected immediate cost of performing action $a$ in state $s$ , which we assume is bounded in [0, 1]. In the imitation learning setting, we do not necessarily know the true costs $C ( s , a )$ , and instead we observe expert demonstrations. Our goal is to find a policy $\pi$ which minimizes an observed surrogate loss $\ell$ between its actions and the actions of the expert under its induced distribution of states, i.e.
26
+
27
+ $$
28
+ \hat { \pi } = \arg \operatorname* { m i n } \mathbb { E } _ { s \sim d _ { \pi } } [ \ell ( \pi ( s ) , \pi ^ { \star } ( s ) ) ]
29
+ $$
30
+
31
+ For the following, we will assume $\ell$ is the total variation distance (denoted by $\| \cdot \| )$ , which is an upper bound on the $0 - 1$ loss. Our goal is thus to minimize the following quantity, which represents the distance between the actions taken by our policy $\pi$ and the expert policy $\pi ^ { \star }$ :
32
+
33
+ $$
34
+ J _ { \exp } ( \pi ) = \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ]
35
+ $$
36
+
37
+ Denote $\begin{array} { r } { \mathbb { E } \left[ \sum _ { \tau = t } ^ { T } C ( s _ { \tau } , a _ { \tau } ) | ( s _ { t } , a _ { t } ) = ( s , a ) , a _ { \tau } \sim \pi \right] } \end{array}$ $Q _ { t } ^ { \pi } ( s , a )$ as the standard Q-function of the policy . The following result shows that if $\pi$ , which is defined as $\ell$ $Q _ { t } ^ { \pi } ( s , a ) \ =$ is an upper bound on the $0 - 1$ loss and $C$ satisfies certain smoothness conditions, then minimizing this loss within $\epsilon$ translates into an $\mathcal { O } ( \epsilon T )$ regret bound on the true task cost $J _ { \mathrm { C } } ( \pi ) = \mathbb { E } _ { s , a \sim d _ { \pi } } [ C ( \bar { s } , a ) ]$ :
38
+
39
+ Theorem 1. (Ross et al., 2011) If $\pi$ satisfies $J _ { \mathrm { e x p } } ( \pi ) = \epsilon _ { \mathrm { : } }$ , and $Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , a ) - Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , \pi ^ { \star } ) \leq u$ for all time steps $t$ , actions a and states s reachable by $\pi$ , then $J _ { \mathrm { C } } ( \pi ) \le J _ { \mathrm { C } } ( \pi ^ { \star } ) + u T \epsilon$ .
40
+
41
+ Unfortunately, it is often not possible to optimize $J _ { \exp }$ directly, since it requires evaluating the expert policy on the states induced by following the current policy. The supervised behavioral cloning cost $J _ { \mathrm { B C } }$ , which is computed on states induced by the expert, is often used instead:
42
+
43
+ $$
44
+ J _ { \mathrm { B C } } ( \pi ) = \mathbb { E } _ { s \sim d _ { \pi ^ { \star } } } [ \| \pi ^ { \star } ( \cdot | s ) - \pi ( \cdot | s ) \| ]
45
+ $$
46
+
47
+ Minimizing this loss within $\epsilon$ yields a quadratic regret bound on regret:
48
+
49
+ Theorem 2. (Ross & Bagnell, 2010) Let $J _ { \mathrm { B C } } ( \pi ) = \epsilon ,$ then $J _ { \mathrm { C } } ( \pi ) \leq J _ { \mathrm { C } } ( \pi ^ { \star } ) + T ^ { 2 } \epsilon .$
50
+
51
+ Furthermore, this bound is tight: as we will discuss later, there exist simple problems which match the worst-case lower bound.
52
+
53
+ # 3 ALGORITHM
54
+
55
+ Our algorithm is motivated by two criteria: i) the policy should act similarly to the expert within the expert’s data distribution, and ii) the policy should move towards the expert’s data distribution
56
+
57
+ 1: Input: Expert demonstration data $\mathcal { D } = \{ ( s _ { i } , a _ { i } ) \} _ { i = 1 } ^ { N }$
58
+ 2: Initialize policy $\pi$ and policy ensemble $\Pi _ { \mathrm { E } } = \{ \pi _ { 1 } , . . . , \pi _ { E } \}$
59
+ 3: for $e = 1 , E$ do
60
+ 4: Sample $\mathcal { D } _ { e } \sim \mathcal { D }$ with replacement, with $| \mathcal { D } _ { e } | = | \mathcal { D } |$ .
61
+ 5: Train $\pi _ { e }$ to minimize $J _ { \mathrm { B C } } ( \pi _ { e } )$ on $\mathcal { D } _ { e }$ to convergence.
62
+ 6: end for
63
+ 7: for $i = 1 , \dots$ do
64
+ 8: Perform one gradient update to minimize $J _ { \mathrm { B C } } ( \pi )$ using a minibatch from $\mathcal { D }$ .
65
+ 9: Perform one step of policy gradient to minimize $\mathbb { E } _ { s \sim d _ { \pi } , a \sim \pi ( \cdot | s ) } [ C _ { \mathrm { U } } ^ { \mathrm { c l i p } } ( s , a ) ]$ .
66
+ 10: end for
67
+
68
+ if it is outside of it. These two criteria are addressed by combining two losses: a standard behavior cloning loss, and an additional loss which represents the variance over the outputs of an ensemble $\Pi _ { \mathrm { E } } = \mathbf { \bar { \Pi } } \{ \pi _ { 1 } , . . . , \pi _ { E } \}$ of policies trained on the demonstration data $\mathcal { D }$ . We call this the uncertainty cost, which is defined as:
69
+
70
+ $$
71
+ C _ { \mathrm { U } } ( s , a ) = \mathrm { V a r } _ { \pi \sim \Pi _ { \mathrm { E } } } ( \pi ( a | s ) ) = \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \left( \pi _ { i } ( a | s ) - \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \pi _ { i } ( a | s ) \right) ^ { 2 }
72
+ $$
73
+
74
+ The motivation is that the variance over plausible policies is high outside the expert’s distribution, since the data is sparse, but it is low inside the expert’s distribution, since the data there is dense. Minimizing this cost encourages the policy to return to regions of dense coverage by the expert. Intuitively, this is what we would expect the expert policy $\pi ^ { \star }$ to do as well. The total cost which the algorithm optimizes is given by:
75
+
76
+ $$
77
+ \begin{array} { r } { J _ { \mathrm { { a l g } } } ( \pi ) = \underbrace { { \mathbb { E } } _ { s \sim d _ { \pi ^ { \star } } } \left[ | | \pi ^ { \star } ( \cdot | s ) - \pi ( \cdot | s ) | | \right] } _ { J _ { \mathrm { { B C } } } ( \pi ) } + \underbrace { { \mathbb { E } } _ { s \sim d _ { \pi } , a \sim \pi ( \cdot | s ) } \left[ C _ { \mathrm { U } } ( s , a ) \right] } _ { J _ { \mathrm { { U } } } ( \pi ) } } \end{array}
78
+ $$
79
+
80
+ The first term is a behavior cloning loss and is computed over states generated by the expert policy, of which the demonstration data $\mathcal { D }$ is a representative sample. The second term is computed over the distribution of states generated by the current policy and can be optimized using policy gradient.
81
+
82
+ Note that the demonstration data is fixed, and this ensemble can be trained once offline. We then interleave the supervised behavioral cloning updates and the policy gradient updates which minimize the variance of the ensemble. The full algorithm is shown in Algorithm 1. We also found that dropout (Srivastava et al., 2014), which has been proposed as an approximate form of ensembling, worked well (see Appendix D).
83
+
84
+ In practice, for the supervised loss we optimize the KL divergence between the actions predicted by the policy and the expert actions, which is an upper bound on the total variation distance due to Pinsker’s inequality. We also found it helpful to use a clipped uncertainty cost:
85
+
86
+ $$
87
+ C _ { \mathrm { U } } ^ { \mathrm { c l i p } } ( s , a ) = { \left\{ \begin{array} { l l } { - 1 } & { { \mathrm { i f } } \ C _ { \mathrm { U } } ( s , a ) \leq q } \\ { + 1 } & { { \mathrm { e l s e } } } \end{array} \right. }
88
+ $$
89
+
90
+ where the threshold $q$ is a top quantile of the raw uncertainty costs computed over the demonstration data. The threshold $q$ defines a normal range of uncertainty based on the demonstration data, and values above this range incur a positive cost (or negative reward).
91
+
92
+ The RL cost can be optimized using any policy gradient method. In our experiments we used advantage actor-critic (A2C) (Mnih et al., 2016) or PPO (Schulman et al., 2017), which estimate the expected cost using rollouts from multiple parallel actors all sharing the same policy (see Appendix C for details). We note that model-based RL methods could in principle be used as well if sample efficiency is a constraint.
93
+
94
+ # 4 ANALYSIS
95
+
96
+ # 4.1 COVERAGE COEFFICIENT
97
+
98
+ We now analyze DRIL for MDPs with discrete action spaces and potentially large or infinite state spaces. We will show that, subject to assumptions that the policy class contains an optimal policy and that we are able to optimize costs within $\epsilon$ of their global minimum, our algorithm obtains a regret bound which is linear in $\kappa T$ , where $\kappa$ is a quantity which depends on the environment dynamics, the expert distribution $d _ { \pi } ^ { \star }$ , and our learned ensemble. Intuitively, $\kappa$ represents a tradeoff between how concentrated the demonstration data is and how high the variance of the ensemble is outside the expert distribution.
99
+
100
+ Assumption 1. (Realizability) $\pi ^ { \star } \in \Pi$
101
+
102
+ Assumption 2. (Optimization Oracle) For any given cost function $J$ , our minimization procedure returns a policy ${ \hat { \pi } } \in \Pi$ such that $J ( \widehat { \pi } ) \leq \arg \operatorname* { m i n } _ { \pi \in \Pi } J ( \pi ) + \epsilon .$ .
103
+
104
+ The motivation behind our algorithm is that the policies in the ensemble agree inside the expert’s distribution and disagree outside of it. This defines a reward function which pushes the learner back towards the expert’s distribution if it strays away. However, what constitutes inside and outside the distribution, or sufficient agreement or disagreement, is ambiguous. Below we introduce quantities which makes these ideas precise.
105
+
106
+ Definition 1. For any set $\begin{array} { r l r } { \mathcal { U } } & { { } \subseteq } & { S } \end{array}$ , define the concentrability inside of $\mathcal { U }$ as $\begin{array} { r l } { \alpha ( \mathcal { U } ) } & { { } = } \end{array}$ $\begin{array} { r } { \operatorname* { m a x } _ { \pi \in \Pi } \operatorname* { s u p } _ { s \in \mathcal { U } } \frac { d _ { \pi } ( s ) } { d _ { \pi ^ { \star } ( s ) } } } \end{array}$
107
+
108
+ The notion of concentrability has been previously used to give bounds on the performance of value iteration (Munos & Szepesvari, 2008). For a set ´ $\mathcal { U }$ , $\alpha ( \mathcal { U } )$ will be low if the expert distribution has high mass at the states in $\mathcal { U }$ that are reachable by policies in the policy class.
109
+
110
+ Definition 2. Define the minimum variance of the ensemble outside of $\mathcal { U }$ as $\begin{array} { r l } { \beta ( \mathcal { U } ) } & { { } = } \end{array}$ $\begin{array} { r } { \operatorname* { m i n } _ { s \not \in \mathcal { U } , a \in \mathcal { A } } \operatorname { V a r } _ { \pi \sim \Pi _ { \mathrm { E } } } [ \pi ( a | s ) ] } \end{array}$ .
111
+
112
+ We now define the $\kappa$ coefficient as the minimum ratio of these two quantities over all possible subsets of $s$ .
113
+
114
+ Definition 3. We define κ = minU⊆S α(U)β(U) .
115
+
116
+ We can view $\kappa$ as the quantity which minimizes the tradeoff over different subsets $\mathcal { U }$ between coverage by the expert policy inside of $\mathcal { U }$ , and variance of the ensemble outside of $\mathcal { U }$ .
117
+
118
+ # 4.2 REGRET BOUND
119
+
120
+ We now establish a relationship between the $\kappa$ coefficient just defined, the cost our algorithm optimizes, and $J _ { \mathrm { e x p } }$ defined in Equation (2) which we would ideally like to minimize and which translates into a regret bound. All proofs can be found in Appendix A.
121
+
122
+ Lemma 1. For any $\pi \in \Pi$ , we have $J _ { \mathrm { e x p } } ( \pi ) \le \kappa J _ { \mathrm { a l g } } ( \pi )$ .
123
+
124
+ This result shows that if $\kappa$ is not too large, and we are able to make our cost function $J _ { \mathrm { a l g } } ( \pi )$ small, then we can ensure $J _ { \exp } ( \pi )$ is also small. This result is only useful if our cost function can indeed achieve a small minimum. The next lemma shows that this is the case.
125
+
126
+ Lemma 2. $\begin{array} { r } { \operatorname* { m i n } _ { \pi \in \Pi } J _ { \mathrm { a l g } } ( \pi ) \le 2 \epsilon } \end{array}$ .
127
+
128
+ Here $\epsilon$ is the threshold specified in Assumption 2. Combining these two lemmas with the previous result of Ross et al. (2011), we get a regret bound which is linear in $\kappa T$ .
129
+
130
+ Theorem 3. Let πˆ be the result of minimizing $J _ { \mathrm { a l g } }$ using our optimization oracle, and assume that $Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , a ) - Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , \pi ^ { \star } ) \leq u$ for all actions $a$ , time steps $t$ and states s reachable by $\pi$ . Then $\hat { \pi }$ satisfies $J _ { \scriptscriptstyle \mathrm { C } } ( \hat { \pi } ) \leq J _ { \scriptscriptstyle \mathrm { C } } ( \pi ^ { \star } ) + 3 u \kappa \epsilon T$ .
131
+
132
+ Our bound is an improvement over that of behavior cloning if $\kappa$ is less than $\mathcal { O } ( T )$ . Note that DRIL does not require knowledge of $\kappa$ . The quantity $\kappa$ is problem-dependent and depends on the environment dynamics, the expert policy and the policies in the learned ensemble. We next compute $\kappa$ exactly for a problem for which behavior cloning is known to perform poorly, and show that it is independent of $T$ .
133
+
134
+ ![](images/68e4a2dec40b01d14eecadff2090a4ffad0c8c08dd4e6d1606d486e68d71db80.jpg)
135
+ Figure 1: Example of a problem where behavioral cloning incurs quadratic regret.
136
+
137
+ Example 1. Consider the tabular MDP given in (Ross & Bagnell, 2010) as an example of a problem where behavioral cloning incurs quadratic regret, shown in Figure 1. There are $^ 3$ states $\boldsymbol { S } = \left( { { s _ { 0 } } , { s _ { 1 } } , { s _ { 2 } } } \right)$ and two actions $( a _ { 1 } , \underset { - } { a _ { 2 } } )$ . Each policy $\pi$ can be represented as a set of probabilities $\pi ( a _ { 1 } | s )$ for each state $s \in S ^ { \ 2 }$ . Assume the models in our ensemble are drawn from a posterior $p ( \pi ( a _ { 1 } | s ) | \mathcal { D } )$ given by a Beta distribution with parameters $B e t a ( n _ { 1 } + 1 , n _ { 2 } + 1 )$ where $n _ { 1 } , n _ { 2 }$ are the number of times the pairs $( s , a _ { 1 } )$ and $( s , a _ { 2 } )$ occur, respectively, in the demonstration data $\mathcal { D }$ . The agent always starts in $s _ { 0 }$ and the expert’s policy is given by $\pi ^ { \star } ( a _ { 1 } | s _ { 0 } ) =$ $1 , \pi ^ { \star } ( a _ { 1 } | s _ { 1 } ) = 0 , \pi ^ { \star } ( a _ { 1 } | s _ { 2 } ) = 1$ . For any $( s , a )$ pair, the task cost is $C ( s , a ) = 0$ if $a = \pi ^ { \star } ( s )$ and 1 otherwise. Here $\begin{array} { r } { d _ { \pi } ^ { \star } \ = \ ( \frac { 1 } { T } , \frac { T - 1 } { T } , 0 ) } \end{array}$ . For any $\pi$ , $\begin{array} { r } { d _ { \pi } ( s _ { 0 } ) \ = \ \frac { 1 } { T } } \end{array}$ and $\begin{array} { r } { d _ { \pi } ( s _ { 1 } ) \ \leq \ \frac { T - 1 } { T } } \end{array}$ due to the dynamics of the MDP, so $\begin{array} { r } { \frac { d _ { \pi } ( s ) } { d _ { \pi } ^ { \star } ( s ) } \le 1 } \end{array}$ for $s \in \{ s _ { 0 } , s _ { 1 } \}$ . Writing out $\alpha ( \{ s _ { 0 } , s _ { 1 } \} )$ , we get: $\begin{array} { r } { \alpha ( \{ s _ { 0 } , s _ { 1 } \} ) = \operatorname* { m a x } _ { \pi \in \Pi } \operatorname* { s u p } _ { s \in \{ s _ { 0 } , s _ { 1 } \} } \frac { d _ { \pi } ( s ) } { d _ { \pi } ^ { \star } ( s ) } \le 1 . } \end{array}$
138
+
139
+ Furthermore, since $s _ { 2 }$ is never visited in the demonstration data, for each policy $\pi _ { i }$ in the ensemble we have $\pi _ { i } ( a _ { 1 } | s _ { 2 } ) , \pi _ { i } ( a _ { 2 } | s _ { 2 } ) \sim B e t a ( 1 , 1 ) = U n i f o r m ( 0 , 1 )$ . It follows that $\mathrm { V a r } _ { \pi \sim \Pi _ { \mathrm { E } } } ( \pi ( a | s _ { 2 } ) )$ is approximately equal 3 to the variance of a uniform distribution over $[ 0 , 1 ]$ , i.e. $\textstyle { \frac { 1 } { 1 2 } }$ . Therefore:
140
+
141
+ $$
142
+ \kappa = \operatorname* { m i n } _ { \mathcal { U } \subseteq \mathcal { S } } \frac { \alpha ( \mathcal { U } ) } { \beta ( \mathcal { U } ) } \leq \frac { \alpha ( \{ s _ { 0 } , s _ { 1 } \} ) } { \beta ( \{ s _ { 0 } , s _ { 1 } \} ) } \lesssim \frac { 1 } { \frac { 1 } { 1 2 } } = 1 2
143
+ $$
144
+
145
+ Applying our result from Theorem 3, we see that our algorithm obtains an $\mathcal { O } ( \epsilon T )$ regret bound on this problem, in contrast to the $\mathcal { O } ( \epsilon T ^ { 2 } )$ regret of behavioral cloning4.
146
+
147
+ # 5 RELATED WORK
148
+
149
+ The idea of learning through imitation dates back at least to the work of (Pomerleau, 1989), who trained a neural network to imitate the steering actions of a human driver using images as input. The problem of covariate shift was already observed, as the author notes: “the network must not solely be shown examples of accurate driving, but also how to recover once a mistake has been made”.
150
+
151
+ This issue was formalized in the work of (Ross & Bagnell, 2010), who on one hand proved an $\mathcal { O } ( \epsilon T ^ { 2 } )$ regret bound, and on the other hand provided an example showing this bound is tight. The subsequent work (Ross et al., 2011) proposed the DAGGER algorithm which obtains linear regret, provided the agent can both interact with the environment, and query the expert policy. Our approach also requires environment interaction, but importantly does not need to query the expert. Also of note is the work of (Venkatraman et al., 2015), which extended DAGGER to time series prediction problems by using the true targets as expert corrections.
152
+
153
+ Imitation learning has been used within the context of modern RL to help improve sample efficiency (Chang et al., 2015; Ross & Bagnell, 2014; Sun et al., 2017; Hester et al., 2018; Le et al., 2018; Cheng & Boots, 2018) or overcome exploration (Nair et al., 2017). These settings assume the reward is known and that the policies can then be fine-tuned with reinforcement learning. In this case, covariate shift is less of an issue since it can be corrected using the reinforcement signal.
154
+
155
+ The work of (Luo et al., 2019) also proposed a method to address the covariate shift problem when learning from demonstrations when the reward is known, by conservatively extrapolating the value function outside the training distribution using negative sampling. This addresses a different setting from ours, and requires generating plausible states which are off the manifold of training data, which may be challenging when the states are high dimensional such as images. The work of (Reddy et al., 2019) proposed to treat imitation learning within the Q-learning framework, setting a positive reward for all transitions inside the demonstration data and zero reward for all other transitions in the replay buffer. This rewards the agent for repeating (or returning to) the expert’s transitions. The work of (Sasaki et al., 2019) also incorporates a mechanism for reducing covariate shift by fitting a Q-function that classifies whether the demonstration states are reachable from the current state. Random Expert Distillation (Wang et al., 2019) uses Random Network Distillation (RND) (Burda et al., 2019) to estimate the support of the expert’s distribution in state-action space, and minimizes an RL cost designed to guide the agent towards the expert’s support. This is related to our method, but differs in that it minimizes the RND prediction error rather than the ensemble variance and does not include a behavior cloning cost. The behavior cloning cost is essential to our theoretical results and avoids certain failure modes, see Appendix B for more discusion.
156
+
157
+ Generative Adversarial Imitation Learning (GAIL) (Ho & Ermon, 2016) is a state-of-the-art algorithm which addresses the same setting as ours. It operates by training a discriminator network to distinguish expert states from states generated by the current policy, and the negative output of the discriminator is used as a reward signal to train the policy. The motivation is that states which are outside the training distribution will be assigned a low reward while states which are close to it will be assigned a high reward. This encourages the policy to return to the expert distribution if it strays away from it. However, the adversarial training procedure means that the reward function is changing over time, which can make the algorithm unstable or difficult to tune. In contrast, our approach uses a simple fixed reward function. We include comparisons to GAIL in our experiments.
158
+
159
+ Using disagreement between models in an ensemble to represent uncertainty has recently been explored in several contexts. The works of (Shyam et al., 2018; Pathak et al., 2019; Henaff, 2019) used disagreement between different dynamics models to drive exploration in the context of modelbased RL. Conversely, (Henaff et al., 2019) used variance across different dropout masks to prevent policies from exploiting error in dynamics models. Ensembles have also been used to represent uncertainty over Q-values in model-free RL in order to encourage exploration (Osband et al., 2016). Within the context of imitation learning, the work of (Menda et al., 2018) used the variance of the ensemble together with the DAGGER algorithm to decide when to query the expert demonstrator to minimize unsafe situations. Here, we use disagreement between different policies trained on demonstration data to address covariate shift in the context of imitation learning.
160
+
161
+ # 6 EXPERIMENTS
162
+
163
+ # 6.1 TABULAR MDPS
164
+
165
+ As a first experiment, we applied DRIL to the tabular MDP of (Ross & Bagnell, 2010) shown in Figure 1. We computed the posterior over the policy parameters given the demonstration data using a separate Beta distribution for each state $s$ with parameters determined by the number of times each action was performed in s. For behavior cloning, we sampled a single policy from this posterior. For DRIL, we sampled an ensemble of 5 policies and used their negative variance to define an additional reward function. We combined this with a reward which was the probability density function of a given state-action pair under the posterior distribution, which corresponds to the supervised learning loss, and used tabular Q-learning to optimize the sum of these two reward functions. This experiment was repeated 500 times for time horizon lengths up to 500 and $N = 1 , 5 , 1 0$ expert demonstration trajectories.
166
+
167
+ ![](images/2493ce67dfd3a36789481b8ea016ce3a998184660878b9d06f5905f8bf05413a.jpg)
168
+ Figure 2: Results on tabular MDP from (Ross & Bagnell, 2010). Shaded region represents range between $5 ^ { \mathrm { t h } }$ and $9 5 ^ { \mathrm { t h } }$ quantiles, computed across 500 trials. Behavior cloning exhibits poor worstcase regret, whereas DRIL has low regret across all trials.
169
+
170
+ Figure 2 shows plots of the regret over the 500 different trials across different time horizons. Although BC achieves good average performance, it exhibits poor worst-case performance with some trials incurring very high regret, especially when using fewer demonstrations. Our method has low regret across all trials, which stays close to constant independantly of the time horizon, even with a single demonstration. This performance is better than that suggested by our analysis, which showed a worst-case linear bound with respect to time horizon.
171
+
172
+ # 6.2 ATARI ENVIRONMENTS
173
+
174
+ We next evaluated our approach on six different Atari environments. We used pretrained PPO (Schulman et al., 2017) agents from the stable baselines repository (Hill et al., 2018) to generate $N = \{ 1 , 3 , 5 , 1 0 , 1 5 , 2 0 \}$ expert trajectories. We compared against two other methods: standard behavioral cloning (BC) and Generative Adversarial Imitation Learning (GAIL). Results are shown in Figure 3a. DRIL outperforms behavioral cloning across most environments and numbers of demonstrations, often by a substantial margin. In many cases, our method is able to match the expert’s performance using a small number of trajectories. Figure 3b shows the evolution of the uncertainty cost and the policy reward throughout training. In all cases, the reward improves while the uncertainty cost decreases.
175
+
176
+ We were not able to obtain meaningful performance for GAIL on these domains, despite performing a hyperparameter search across learning rates for the policy and discriminator, and across different numbers of discriminator updates. We additionally experimented with clipping rewards in an effort to stabilize performance. These results are consistent with those of (Reddy et al., 2019), who also reported negative results when running GAIL on images. While improved performance might be possible with more sophisticated adversarial training techniques, we note that this contrasts with our method which uses a fixed reward function obtained through simple supervised learning.
177
+
178
+ In Appendix D we provide ablation experiments examining the effects of the cost function clipping and the role of the BC loss. We also compare the ensemble approach to a dropout-based approximation and show that DRIL works well in both cases.
179
+
180
+ # 6.3 CONTINUOUS CONTROL
181
+
182
+ We next report results of running our method on 6 different continuous control tasks from the PyBullet5 and OpenAI Gym (Brockman et al., 2016) environments. We again used pretrained agents to generate expert demonstrations, and compared to Behavior Cloning and GAIL.
183
+
184
+ Results for all methods are shown in Figure 4. In these environments we found Behavior Cloning to be a much stronger baseline than for the Atari environments: in several tasks it was able to match expert performance using as little as 3 trajectories, suggesting that covariate shift may be less of an issue. Our method performs similarly to Behavior Cloning on most tasks, except on Walker2D, where it yields improved performance for $N = 1 , 3 , 5$ trajectories. GAIL performs somewhat better than DRIL on HalfCheetah and Walker2D, but performs worse than both DRIL and BC on LunarLander and BipedalWalkerHardcore. The fact that DRIL is competitive across all tasks provides evidence of its robustness.
185
+
186
+ ![](images/b0edd841d3208a643e7aedc62d719e9e8c99705771d310ccf6e981b64bc6aa90.jpg)
187
+ Figure 3: Results on Atari environments. a) Median final policy performance for different numbers of expert trajectories, taken over 4 seeds (shaded regions are min/max performance) b) Evolution of policy reward and uncertainty cost during training with $N = 3$ trajectories.
188
+
189
+ # 7 CONCLUSION
190
+
191
+ Addressing covariate shift has been a long-standing challenge in imitation learning. In this work, we have proposed a new method to address this problem by penalizing the disagreement between an ensemble of different policies trained on the demonstration data. Importantly, our method requires no additional labeling by an expert. Our experimental results demonstrate that DRIL can often match expert performance while using only a small number of trajectories across a wide array of tasks, ranging from tabular MDPs to pixel-based Atari games and continuous control tasks. On the theoretical side, we have shown that our algorithm can provably obtain a low regret bound for problems in which the $\kappa$ parameter is low.
192
+
193
+ ![](images/fc439a33e8fbac82cfd89450bec241d73107c1c8a1ca073b97a8ff5756290cd0.jpg)
194
+ Figure 4: Results on continuous control tasks.
195
+
196
+ There are multiple directions for future work. On the theoretical side, characterizing the $\kappa$ parameter on a larger array of problems would help to better understand the settings where our method can expect to do well. Empirically, there are many other settings in structured prediction (Daume´ et al., 2009) where covariate shift is an issue and where our method could be applied. For example, in dialogue and language modeling it is common for generated text to become progressively less coherent as errors push the model off the manifold it was trained on. Our method could potentially be used to fine-tune language or translation models (Cho et al., 2014; Welleck et al., 2019) after training by applying our uncertainty-based cost function to the generated text.
197
+
198
+ # REFERENCES
199
+
200
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
201
+
202
+ Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id ${ . } = { }$ H1lJJnR5Ym.
203
+
204
+ Kai-Wei Chang, Akshay Krishnamurthy, Alekh Agarwal, John Langford, and Hal Daume III. Learn- ´ ing to search better than your teacher. 2015.
205
+
206
+ Ching-An Cheng and Byron Boots. Convergence of value aggregation for imitation learning. arXiv preprint arXiv:1801.07292, 2018.
207
+
208
+ Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, ¨ Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder– decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1724–1734, Doha, Qatar, October 2014. Association for Computational Linguistics. doi: 10.3115/v1/D14-1179. URL https://www.aclweb.org/anthology/D14-1179.
209
+
210
+ Hal Daume, John Langford, and Daniel Marcu. Search-based structured prediction. ´ CoRR, abs/0907.0786, 2009. URL http://arxiv.org/abs/0907.0786.
211
+
212
+ Mikael Henaff. Explicit explore-exploit algorithms in continuous state spaces. In H. Wallach, H. Larochelle, A. Beygelzimer, F. Alche-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 9377– 9387. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/ 9135-explicit-explore-exploit-algorithms-in-continuous-state-spaces. pdf.
213
+
214
+ Mikael Henaff, Alfredo Canziani, and Yann LeCun. Model-predictive policy learning with uncertainty regularization for driving in dense traffic. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HygQBn0cYm.
215
+
216
+ Matteo Hessel, Joseph Modayil, Hado P. van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Gheshlaghi Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In AAAI, 2018.
217
+
218
+ Todd Hester, Matej Vecer´ık, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Ian Osband, Gabriel Dulac-Arnold, John Agapiou, Joel Z. Leibo, and Audrunas Gruslys. Deep q-learning from demonstrations. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pp. 3223–3230, 2018. URL https://www.aaai.org/ocs/index.php/AAAI/ AAAI18/paper/view/16976.
219
+
220
+ Ashley Hill, Antonin Raffin, Maximilian Ernestus, Adam Gleave, Rene Traore, Prafulla Dhariwal, Christopher Hesse, Oleg Klimov, Alex Nichol, Matthias Plappert, Alec Radford, John Schulman, Szymon Sidor, and Yuhuai Wu. Stable baselines. https://github.com/hill-a/ stable-baselines, 2018.
221
+
222
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4565–4573. Curran Associates, Inc., 2016.
223
+
224
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2014. URL http://arxiv.org/abs/1412.6980. cite arxiv:1412.6980Comment: Published as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015.
225
+
226
+ Ilya Kostrikov. Pytorch implementations of reinforcement learning algorithms. https:// github.com/ikostrikov/pytorch-a2c-ppo-acktr-gail, 2018.
227
+
228
+ Hoang M Le, Nan Jiang, Alekh Agarwal, Miroslav Dud´ık, Yisong Yue, and Hal Daume III. Hierar-´ chical imitation and reinforcement learning. arXiv preprint arXiv:1803.00590, 2018.
229
+
230
+ Timothy P. Lillicrap, Jonathan J. Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. CoRR, abs/1509.02971, 2016.
231
+
232
+ Yuping Luo, Huazhe Xu, and Tengyu Ma. Learning self-correctable policies and value functions from demonstrations with negative sampling. CoRR, abs/1907.05634, 2019. URL http:// arxiv.org/abs/1907.05634.
233
+
234
+ Kunal Menda, Katherine Rose Driggs-Campbell, and Mykel J. Kochenderfer. Ensembledagger: A bayesian approach to safe imitation learning. ArXiv, abs/1807.08364, 2018.
235
+
236
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, February 2015. ISSN 00280836. URL http://dx.doi.org/10.1038/nature14236.
237
+
238
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In Maria Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of The 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pp. 1928–1937, New York, New York, USA, 20–22 Jun 2016. PMLR. URL http: //proceedings.mlr.press/v48/mniha16.html.
239
+
240
+ Remi Munos and Csaba Szepesv ´ ari. Finite-time bounds for fitted value iteration. ´ J. Mach. Learn. Res., 9:815857, June 2008. ISSN 1532-4435.
241
+
242
+ Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming exploration in reinforcement learning with demonstrations. 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 6292–6299, 2017.
243
+
244
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped DQN. CoRR, abs/1602.04621, 2016. URL http://arxiv.org/abs/1602. 04621.
245
+
246
+ Deepak Pathak, Dhiraj Gandhi, and Abhinav Gupta. Self-supervised exploration via disagreement. In ICML, 2019.
247
+
248
+ Dean A. Pomerleau. Alvinn: An autonomous land vehicle in a neural network. In D. S. Touretzky (ed.), Advances in Neural Information Processing Systems 1, pp. 305–313. Morgan-Kaufmann, 1989. URL http://papers.nips.cc/paper/ 95-alvinn-an-autonomous-land-vehicle-in-a-neural-network.pdf.
249
+
250
+ Siddharth Reddy, Anca D. Dragan, and Sergey Levine. SQIL: imitation learning via regularized behavioral cloning. CoRR, abs/1905.11108, 2019. URL http://arxiv.org/abs/1905. 11108.
251
+
252
+ Stephane Ross and Drew Bagnell. Efficient reductions for imitation learning. In Yee Whye Teh and Mike Titterington (eds.), Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pp. 661–668, Chia Laguna Resort, Sardinia, Italy, 13–15 May 2010. PMLR. URL http://proceedings. mlr.press/v9/ross10a.html.
253
+
254
+ Stephane Ross and J Andrew Bagnell. Reinforcement and imitation learning via interactive no-regret learning. arXiv preprint arXiv:1406.5979, 2014.
255
+
256
+ Stephane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Geoffrey Gordon, David Dunson, and Miroslav Dudk (eds.), Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, volume 15 of Proceedings of Machine Learning Research, pp. 627–635, Fort Lauderdale, FL, USA, 11–13 Apr 2011. PMLR. URL http://proceedings.mlr.press/ v15/ross11a.html.
257
+
258
+ Fumihiro Sasaki, Tetsuya Yohira, and Atsuo Kawaguchi. Sample efficient imitation learning for continuous control. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BkN5UoAqF7.
259
+
260
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017. URL http://arxiv.org/abs/ 1707.06347.
261
+
262
+ Pranav Shyam, Wojciech Jaskowski, and Faustino Gomez. Model-based active exploration. CoRR, abs/1810.12162, 2018.
263
+
264
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1):1929–1958, 2014. URL http://www.cs.toronto.edu/˜rsalakhu/ papers/srivastava14a.pdf.
265
+
266
+ Wen Sun, Arun Venkatraman, Geoffrey J Gordon, Byron Boots, and J Andrew Bagnell. Deeply aggrevated: Differentiable imitation learning for sequential prediction. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3309–3318. JMLR. org, 2017.
267
+
268
+ Arun Venkatraman, Martial Hebert, and J. Andrew Bagnell. Improving multi-step prediction of learned time series models. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, AAAI’15, pp. 3024–3030. AAAI Press, 2015. ISBN 0-262-51129-0. URL http: //dl.acm.org/citation.cfm?id=2888116.2888137.
269
+
270
+ Ruohan Wang, Carlo Ciliberto, Pierlugi Amadori, and Yiannis Demiris. Random expert distillation: Imitation learning via expert policy support estimation. In Proceedings of International Conference on Machine Learning. ACM, 2019.
271
+
272
+ Sean Welleck, Kiante Brantley, Hal Daum ´ e III, and Kyunghyun Cho. Non-monotonic sequential text ´ generation. CoRR, abs/1902.02192, 2019. URL http://arxiv.org/abs/1902.02192.
273
+
274
+ # A PROOFS
275
+
276
+ Lemma 1. For any $\pi \in \Pi$ we have $J _ { \mathrm { e x p } } ( \pi ) \le \kappa J _ { \mathrm { a l g } } ( \pi )$
277
+
278
+ Proof. We will first show that for any $\pi \in \Pi$ and $\mathcal { U } \subseteq \mathcal { S }$ , we have $\begin{array} { r } { J _ { \mathrm { e x p } } ( \pi ) \le \frac { \alpha ( \mathcal { U } ) } { \beta ( \mathcal { U } ) } J _ { \mathrm { a l g } } ( \pi ) } \end{array}$ . We can rewrite this as:
279
+
280
+ $$
281
+ \begin{array} { r l } & { J _ { \mathrm { e x p } } ( \pi ) = \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ] } \\ & { \qquad = \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \in \mathcal { U } ) \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ] + \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ] } \end{array}
282
+ $$
283
+
284
+ We begin by bounding the first term:
285
+
286
+ $$
287
+ \begin{array} { r l } { \mathbb { E } _ { s \sim \theta _ { 0 } } \bigg [ \big ( | s - z | \big ) \| \pi \langle | s \rangle - \pi ^ { * } ( | s ) \big \| \bigg ] = \displaystyle \sum _ { s \in \theta _ { 0 } } d _ { \pi } ( s ) \| \pi \langle | s \rangle - \pi ^ { * } ( | s ) \| } \\ & { \quad = \displaystyle \sum _ { s \in \theta _ { 0 } } \frac { \lambda _ { \pi } ( s ) } { d \pi ^ { s } ( s ) } d _ { \pi ^ { s } ( s ) } \| x ( s ) - \pi ^ { * } ( | s | ) \| } \\ & { \quad \le \displaystyle \sum _ { s \in \theta _ { 0 } } \bigg ( \frac { \eta _ { 0 } \kappa \kappa \kappa \| s \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \bigg ) d _ { \pi ^ { s } ( s ) } \langle s | \pi | ( s ) \rangle - \pi ^ { * } ( | s | ) \bigg \| } \\ & { \quad \quad \sim \epsilon ( | L \eta \langle \frac { \eta _ { 0 } \kappa \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \Big ) d _ { \pi ^ { s } ( s ) } \bigg \| \pi ( s | \delta ) \| \pi ( s ) - \pi ^ { * } ( | s | ) \| } \\ & { \quad \quad = \epsilon ( | L \eta \sum _ { s \in \theta _ { 0 } } d _ { \pi ^ { s } ( s ) } \langle \theta | \pi ( s ) \rangle - \pi ^ { * } ( | s | ) \| } \\ & { \quad \le \alpha ( | L \eta \langle \frac { \eta _ { 0 } \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \| x ( s ) - x ^ { * } ( | s ) \| } \\ & { \quad \quad = \epsilon ( | L \eta \langle \frac { \eta _ { 0 } \kappa \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \| x ( s ) - x ^ { * } ( | s ) \| } \\ & { \quad = \epsilon ( | L \eta \langle \frac { \eta _ { 0 } \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \| x ( s ) - x ^ { * } ( | s ) \| } \\ & { \quad = \epsilon ( | L \eta \langle \frac { \eta _ { 0 } \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle } \| x ( s ) - x ^ { * } ( | s ) \| } \\ & \end{array}
288
+ $$
289
+
290
+ We next bound the second term:
291
+
292
+ $$
293
+ \begin{array} { r l } { \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ] \leq \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \Big ] } & { } \\ & { \leq \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \frac { \operatorname* { m i n } _ { a \in A } \operatorname { V a r } _ { \pi _ { i } \sim \Pi _ { \mathrm { E } } } \big [ \pi _ { i } ( a | s ) \big ] } { \beta ( \mathcal { U } ) } \Big ] } \\ & { = \displaystyle \frac { 1 } { \beta ( \mathcal { U } ) } \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \sum _ { a \in A } \pi ( a | s ) \operatorname { V a r } _ { \pi _ { i } \sim \Pi _ { \mathrm { E } } } \big [ \pi _ { i } ( a | s ) \big ] \Big ] } \\ & { = \displaystyle \frac { 1 } { \beta ( \mathcal { U } ) } \sum _ { s \notin \mathcal { U } } d _ { \pi } ( s ) \sum _ { a \in \mathcal { A } } \pi ( a | s ) \operatorname { V a r } _ { \pi _ { i } \sim \Pi _ { \mathrm { E } } } \big [ \pi _ { i } ( a | s ) \big ] } \end{array}
294
+ $$
295
+
296
+ Now observe we can decompose the RL cost as follows:
297
+
298
+ $$
299
+ \begin{array} { r l } & { J _ { \mathrm { U } } ( \boldsymbol { \pi } ) = \mathbb { E } _ { s \sim d _ { \boldsymbol { \pi } } , a \sim \boldsymbol { \pi } ( \cdot \vert s ) } \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } \\ & { \qquad = \displaystyle \sum _ { s } d _ { \boldsymbol { \pi } } ( s ) \sum _ { a } \pi ( a \vert s ) \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } \\ & { \qquad = \displaystyle \sum _ { s \in U } d _ { \boldsymbol { \pi } } ( s ) \sum _ { a } \pi ( a \vert s ) \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } \\ & { \qquad = \underbrace { \sum _ { s \in U } d _ { \boldsymbol { \pi } } ( s ) \sum _ { a } \pi ( a \vert s \vert ) \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } _ { B ( \boldsymbol { \pi } ) } + \underbrace { \sum _ { s \neq l } d _ { \boldsymbol { \pi } } ( s ) \sum _ { a } \pi ( a \vert s ) \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } _ { A ( \boldsymbol { \pi } ) } } \end{array}
300
+ $$
301
+
302
+ Putting these together, we get the following:
303
+
304
+ $$
305
+ \begin{array} { r l } { J _ { \mathrm { c s p } } ( \pi ) \le \alpha ( \mathcal { U } ) J _ { \mathrm { R C } } ( \pi ) + \displaystyle \frac { 1 } { \beta ( \mathcal { U } ) } A ( \pi ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \alpha ( \mathcal { U } ) \beta ( \mathcal { U } ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \alpha ( \mathcal { U } ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{array}
306
+ $$
307
+
308
+ Here we have used the fact that β(U ) ≤ 1 since 0 ≤ π(a|s) ≤ 1 and α(U ) ≥ sups∈U d?π(s)d?π(s) hence $\begin{array} { r } { \frac { 1 } { \alpha ( \mathcal { U } ) } \le 1 } \end{array}$ . Taking the minimum over subsets $\mathcal { U } \subseteq \mathcal { S }$ , we get $J _ { \mathrm { e x p } } ( \pi ) \le \kappa J _ { \mathrm { a l g } } ( \pi )$ .
309
+
310
+ Lemma 2. $\begin{array} { r } { \operatorname* { m i n } _ { \pi \in \Pi } J _ { \mathrm { a l g } } ( \pi ) \le 2 \epsilon } \end{array}$
311
+
312
+ Proof. Plugging the optimal policy into $J _ { \mathrm { a l g } }$ , we get:
313
+
314
+ $$
315
+ \begin{array} { r l } { J _ { \mathrm { B E } } ( \pi ^ { * } ) = J _ { \mathrm { B C } } ( \pi ^ { * } ) + J _ { \mathrm { U } } ( \pi ^ { * } ) } \\ & { \qquad = 0 + \mathbb { E } _ { s \sim \mathcal { A } _ { s } , \pi \sim \pi ^ { * } ( \cdot ) s } \Big [ \mathrm { V a r } _ { \pi _ { s } \sim \Pi _ { \pi } } \big [ \pi _ { s } ( a | s ) \big ] \Big ] } \\ & { \qquad = \mathbb { E } _ { s \sim d _ { \pi ^ { * } } , a \sim \pi ^ { * } ( \cdot ) s } \Big [ \displaystyle \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \Big ( \pi _ { s } ( a | s ) - \pi _ { i } ( a | s ) \Big ) ^ { 2 } \Big ] } \\ & { \qquad \le \mathbb { E } _ { s \sim d _ { \pi ^ { * } } , a \sim \pi ^ { * } ( \cdot ) s } \Big [ \displaystyle \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \Big ( \pi _ { i } ( a | s ) - \pi ^ { * } ( a | s ) \Big ) ^ { 2 } + \Big ( \pi ( a | s ) - \pi ^ { * } ( a | s ) \Big ) ^ { 2 } \Big ] } \\ & { \qquad = \underbrace { \mathbb { E } _ { s \sim d _ { \pi ^ { * } } , a \sim \pi ^ { * } ( \cdot ) s } } _ { \texttt { D e r m i l } } \Big [ \displaystyle \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \Big ( \pi _ { i } ( a | s ) - \pi ^ { * } ( a | s ) \Big ) ^ { 2 } \Big ] + \underbrace { \mathbb { E } _ { s \sim d _ { \pi ^ { * } } , a \sim \pi ^ { * } ( \cdot ) s } } _ { \texttt { T e m m 2 } } \Big ( \Big | \Big ( \pi ( a | s ) - \pi ^ { * } ( a | s ) \Big ) \Big ) } \end{array}
316
+ $$
317
+
318
+ We will first bound Term 1:
319
+
320
+ $$
321
+ \begin{array} { r l } { \displaystyle \sum _ { k \to \alpha < \alpha , \nu \to \nu + \nu + 1 ; \nu } [ \displaystyle \frac { 1 } { E } \sum _ { i = 1 } ^ { E } ( \pi _ { i } ( \alpha | \boldsymbol s ) - \pi ^ { * } ( \alpha | \boldsymbol s ) ) ^ { 2 } ] = \frac { 1 } { E } \mathbb { E } _ { \alpha \to \alpha , \nu } \Bigg [ \sum _ { \alpha \in A } \boldsymbol s ^ { \star } ( \alpha | \boldsymbol s ) \sum _ { \nu = 1 } ^ { E } \Bigg ( \alpha _ { 1 } ( \alpha | \boldsymbol s ) - \pi ^ { * } ( \alpha | \boldsymbol s ) \Bigg ) ^ { 2 } } & { } \\ & { \leq \frac { 1 } { E } \mathbb { E } _ { \alpha \to \alpha , \nu } \Bigg [ \sum _ { \alpha \in A } \boldsymbol s \Bigg ( \alpha | \boldsymbol s \rangle \sum _ { \nu = 1 } ^ { E } \Big | \alpha ( \boldsymbol s | \boldsymbol s ) - \pi ^ { * } ( \alpha | \boldsymbol s ) \Big | \Bigg ] } \\ & { \leq \frac { 1 } { E } \mathbb { E } _ { \alpha \to \alpha , \nu } \Bigg [ \displaystyle \sum _ { \alpha \in B \times \alpha } \Bigg [ \sum _ { \alpha \in A \times \alpha } \Bigg ] ^ { E } \pi _ { i } ( \alpha | \boldsymbol s ) - \pi ^ { * } ( \alpha | \boldsymbol s ) \Bigg ] \Bigg ] } \\ & { \leq \frac { 1 } { E } \frac { E } { E } \sum _ { \alpha \to \alpha , \nu \to \nu + 1 } \Bigg [ \displaystyle \frac { 1 } { E } \sum _ { \alpha \in B \times \alpha } \Bigg [ | \boldsymbol s | \boldsymbol s \rangle - \pi ^ { * } ( \alpha | \boldsymbol s ) \Big | \Bigg ] } \\ & { \leq \frac { 1 } { E } \displaystyle \sum _ { \alpha \to \alpha , \nu \to \nu + 1 } ^ { E } [ | \overline { { \alpha } } _ { 1 } ( \boldsymbol s | \boldsymbol s ) - \pi ^ { * } ( | \boldsymbol s | \boldsymbol s | ] ] } \\ & { \leq \frac { 1 } { E } \displaystyle \sum _ { \alpha \to \alpha } ^ { E } \exp ( \sum _ { \alpha \in B \times \alpha } \Bigg [ \exp ( \alpha | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s ) - \pi ^ { * } ( | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s ) | \Bigg ] } \\ & { \leq \frac { 1 } { E } \displaystyle \sum _ { \alpha \to \infty } ^ { E } \mathrm { e } } \\ & { = \varepsilon } \end{array}
322
+ $$
323
+
324
+ We will next bound Term 2:
325
+
326
+ $$
327
+ \begin{array} { r l } { \exp _ { \tau } \left( \tau \mathrm { d } \boldsymbol { \theta } \right) } & \leq \exp _ { \tau } \left( \tau \mathrm { d } \boldsymbol { \theta } \right) , \quad \forall \mathrm { d } \boldsymbol { \theta } \right) \} \left\{ \sum _ { j = 1 , \ldots , N - 1 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) \right\} ^ { \frac { 1 } { N } } \\ & { = \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad k = \frac { N } { N } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , } \\ & { = \sum _ { k = 0 } ^ { N } \exp _ { \tau } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad k = \frac { N } { N } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , } \\ & { = \sum _ { k = 0 } ^ { N } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , } \\ & { \leq \sum _ { k = 0 } ^ { N } \exp _ { \tau } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , } \\ & { = \sum _ { k = 0 } ^ { N } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad \mathrm { ~ a ~ n ~ d ~ } \mathrm { ~ N ~ o ~ s i g h ~ } \mathrm { ~ } } \\ & { = \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad \mathrm { ~ a ~ n ~ d ~ } \mathrm { ~ N ~ o ~ s i g h ~ } \mathrm { ~ H ~ } } \\ & \leq \frac { 1 } { N } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol \ \end{array}
328
+ $$
329
+
330
+ The last step follows from our optimization oracle assumption: $\begin{array} { r } { 0 \leq \operatorname* { m i n } _ { \pi \in \Pi } J _ { \mathrm { B C } } ( \pi ) \leq J _ { \mathrm { B C } } ( \pi ^ { \star } ) = } \end{array}$ 0, hence $J _ { \mathrm { B C } } ( \pi _ { i } ) \le 0 + \epsilon = \epsilon$ . Combining the bounds on the two terms, we get $J _ { \mathrm { a l g } } ( \pi ^ { \star } ) \leq 2 \epsilon$ . Since $\pi ^ { \star } \in \Pi$ , the result follows.
331
+
332
+ Theorem 1. Let $\hat { \pi }$ be the result of minimizing $J _ { \mathrm { a l g } }$ using our optimization oracle, and assume that $Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , a ) - Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , \pi ^ { \star } ) \leq u$ for all $a \in \mathcal { A } , t \in \{ 1 , 2 , . . . , T \} , d _ { \pi } ^ { t } ( s ) > 0 ,$ . Then $\hat { \pi }$ satisfies $J ( \hat { \pi } ) \le J ( \pi ^ { \star } ) + 3 u \kappa \epsilon T$ .
333
+
334
+ Proof. By our optimization oracle and Lemma 2, we have
335
+
336
+ $$
337
+ \begin{array} { r l } & { J _ { \mathrm { a l g } } ( \hat { \pi } ) \leq \displaystyle \operatorname* { m i n } _ { \pi \in \Pi } J _ { \mathrm { a l g } } ( \pi ) + \epsilon } \\ & { \qquad \leq 2 \epsilon + \epsilon } \\ & { \qquad = 3 \epsilon } \end{array}
338
+ $$
339
+
340
+ Combining with Lemma 1, we get:
341
+
342
+ $$
343
+ \begin{array} { l } { { J _ { \mathrm { e x p } } ( \hat { \pi } ) \leq \kappa J _ { \mathrm { a l g } } ( \hat { \pi } ) } } \\ { { \leq 3 \kappa \epsilon } } \end{array}
344
+ $$
345
+
346
+ Applying Theorem 1 from (Ross et al., 2011), we get $J ( \hat { \pi } ) \le J ( \pi ^ { \star } ) + 3 u \kappa \epsilon T$ .
347
+
348
+ # B IMPORTANCE OF BEHAVIOR CLONING COST
349
+
350
+ The following example shows how minimizing the uncertainty cost alone without the BC cost can lead to highly sub-optimal policies if the demonstration data is generated by a stochastic policy which is only slightly suboptimal. Consider the following deterministic chain MDP:
351
+
352
+ $$
353
+ a _ { 0 } \underbrace \sum _ { \left( { \begin{array} { l } { s _ { 0 } } \end{array} } \right) } ^ { a _ { 1 } } { \overbrace { \left( s _ { 1 } \right) } ^ { a _ { 1 } } } _ { a _ { 0 } } ^ { a _ { 1 } } { \overbrace { \left( s _ { 2 } \right) } ^ { a _ { 1 } } } _ { a _ { 0 } } ^ { a _ { 1 } } { \overbrace { \left( s _ { 2 } \right) } ^ { a _ { 1 } } { \overbrace { \left( s _ { 3 } \right) } ^ { a _ { 2 } } } ^ { a _ { 1 } } } _ { a _ { 0 } } ^ { a _ { 1 } }
354
+ $$
355
+
356
+ The agent always starts in $s _ { 1 }$ , and gets a reward of 1 in $s _ { 3 }$ and 0 elsewhere. The optimal policy is given by:
357
+
358
+ $$
359
+ \begin{array} { r } { \pi ^ { \star } ( \cdot | s _ { 0 } ) = ( 0 , 1 ) } \\ { \pi ^ { \star } ( \cdot | s _ { 1 } ) = ( 0 , 1 ) } \\ { \pi ^ { \star } ( \cdot | s _ { 2 } ) = ( 0 , 1 ) } \\ { \pi ^ { \star } ( \cdot | s _ { 3 } ) = ( 0 , 1 ) } \end{array}
360
+ $$
361
+
362
+ Assume the demonstration data is generated by the following policy, which is only slightly suboptimal:
363
+
364
+ $$
365
+ \begin{array} { r l } & { \pi _ { \mathrm { d e m o } } ( \cdot | s _ { 0 } ) = ( 0 , 1 ) } \\ & { \pi _ { \mathrm { d e m o } } ( \cdot | s _ { 1 } ) = ( 0 , 1 ) } \\ & { \pi _ { \mathrm { d e m o } } ( \cdot | s _ { 2 } ) = ( 0 . 1 , 0 . 9 ) } \\ & { \pi _ { \mathrm { d e m o } } ( \cdot | s _ { 3 } ) = ( 0 , 1 ) } \end{array}
366
+ $$
367
+
368
+ Let us assume realizability and perfect optimization for simplicity. If both transitions $( s _ { 2 } , a _ { 0 } )$ and $( s _ { 2 } , a _ { 1 } )$ appear in the demonstration data, then Random Expert Distillation (RED) will assign zero cost to both transitions. If we do not use bootstrapped samples to train the ensemble, then DRIL without the BC cost (we will call this UO-DRIL for Uncertainty-Only DRIL) will also assign zero cost to both transitions since all models in the ensemble would recover the Bayes optimal solution given the demonstration data. If we are using bootstrapped samples, then the Bayes optimal solution for each bootstrapped sample may differ and thus the different policies in the ensemble might disagree in their predictions, although given enough demonstration data we would expect these differences (and thus the uncertainty cost) to be small.
369
+
370
+ Note also that since no samples at the state $s _ { 0 }$ occur in the demonstration data, both RED and UODRIL will likely assign high uncertainty costs to state-action pairs at $( s _ { 0 } , a _ { 0 } ) , ( s _ { 0 } , a _ { 1 } )$ and thus avoid highly suboptimal policies which get stuck at $s _ { 0 }$ .
371
+
372
+ Now consider policies $\hat { \pi } _ { 1 } , \hat { \pi } _ { 2 }$ given by:
373
+
374
+ $$
375
+ \begin{array} { r } { \hat { \pi } _ { 1 } ( \cdot | s _ { 0 } ) = ( 0 , 1 ) } \\ { \hat { \pi } _ { 1 } ( \cdot | s _ { 1 } ) = ( 0 , 1 ) } \\ { \hat { \pi } _ { 1 } ( \cdot | s _ { 2 } ) = ( 1 , 0 ) } \\ { \hat { \pi } _ { 1 } ( \cdot | s _ { 3 } ) = ( 0 , 1 ) } \end{array}
376
+ $$
377
+
378
+ and
379
+
380
+ $$
381
+ \begin{array} { r l } & { \hat { \pi } _ { 2 } ( \cdot | s _ { 0 } ) = ( 0 , 1 ) } \\ & { \hat { \pi } _ { 2 } ( \cdot | s _ { 1 } ) = ( 0 , 1 ) } \\ & { \hat { \pi } _ { 2 } ( \cdot | s _ { 2 } ) = ( 0 . 2 , 0 . 8 ) } \\ & { \hat { \pi } _ { 2 } ( \cdot | s _ { 3 } ) = ( 0 , 1 ) } \end{array}
382
+ $$
383
+
384
+ Both of these policies only visit state-action pairs which are visited by the demonstration policy. In the case described above, both RED and UO-DRIL will assign $\hat { \pi } _ { 1 }$ and $\hat { \boldsymbol { \pi } } _ { 2 }$ similarly low costs. However, $\hat { \pi } _ { 1 }$ will cycle forever between $s _ { 1 }$ and $s _ { 2 }$ , never collecting reward, while $\hat { \boldsymbol { \pi } } _ { 2 }$ will with high probability reach $s _ { 3 }$ and stay there, thus achieving high reward. This shows that minimizing the uncertainty cost alone does not necessarily distinguish between good and bad policies. However, $\hat { \pi } _ { 1 }$ will incur a higher BC cost than $\hat { \boldsymbol { \pi } } _ { 2 }$ , since $\hat { \boldsymbol { \pi } } _ { 2 }$ more closely matches the demonstration data at $s _ { 2 }$ . This shows that including the BC cost can be important for further disambiguating between policies which all stay within the distribution of the demonstration data, but have different behavior within that distribution.
385
+
386
+ # C EXPERIMENTAL DETAILS
387
+
388
+ # C.1 ATARI ENVIRONMENTS
389
+
390
+ All behavior cloning models were trained to minimize the negative log-likelihood classification loss on the demonstration data for 500 epochs using Adam (Kingma & Ba, 2014) and a learning rate of $2 . 5 \cdot 1 0 ^ { - 4 }$ . We stopped training once the validation error did not improve for 20 epochs. For our method, we initially performed a hyperparameter search on Space Invaders over the values shown in Table 1
391
+
392
+ Table 1: Hyperparameters for DRIL
393
+
394
+ <table><tr><td>Hyperparameter</td><td>Values Considered</td><td>Final Value</td></tr><tr><td>Policy Learning rate</td><td>2.5:10-2,2.5:10 -3,2.5:10-4</td><td>2.5:10-3</td></tr><tr><td>Quantile cutoff</td><td>0.8, 0.9, 0.95, 0.98</td><td>0.98</td></tr><tr><td>Number of supervised updates</td><td>1,5</td><td>1</td></tr><tr><td>Number of policies in ensemble</td><td>5</td><td>5</td></tr><tr><td>Gradient clipping</td><td>0.1</td><td>0.1</td></tr><tr><td>Entropy coefficient</td><td>0.01</td><td>0.01</td></tr><tr><td>Value loss coeffcient</td><td>0.5</td><td>0.5</td></tr><tr><td>Number of steps</td><td>128</td><td>128</td></tr><tr><td>Parallel Environments</td><td>16</td><td>16</td></tr></table>
395
+
396
+ We then chose the best values and kept those hyperparameters fixed for all other environments. All other A2C hyperparameters follow the default values in the repo (Kostrikov, 2018): policy networks consisted of 3-layer convolutional networks with $8 - 3 2 - 6 4 $ feature maps followed by a single-layer MLP with 512 hidden units.
397
+
398
+ For GAIL, we used the implementation in (Kostrikov, 2018) and replaced the MLP discriminator by a CNN discriminator with the same architecture as the policy network. We initially performed a hyperparameter search on Breakout with 10 demonstrations over the values shown in Table 2. However, we did not find any hyperparameter configuration which performed better than behavioral cloning.
399
+
400
+ Table 2: Hyperparameters for GAIL
401
+
402
+ <table><tr><td>Hyperparameter</td><td>Values Considered</td><td>Final Value</td></tr><tr><td>Policy Learning rate</td><td>2.5· 10-2,2.5· 10-3,2.5·10-4</td><td>2.5:10-3</td></tr><tr><td>Discriminator Learning rate</td><td>2.5 : 10-2,2.5 : 10-3,2.5· 10-4</td><td>2.5 : 10-3</td></tr><tr><td>Number of discriminator updates</td><td>1,5,10</td><td>5</td></tr><tr><td>Gradient clipping</td><td>0.1</td><td>0.1</td></tr><tr><td>Entropy coefficient</td><td>0.01</td><td>0.01</td></tr><tr><td>Value loss coefficient</td><td>0.5</td><td>0.5</td></tr><tr><td>Number of steps</td><td>128</td><td>128</td></tr><tr><td>Parallel Environments</td><td>16</td><td>16</td></tr></table>
403
+
404
+ # C.2 CONTINUOUS CONTROL
405
+
406
+ All behavior cloning and ensemble models were trained to minimize the mean-squared error regression loss on the demonstration data for 500 epochs using Adam (Kingma & Ba, 2014) and a learning rate of $2 . 5 \cdot 1 0 ^ { - 4 }$ . Policy networks were 2-layer fully-connected MLPs with tanh activations and 64 hidden units.
407
+
408
+ Table 3: Hyperparameters (our method)
409
+
410
+ <table><tr><td>Hyperparameter</td><td>Values Considered</td><td>Final Value</td></tr><tr><td>Policy Learning rate</td><td>2.5·10-3,2.5.10-4,1·10-4,5:10-5</td><td>2.5:10-5</td></tr><tr><td>Quantile cutoff</td><td>0.98</td><td>0.98</td></tr><tr><td>Number of supervised updates</td><td>1</td><td>1</td></tr><tr><td>Number of policies in ensemble</td><td>5</td><td>5</td></tr><tr><td>Gradient clipping</td><td>0.1</td><td>0.1</td></tr><tr><td>Entropy coefficient</td><td>0.01</td><td>0.01</td></tr><tr><td>Value loss coefficient</td><td>0.5</td><td>0.5</td></tr><tr><td>Number of steps</td><td>128</td><td>128</td></tr><tr><td>Parallel Environments</td><td>16</td><td>16</td></tr></table>
411
+
412
+ # D ABLATION EXPERIMENTS
413
+
414
+ In this section we provide ablation experiments examining the effects of the cost function clipping and the role of the BC loss. We also compare the ensemble approach to a dropout-based approximation and show that DRIL works well in both cases.
415
+
416
+ Table 4: Ablation Experiments with 3 expert trajectories
417
+
418
+ <table><tr><td>Environment</td><td>SpaceInvaders</td><td>Breakout</td><td>BeamRider</td></tr><tr><td>DRIL (ensemble)</td><td>555.7</td><td>286.7</td><td>2033.4</td></tr><tr><td>DRIL (dropout)</td><td>581.4</td><td>205.4</td><td>2124.5</td></tr><tr><td>DRIL (raw cost)</td><td>421.8</td><td>70.9</td><td>1265.5</td></tr><tr><td>DRIL (no BC cost)</td><td>102.1</td><td>78.3</td><td>538.4</td></tr><tr><td>BC</td><td>257.0</td><td>2.7</td><td>689.7</td></tr></table>
419
+
420
+ Results are shown in Figure 4. First, switching from the clipped cost in $\{ - 1 , + 1 \}$ to the the raw cost causes a drop in performance. One explanation may be that since the raw costs are always positive (which corresponds to a reward which is always negative), the agent may learn to terminate the episode early in order to minimize the total cost incurred. Using a cost/reward which has both positive and negative values avoids this behavior.
421
+
422
+ Second, optimizing the pure BC cost performs better than the pure uncertainty cost for some environments (SpaceInvaders, BeamRider) while optimizing the pure uncertainty cost performs better than BC in Breakout. DRIL, which optimizes both, has robust performance and performs the best over all environments.
423
+
424
+ For the dropout approximation we trained a single policy network with a dropout rate of 0.1 applied to all layers except the last, and estimated the variance for each state-action pair using 5 different dropout masks. Similarly to the ensemble approach, we computed the $9 8 ^ { \mathrm { t h } }$ quantile of the variance on the demonstration data and used this value in our clipped cost. MC-dropout performs similarly to the ensembling approach, which shows that our method can be paired with different approaches to posterior estimation.
parse/train/rkgbYyHtwB/rkgbYyHtwB_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/rkgbYyHtwB/rkgbYyHtwB_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/rkgbYyHtwB/rkgbYyHtwB_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/zOngaSKrElL/zOngaSKrElL.md ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Self-Supervised Bug Detection and Repair
2
+
3
+ Miltiadis Allamanis, Henry Jackson-Flux∗, Marc Brockschmidt Microsoft Research, Cambridge, UK {miallama, mabrocks}@microsoft.com
4
+
5
+ # Abstract
6
+
7
+ Machine learning-based program analyses have recently shown the promise of integrating formal and probabilistic reasoning towards aiding software development. However, in the absence of large annotated corpora, training these analyses is challenging. Towards addressing this, we present BUGLAB, an approach for selfsupervised learning of bug detection and repair. BUGLAB co-trains two models: (1) a detector model that learns to detect and repair bugs in code, (2) a selector model that learns to create buggy code for the detector to use as training data. A Python implementation of BUGLAB improves by up to $30 \%$ upon baseline methods on a test dataset of 2374 real-life bugs and finds 19 previously unknown bugs in open-source software.
8
+
9
+ # 1 Introduction
10
+
11
+ Detecting and repairing bugs in source code requires strong reasoning skills over formal structures (e.g. data and control flow) and ambiguous information (e.g. identifier names, coding idioms, and comments). Traditional program analyses are able to detect critical bugs through formal reasoning and combinatorial search, but need to be manually coded by experts. That is a lengthy and costly process, which misses the opportunity to use ambiguous information pervasive within code.
12
+
13
+ Towards broadening the applicability of such methods, and utilizing ambiguous information, deep learning-based bug detection methods are being investigated [22, 3, 13]. These methods have the potential to further improve the engineering of software we rely on every day. However, many challenges in the area remain open, such as creating robust bug detection and repair methods that cover a wide range of common bugs in the absence of large supervised training corpora. Existing work focuses on randomly inserted bugs [22, 13], Cloze test proxy tasks [3], corpora of small code edits that may contain bugs [9] or build errors [28]. All these approaches rely on datasets of very limited size or ones known not to be representative of the characteristics of bugs found in real code.
14
+
15
+ In this work, we propose BUGLAB, a self-supervised approach that trains robust bug detectors by co-training a bug selector that learns to create hard-to-detect bugs (Sec. 2). For example, for a given code snippet with two well-named variables, a variable misuse bug may be easy to detect and repair, whereas an incorrect comparison operator might be significantly harder to identify. We propose a neural architecture for BUGLAB (Sec. 3) and implement it for Python (Sec. 4). Our implementation considers four broad classes of seemingly simple, yet hard-to-detect bugs and shows improved performance over training with randomly-inserted bugs on PYPIBUGS, a new, manually curated test set of 2374 real-life bugs (Sec. 5). Furthermore, we tested our trained models on popular open-source Python packages and identified 19 previously unreported bugs, though false positive rates of $\sim 9 8 \%$ remain impractical. We hope that creating machine learning methods that can detect these bugs early and assist developers will speed up software development and allow engineers to deliver more robust software. We release PyPIBugs and our code at https://github.com/ microsoft/neurips21-self-supervised-bug-detection-and-repair.
16
+
17
+ # 2 Self-Supervised Bug Detection
18
+
19
+ In this section, we first introduce the concept of code rewriting, and then use it to define BUGLAB as a framework for self-supervised learning of bug detection and repair.
20
+
21
+ Code Rewriting Rewriting is common within compilers and their optimizations, test-driven searchbased bug repair tools, mutation testing, and refactoring tools. Rewrites can be semantics-preserving (e.g. renamings of local variables), or semantics-altering (e.g. replacing $> = \log ~ ! = )$ .
22
+
23
+ Let $s$ denote the set of all syntax trees (not necessarily rooted in the start symbol of the language grammar). Syntax tree locations $\ell \in \{ \epsilon \} \cup \mathbb { N } ^ { * }$ in a syntax tree $\mathrm { s } \in { \mathcal { S } }$ are recursively defined, where $\mathrm { s } _ { \vert \epsilon } = \mathrm { s }$ and $\mathrm { s } _ { | \ell }$ for $\ell = \ell ^ { \prime } \circ i$ is the $i$ -th child of $\mathrm { s } _ { \vert \ell ^ { \prime } }$ (i.e. s|(2,3) denotes the third child of the second child of s). We define a rewrite rule $\rho = ( \mathrm { m } _ { \rho } , \mathrm { t } _ { \rho } )$ as a pair of a matching function $\operatorname { m } _ { \rho } : S \{ t r u e , f a l s e \}$ and a transformation function $\mathrm { t } _ { \rho } : { \mathcal { S } } { \mathcal { S } }$ . The matching function $\mathrm { m } _ { \rho } ( \mathrm { s } )$ yields true iff the rule $\rho$ is applicable at the root of a subtree s. The transformation function can be applied to obtain a transformed syntax tree. For convenience, we define $\mathrm { t } _ { \rho } ( \mathrm { s } ) = \mathrm { s }$ iff $\mathrm { m } _ { \rho } ( \mathrm { s } ) = f a l s e$ . We then write $\rho ( \mathrm { s } )$ to indicate the modification of a syntax tree s using $\rho$ when possible, and otherwise the identity function. For reversible rewrite rules $\rho$ , we denote the inverse rule as $\rho ^ { - 1 }$ such that $\rho ^ { - 1 } ( \rho ( \mathrm { s } ) ) = \mathbf { \dot { s } }$ holds. We discuss concrete rewrite rules $\rho$ in Sec. 4.
24
+
25
+ Given a set of rewrite rules $\mathcal { R }$ we define the set of “potential rewrites” in a syntax tree s as $R _ { \mathrm { s } } ^ { \mathcal { R } } =$ $\{ \langle \ell , \rho \rangle \mid \rho \in { \mathcal { R } } , \ell$ location in s, $, \mathbf { m } _ { \rho } ( \mathbf { s } _ { | \ell } ) = t r u e \}$ . For each tuple $\langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } }$ , we use $\mathrm { s } ^ { \prime } = \mathrm { s } [ \rho ] \varrho$ to denote the new syntax tree obtained by applying $\rho$ at location $\ell$ of s. In BUGLAB, we train models that use rewrites from $R _ { \mathrm { s } } ^ { \mathcal { R } }$ to insert and repair bugs. We will discuss such neural models in Sec. 3.
26
+
27
+ BUGLAB In BUGLAB, we are interested in selfsupervised training of a robust bug detector model $D _ { \theta }$ with parameters $\theta$ on an unannotated codebase $C$ . Let $\mathcal { R }$ be a set of rewrite rules2 that allows to insert and repair bugs. We train $D _ { \theta }$ to be able to recognize the “hardest” possible rewrites that could be applied on our codebase $C$ For this, we consider the loss $\mathcal { L } _ { D _ { \theta } }$ of $D _ { \theta }$ on a rewritten code snippet $\mathrm { s } [ \rho ] _ { \ell }$ , for which the model needs to predict the repairing rewrite $\langle \ell , \rho ^ { - 1 } \rangle$ . Formally, we want to minimize the objective
28
+
29
+ $$
30
+ E _ { \mathrm { s } \sim C } \left[ \operatorname* { m a x } _ { \langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } } } \mathcal { L } _ { D _ { \theta } } \left( \mathrm { s } [ \rho ] _ { \ell } , \left. \ell , \rho ^ { - 1 } \right. \right) \right] .
31
+ $$
32
+
33
+ ![](images/6a90afa1a44c13ced3e725f045bc326e6741157b1e8e404cd0b3127444e41f05.jpg)
34
+ Figure 1: BUGLAB overview: a selector model $S _ { \phi }$ decides which (bugintroducing) rewrite to apply to an input code snippet. Then a bug detector $D _ { \theta }$ tries to locate and repair the inserted bug (if one was inserted).
35
+
36
+ However, for any useful detector the set of rewrites $R _ { \mathrm { s } } ^ { \mathcal { R } }$ is commonly very large or unbounded and computing the maximum over all $\langle \bar { \ell , } \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } }$ is practically intractable. To address this, BUGLAB introduces a bug selector model $S _ { \phi }$ (with parameters $\phi _ { , }$ ), whose goal is to approximate the intractable $\mathrm { m a x } _ { \langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } } } \mathcal { L } _ { D _ { \theta } } \left( \cdot \right)$ . We can then sample rewrites from $S _ { \phi }$ instead of computing the maximum. We denote this as $\langle \ell , \rho \rangle \sim S _ { \phi } ( s )$ and the overall BUGLAB training objective can be written as a min-max optimization problem:
37
+
38
+ $$
39
+ \operatorname* { m a x } _ { \phi } \operatorname* { m i n } _ { \theta } E _ { \mathrm { s } \sim C } \left[ E _ { \langle \ell , \rho \rangle \sim S _ { \phi } ( \mathrm { s } ) } \left[ \mathcal { L } _ { D _ { \theta } } \left( \mathrm { s } [ \rho ] _ { \ell } , \langle \ell , \rho ^ { - 1 } \rangle \right) \right] \right] .
40
+ $$
41
+
42
+ The two models $S$ and $D$ in BUGLAB are “symmetric” in the sense that they both predict rewrites on code snippets, and only differ in their objectives — one aiming to introduce bugs and one aiming to repair them. In practice, we can and do use the same architecture to model both $S$ and $D$ , which we will discuss in the next section. At test time, we discard $S$ and only use the trained detector $D$ to locate and repair bugs.
43
+
44
+ # 3 Neural Models
45
+
46
+ In this section, we discuss how we represent code in BUGLAB and the neural models we use to learn how to rewrite code in the selector and detector models.
47
+
48
+ Code Representation We consider source code as a set of entities $v _ { i } ~ \in ~ V$ which relate to each other with a set of typed relations $e _ { k } \in E$ , where a relation $e _ { k } = ( v _ { i } , r , v _ { j } )$ denotes a relationship between entities $v _ { i }$ and $v _ { j }$ with type $r$ . The entities and relations can be thought as a heterogeneous graph $G = ( V , E )$ . The choice of code entities and their relationships is a form of high-level feature extraction. We discuss concrete entities and relationships for Python in Sec. 4. We also define a projection function $\mathbb { P } _ { t o k }$ that accepts $V$ and $E$ and returns a sequence $V _ { t o k }$ of the token entities in $V$ with the nodes appearing in relations in $E$ deterministically mapped to elements of $V _ { t o k }$ , i.e. $E _ { t o k } = \{ ( p ( v _ { i } ) , r , p ( \hat { v _ { j } } ) ) \}$ , where $p$ maps the entities in $V$ to $V _ { t o k } . \mathbb { P } _ { t o k }$ will be used for relational transformer models.
49
+
50
+ To learn a neural representation of the code entities $v _ { i }$ , first we define an embedding function $e ( v _ { i } )$ which maps the content of each entity to an initial $D$ -dimensional representation. Throughout this work — similar to Allamanis et al. [4] and other previous work — we deterministically split the string representation of each node into subtokens (e.g., fooBar is split into foo and bar), embed them through a learned embedding matrix, and use max pooling to get a single vector. We then “contextualize” the entity representations within $G$ using one of two models: a MLP-based GNN model with max message aggregation and the GREAT relational transformer of Hellendoorn et al. [13] over the token sequence and relations $V _ { t o k } , E _ { t o k } = \mathbb { P } _ { t o k } ( V , E )$ . GREAT uses both positional encodings and the projected relations in $E _ { t o k }$ . See Appx. A for detailed architecture descriptions. Other models to compute entity representations can be used, but were not explored in this work.
51
+
52
+ We use $\mathbfit { \Delta } \mathbf { r } _ { \ell }$ to denote the computed vector representation of the entity at location $\ell$ , independent of the model used to produce it. We use these representations to define our code rewriting models.
53
+
54
+ Probabilistic Code Rewriting Models Both bug selection and bug detection require to model the probability of applying a specific rewrite at a location in a code snippet s, either to introduce or repair a bug. For this, we factorize this task into localization and rewrite-given-location models, i.e.
55
+
56
+ $$
57
+ p \left( \langle \ell , \rho \rangle \mid \mathrm { s } , R _ { \mathrm { s } } ^ { \mathcal { R } } \right) = p _ { l o c } { \big ( } \ell \mid \mathrm { s } , R _ { \mathrm { s } } ^ { \mathcal { R } } { \big ) } p _ { r e w } { \big ( } \rho \mid \ell , \mathrm { s } , R _ { \mathrm { s } } ^ { \mathcal { R } } { \big ) } .
58
+ $$
59
+
60
+ We model $p _ { l o c }$ as a probability distribution over the relevant locations $\{ \ell \mid \langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } } \} \cup \{ \mathrm { N o B U G } \}$ , where NoBug is a special location used to indicate that the code is not buggy. In practice, we implement this similar to a pointer net [19] using the representations $\mathbfit { \Delta } \mathbf { r } _ { \ell }$ (see Appx. A for details).
61
+
62
+ To select rewrites, we use rewrite type-specific learnable rule score functions $w _ { \rho } \left( r _ { \ell } , \mathcal { M } _ { \rho } ( \mathrm { s } , \ell ) \right)$ . This function maps a vector representation of an entity $\mathbf { \Delta } _ { \mathbf { \lambda } ^ { \mathbf { r } } \ell }$ and potential additional metadata onto a scalar score. The rule-specific metadata $\mathcal { M } _ { \rho } ( \mathrm { s } , \ell )$ is defined for some rewrites, e.g. containing representations of other entities that could be used in the location $\ell$ . We will discuss three concrete rule score functions in Sec. 4. The rewrite probability distribution $p _ { r e w }$ is then modeled by a softmax over the scores of all applicable rewrites at a target location $\ell$ , i.e.
63
+
64
+ $$
65
+ p _ { r e w } \left( \rho \mid \ell , \mathbf { s } , R _ { \mathbf { s } } ^ { \mathcal { R } } \right) = \operatorname * { s o f t m a x } _ { \langle \ell , \rho ^ { \prime } \rangle \in R _ { \mathbf { s } } ^ { \mathcal { R } } } \left( w _ { \rho ^ { \prime } } \left( r _ { \ell } , \mathcal { M } _ { \rho ^ { \prime } } ( \mathbf { s } , \ell ) \right) \right) .
66
+ $$
67
+
68
+ # 4 A Python Implementation
69
+
70
+ This section presents an implementation of BUGLAB for Python called PYBUGLAB. PYBUGLAB currently tackles a large subset of “stupid simple bugs” [16]. Fixing these bugs requires small changes to the code, but commonly has significant impact on code correctness. Such bugs may be thought as a form of a typographical mistake or a copy-paste error, and are often relatively hard to locate by humans but obvious after the fact. They are also quite common, as observed in the empirical statistics of Karampatsis and Sutton [16] and Just et al. [14]. Future work may focus on a broader set of rewrite rules or even learnable rewrites, but as we will observe in Sec. 5 more work is needed towards this. Almost all ideas in PYBUGLAB transfer straightforwardly to other programming languages other than Python, but would require some engineering effort to implement.
71
+
72
+ PYBUGLAB Code Entities and Relations In this work, we follow related literature (see Sec. 6 for more) and extract entities and relationships that are readily available by tokenizers, parsers, existing simple program analyses, or other Python-specific program analysis tools. The complete list of entities and relationships can be found in Appx. B and include syntactic entities and relations, relations about the intraprocedural data and control flow, types, and documentation. Some notable entities include SyntaxNodes, Tokens, and Symbols (references to variables and functions). Fig. 4 in Appx. B shows a graph of the entities and relationships of the snippet in Fig. 2.
73
+
74
+ ![](images/6fa04aa00a25535c0128e4a64746beb8ef02776ba155a61e8b37f97000e3c308.jpg)
75
+ Figure 2: Code snippet and rewrites available to PYBUGLAB.
76
+
77
+ # 4.1 Bug-Inducing PYBUGLAB Rewrite Rules
78
+
79
+ PYBUGLAB focuses on four common kinds of bugs. Fig. 2 shows a code snippet and the rewrites allowed for each location, which number 63 even for this small example.
80
+
81
+ Variable Misuse Originally defined by Allamanis et al. [3] as a Cloze test for source code, Vasic et al. [30] and Hellendoorn et al. [13] reformulated the task to localizing a variable misuse bug (if any) within a snippet and repairing it. PYBUGLAB uses the latter representation. Variable misuse bugs are common, with $1 2 . 8 \AA - 1 4 . 8 \%$ found in the ManySStuBs4J corpus [16] and about $6 \%$ of them caught during Java compilation in the Google build system [28]. To insert and repair variable misuse bugs, PYBUGLAB supports variable-swapping rewrites, such as in locations $l _ { 1 }$ , $l _ { 3 }$ and $l _ { 4 }$ (amongst others) in Fig. 2. To score a variable-swapping rewrite, we use the representation of the rewrite location $\mathbfit { \Delta } \mathbf { r } _ { \ell }$ along with the representation $\mathbf { \Delta } _ { r _ { \sigma } }$ of a variable Symbol $\sigma$ that could replace the current variable, i.e. is in-scope and has been defined before $\ell$ . The rule score function $w _ { \rho }$ for replacing the variable at $\ell$ with the symbol $\sigma$ is then computed as the inner product $\boldsymbol { r } _ { \ell } ^ { \top } \boldsymbol { r } _ { \sigma }$ .
82
+
83
+ Argument Swapping (or Argument Selection) First coined by Rice et al. [26], it refers to swapping the arguments of a function invocation, e.g. in $l _ { 6 }$ of Fig. 2. Rice et al. [26] and DeepBugs [22] tackled this problem when all arguments are single identifiers. PYBUGLAB extends this to swapping arbitrary argument expressions. The rule score function $w _ { \rho }$ for an argument swapping rewrite is a two-layer MLP applied to the concatenation of the output representations of the representation of the parameter and the to-be-swapped arguments arg1, and arg2: MLP $\left( [ r _ { \mathrm { p a r a m s } } , r _ { \mathrm { a r g 1 } } , r _ { \mathrm { a r g 2 } } ] \right)$ .
84
+
85
+ Wrong Operator Corrupting operators has a long history in mutation testing [14]. Detecting incorrect operators with deep learning was first tackled by DeepBugs [22] by using learnable embeddings of operators, operands and literals for arithmetic and comparison operators. DeepBugs focused only on binary operators. In PYBUGLAB we tackle all binary operators, including Boolean, arithmetic and comparison operators and two unary operators: logical and arithmetic negation. Locations $l _ { 1 1 }$ , $l _ { 1 4 }$ , $l _ { 1 6 }$ , and $l _ { 2 0 }$ in Fig. 2 are rewrites related to wrong operators. The rule score function $w _ { \rho }$ for an operator rewrite again uses an inner product, $\boldsymbol { r } _ { \ell } ^ { \top } \boldsymbol { r } _ { \mathtt { \diamond p } }$ , where $\pmb { r } _ { \tt o p }$ is a learned embedding for operator op. Note that we rewrite operators only to compatible operators (e.g. $<$ to $>$ but not $^ +$ ).
86
+
87
+ Wrong Literal Corrupting operands, and specifically, literals appearing in the source code, is also a common strategy in mutation testing. As in mutation testing, PYBUGLAB handles a limited number of commonly used literals, allowing rewrites to replace integer literals within the set of $- 2 , - 1 , 0 , 1 , 2$ and swapping the Boolean literal True with False and vice versa. The scoring function is identical to the operator rewrite, using a learnable embedding ${ \bf { r } } _ { \mathrm { { 1 i t } } }$ for each literal lit.
88
+
89
+ # 4.2 PYBUGLAB Rewrite Rules for Data Augmentation
90
+
91
+ We additionally consider more rewrite rules that are not meant to change the program semantics, using them as a form of data augmentation. This is in spirit similar to ideas in computer vision where images are transformed (e.g. rotated, cropped) but maintain their original content. Such rewrites
92
+
93
+ Require: Code dataset $C$ , initial detector/selector model parameters $\theta ^ { ( 0 ) }$ , $\phi ^ { ( 0 ) }$
94
+
95
+ 1: for meta-epoch $i = 0$ to $I$ do
96
+ 2: // Create dataset of buggy programs:
97
+ 3: $C _ { D } ^ { ( i ) } \gets \left\{ \left( \mathrm { s } [ \rho ] _ { \ell } , \left. \ell , \rho ^ { - 1 } \right. \right) \mid \mathrm { s } \in C , k \mathrm { \ s a m p l e s \ } \left. \ell , \rho \right. \sim S _ { \phi ^ { ( i ) } } ( \mathrm { s } ) \right\}$
98
+ 4: $\theta ^ { ( i + 1 ) } $ update $\theta ^ { ( i ) }$ by training $D$ on $C _ { D } ^ { ( i ) }$
99
+ 5: // Create dataset of hard-to-detect bugs:
100
+ 6: $\begin{array} { r } { C _ { S } ^ { ( i ) } \gets \left\{ \left( \mathrm { s } , \mathrm { a r g } \operatorname* { m a x } _ { \langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } } } \left( \mathcal { L } _ { D _ { \theta ^ { ( i + 1 ) } } } \left( \mathrm { s } [ \rho ] _ { \ell } , \langle \ell , \rho ^ { - 1 } \rangle \right) \right) \right) \mid \mathrm { s } \in C \right\} } \end{array}$
101
+ 7: $\phi ^ { ( i + 1 ) } $ update $\phi ^ { ( i ) }$ by training $S$ on $C _ { S } ^ { ( i ) }$
102
+
103
+ have been shown to yield adversarially robust models of code [23]. Although our goal is not to provide adversarial robustness, we believe that such rewrites can help generalization. PYBUGLAB implements the following rewrites for this purpose:
104
+
105
+ • Variable Renaming renames a local variable to a random name not already in scope. • Comment Deletion removes code comments, including docstrings and inline comments. Such comments commonly contain natural language information that is useful for code comprehension, but usually do not affect program semantics. • Comparison Expression Mirroring swaps the two sides of a comparison operator and changes it appropriately. For example, $\mathtt { a } < \mathtt { b }$ is transformed to $\mathtt { b } > \mathtt { a }$ . Note that in cases such as $\mathbf { f } \circ \circ ( ) \ < \ \mathsf { b a r } ( )$ , this will change the order of execution of foo and bar, possibly altering program semantics. • If-Else Branch Swapping negates the test condition of an if-else statement or a ternary expressions using DeMorgan’s law and swaps the then body with the else body.
106
+
107
+ # 4.3 Implementation Details
108
+
109
+ To make the training computationally tractable we approximate Eq. 1. A simplified, sequential version of our training procedure is shown in Alg. 1. Intuitively, we alternate between training the two models, as the (discrete) sampling of rewrite rules in the selector models precludes direct endto-end training. We first use the current state of the selector model to generate “hard” samples and train the detector model on these samples (we always include the unmodified (i.e., NoBug case) as a sample). Then, we use the loss of the detector model to identify those generated samples that were hardest to detect and train the selector model to produce such samples.
110
+
111
+ In practice, we implemented the training procedure as a system of asynchronously communi$C _ { D / S } ^ { ( 0 ) } , \bar { C } _ { D / S } ^ { ( 1 ) } , \dots$ , and all of the described steps happen in parallel. We do not use “generations”of datasets, but instead use two constantly updated “pools” of training data, one state of the corresponding data pool. We remove samples from the data pool once they have been sampled $\nu$ times for use in training, in spirit similar to replay buffers in reinforcement learning. In our experiments, $\nu$ was set to 4. We regularly (in separate, concurrent processes) take snapshots of the the current state of the $D$ and $S$ models to generate new elements that are updated to the data pools, matching the procedure described in Alg. 1. We approximate the arg max in line 6 by only considering the $k$ samples chosen in line 3 for each input program. During training of $S$ , we then mask out the unobserved choices before computing the loss.
112
+
113
+ # 5 Evaluation
114
+
115
+ We now discuss our new dataset and evaluate PYBUGLAB. We $\divideontimes$ . . . . . . . . . .highlight. . . . .key . . . . . . . .results.
116
+
117
+ Datasets To train PYBUGLAB we retrieve the 4k most downloaded packages in the Python package index (PyPI) and take $3 . 4 \mathrm { k }$ of them as training packages, using the rest for test purposes. During training, PYBUGLAB installs each package along with all its dependencies. Installing all the dependencies is important for extracting the entities and the relations beyond local syntactic ones (e.g. type inference, method resolution). For each file, PYBUGLAB checks if it is a duplicate of a file that has already been seen in the training following the method of Allamanis [1] and runs all the relevant program analyses to extract the entities and relationships in each function. When we use additional rewrites for data augmentation, these are applied at the input of the PYBUGLAB pipeline as a form of pre-processing. Following Alg. 1, the bug selector $S$ selects $k = 5$ bugs to introduce, rewrites the source code text, and then the program analyses extract the new entities and relationships for the rewritten code snippets. The initial and rewritten code snippets are then used to create the training data for the detector and selector models.
118
+
119
+ We use two testsets to measure performance. First, we create RANDOMBUGS, a testset of 761 445 snippets derived from functions from the $6 0 0 \mathrm { P y P I }$ test packages (not seen during training). For each function we find within these packages we add it to the dataset along with 9 rewritten functions with a randomly inserted bug. On average graphs have 260 nodes, 601 edges, 25 rewrite locations, and 130 possible rewrites. We also collect a testset of real bugs. Although we conjecture that, in practice, the vast majority of bugs like those discussed in Sec. 4.1 are fixed when developers locally test their software, a few of those slip and then are fixed across different revisions checked into a version control systems. We have crawled the accessible repositories of all $2 8 5 \mathrm { k }$ packages in the Python Package Index (PyPI), collected and manually filtered bugs captured by the rewrites from Sec. 4.1. $\divideontimes$ . . . . .This. . . . . .new . . . . . . . . .dataset, . . . . . . . . . . . . . . .PYPIBUGS,. . . . . . . . . .contains. . . . . . .2374 . . . . . . . . . . . . .real-world,. . . . . . .small . . . . . . .bugs. We describe the data collection process in detail in Appx. D. In addition, we consider PYPIBUGS-PostFix: the examples from PYPIBUGS after a bug was fixed - we believe these samples are very likely to not contain any bugs anymore. We publish the dataset at https://www.microsoft.com/en-us/download/103554 and include it in the supplementary material.
120
+
121
+ # 5.1 Quantitative Evaluation
122
+
123
+ Our first experiment aims to evaluate whether the BUGLAB training framework yields more precise bug detectors. We consider two model architectures, using either GNNs or the GREAT transformer to compute embeddings of code entities (architecture details and hyperparameter choices can be found in Appx. A). We use four different training strategies: “supervised” is training only a bug detector on a fixed dataset of 1 million functions from the $3 . 4 \mathrm { k }$ training packages with randomly inserted bugs. “Random Selector” refers to a variant of PYBUGLAB using a bug selector model that uniformly at random picks a rewrite to insert bugs. Finally, PYBUGLAB and PYBUGLAB $+ \mathrm { A u g }$ use our framework from Sec. 2, with the latter also using additional rewrites to augment our code corpus. For the fully supervised model, we train with early stopping over a validation set; the other models are trained for a fixed number of 300 epochs (with $2 0 0 \mathrm { k }$ training samples per epoch) for the bug detector3 and the last detector model is used for evaluation.
124
+
125
+ Table 1: Accuracies $( \% )$ for different training strategies and model architectures on RANDOMBUGS.
126
+
127
+ <table><tr><td rowspan="3"></td><td colspan="6">RANDOMBUGS</td></tr><tr><td></td><td>GNN</td><td></td><td></td><td>GREAT</td><td></td></tr><tr><td>Joint</td><td>Loc</td><td>Repair</td><td>Joint</td><td>Loc</td><td>Repair</td></tr><tr><td>Supervised</td><td>62.4</td><td>73.6</td><td>81.2</td><td>51.0</td><td>61.9</td><td>76.3</td></tr><tr><td>Random Selector</td><td>69.4</td><td>79.6</td><td>84.0</td><td>63.9</td><td>73.6</td><td>82.0</td></tr><tr><td>PYBUGLAB</td><td>69.6</td><td>80.4</td><td>84.2</td><td>64.0</td><td>74.3</td><td>82.3</td></tr><tr><td>PYBUGLAB +Aug</td><td>70.3</td><td>81.1</td><td>84.5</td><td>65.3</td><td>75.3</td><td>82.5</td></tr></table>
128
+
129
+ Effectiveness of BUGLAB Training We first consider the performance of different models on the synthetic RANDOMBUGS dataset. Tbl. 1 shows the accuracy of predicting a full bug repair correctly (“Joint”) and analogous to Eq. 2 break this up into a localization accuracy (“Loc”) of predicting the correct location (or NoBug for correct examples) and a repair accuracy (“Repair”) for selecting the correct rewrite given the buggy location.
130
+
131
+ We observe that $\divideontimes$ . . . . . . . . . . . . . . . . . . . . .BUGLAB-training. . . . . . .leads. . . .to . . . . . . .more. . . . . . . .robust. . . . . .bug . . . . . . . . . . .detectors. . . . . . . . . . . . .compared. . .to. . . . . . . .other methods .......... for both GNNs and GREAT. Random selector models — a form of data augmentation — improve performance over supervised methods but mostly on in-distribution RANDOMBUGS samples. As expected, $\divideontimes$ . . . . . . . . . . . . .augmenting. . . . .the . . . . . .code. . . . . . . . .dataset. . . . . . .helps . . . . . . . . . . . . . . . . .generalization, but does not make a substantial difference. Expanding the kinds of rewrites used to augment the data and learning to select them may improve performance in the future.
132
+
133
+ Table 2: Results for different training strategies and model architectures on PYPIBUGS.
134
+
135
+ <table><tr><td></td><td colspan="6">PYPIBUGS</td><td colspan="4">PYPIBUGS-PostFix</td></tr><tr><td></td><td colspan="3">GNN</td><td colspan="3">GREAT</td><td colspan="2">GNN</td><td colspan="2">GREAT</td></tr><tr><td></td><td>Joint</td><td>Loc</td><td>Repair</td><td>Joint</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Joint AUC</td><td>Loc</td><td>Joint AUC</td></tr><tr><td>Supervised</td><td>20.0</td><td>28.4</td><td>61.8</td><td>16.8</td><td>25.8</td><td>58.6</td><td>17.8</td><td>0.087</td><td>20.7</td><td>0.044</td></tr><tr><td>Random Selector</td><td>21.2</td><td>27.0</td><td>69.2</td><td>20.6</td><td>26.8</td><td>67.2</td><td>47.5</td><td>0.108</td><td>52.5</td><td>0.117</td></tr><tr><td>PYBUGLAB</td><td>24.2</td><td>31.3</td><td>70.7</td><td>24.0</td><td>32.8</td><td>67.9</td><td>32.9</td><td>0.160</td><td>28.6</td><td>0.140</td></tr><tr><td>PYBUGLAB +Aug</td><td>26.4</td><td>33.5</td><td>72.0</td><td>23.2</td><td>29.7</td><td>68.8</td><td>32.6</td><td>0.187</td><td>48.2</td><td>0.129</td></tr></table>
136
+
137
+ Table 3: Localization and Repair Accuracy $( \% )$ per bug kind for the PYBUGLAB +Aug model.
138
+
139
+ <table><tr><td rowspan="3">Bug Type</td><td colspan="4">RANDOMBUGS</td><td colspan="4">PYPIBUGS</td></tr><tr><td colspan="2">GNN</td><td colspan="2">GREAT</td><td colspan="2">GNN</td><td colspan="2">GREAT</td></tr><tr><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td></tr><tr><td>Argument Swapping</td><td>85.0</td><td>57.3</td><td>65.5</td><td>57.2</td><td>33.2</td><td>73.9</td><td>24.3</td><td>72.7</td></tr><tr><td>Wrong Assign Op</td><td>96.1</td><td>99.1</td><td>94.5</td><td>98.6</td><td>20.0</td><td>68.9</td><td>14.0</td><td>58.1</td></tr><tr><td>Wrong Binary Op</td><td>83.0</td><td>85.2</td><td>77.3</td><td>81.4</td><td>27.2</td><td>54.3</td><td>36.6</td><td>43.7</td></tr><tr><td>Wrong Boolean Op</td><td>71.8</td><td>99.5</td><td>43.6</td><td>99.5</td><td>27.6</td><td>96.9</td><td>15.7</td><td>97.2</td></tr><tr><td>Wrong Comparison Op</td><td>83.9</td><td>79.3</td><td>80.0</td><td>76.4</td><td>33.7</td><td>66.1</td><td>31.1</td><td>53.5</td></tr><tr><td>Wrong Literal</td><td>71.7</td><td>74.7</td><td>66.6</td><td>71.6</td><td>21.6</td><td>78.4</td><td>17.9</td><td>79.5</td></tr><tr><td>Variable Misuse</td><td>84.9</td><td>88.4</td><td>78.2</td><td>86.3</td><td>35.3</td><td>70.5</td><td>34.0</td><td>69.4</td></tr><tr><td>NoBUG</td><td>53.8</td><td></td><td>62.5</td><td></td><td></td><td></td><td></td><td></td></tr></table>
140
+
141
+ Furthermore, $\ast { \mathrm { l o u g } } .$ . . . . . . . . . . . . . .localization . . .is . . . . . . .much . . . . . . . .harder. . . . . .than . . . . . . . .repair . . .at . .a . . . . . . .given . . . . . . . . . .location. This is somewhat expected: there are many more candidate locations compared to potential repairs at a given location. However, this suggests that research should focus on the localization problem rather than repair.
142
+
143
+ We now turn to the results on PYPIBUGS, shown in Tbl. 2, which also includes the accuracy of choosing the special NoBug location on the PYPIBUGS-PostFix dataset, as well as the area under the precision recall curve for the results on both PYPIBUGS and PYPIBUGS-PostFix.
144
+
145
+ We find that $\divideontimes$ . . . . . . . . . .detecting. . . . .and. . . . . . . . . . . .repairing . . . . . . . . .real-life. . . . . . .bugs . .is. . . . . . . . . . . . . . .significantly. . . . . . . .harder. . . . . .than. . . . . . . . . . .handling . . . . . . . . . . . .randomly . . . . . . . . .inserted. . . . . .bugs. As PYBUGLAB models trained using a learned bug selector outperform those using a “Random Selector”, we speculate that the learned selector avoids generating easy-to-detect bugs, focusing the detector model on recognizing deeper semantic patterns. Despite this, improvements in RANDOMBUGS often correlate with improvements in PYPIBUGS. This is encouraging: collecting PYPIBUGS-like datasets is costly; corpora with random bugs can help measure relative improvements to some extent. Finally, we find that $\divideontimes$ . . . . . . . . . . . . . .recognizing . . . . . . . . . . . . .non-buggy . . . . . . . . . .samples. . .is . . . . . .very . . . . . .hard, and in particular, does not always profit from training in PYBUGLAB.
146
+
147
+ In our qualitative analysis (Sec. 5.2), we observed that the models raised some confident but incorrect warnings at very “odd” locations. However, these warnings were different across models. We have tested an ensembling strategy averaging the output probabilities of five separately trained GNN models. This results in localization and repair accuracies of $8 3 . 0 \%$ and $8 5 . 4 \%$ on RANDOMBUGS (vs. $8 1 . 1 \%$ and $8 4 . 5 \%$ ) and $3 4 . 4 \%$ and $7 2 . 2 \%$ on PYPIBUGS (vs. $3 3 . 5 \%$ and $7 2 . 0 \%$ ). As we discuss in Sec. 5.2 finding the cause of the “spurious” warnings is important future work.
148
+
149
+ Per-Bug Evaluation To better understand which bugs are hard to detect, we break down the results the best-performing PYBUGLAB $+ \mathrm { A u g }$ models on RANDOMBUGS by type of bug in Tbl. 3. We observe that incorrect literals are some of the hardest bugs to detect. Incorrect assignment operators $( e . g . = \mathrm { a n d } + = )$ ) are easy to detect in RANDOMBUGS, but significantly harder in PYPIBUGS. This may be attributed to class imbalance, with simple assignment $( = )$ being the majority class. $\divideontimes$ Detecting . . . . . . . . . . . . . .if .a. . . . . . . . .snippet. . . . .has . .a . . . . .bug . . .or . . . .not. . . . . . . .seems . . .to . . .be. . . .the. . . . . . . . .hardest. . . . . .task:. . . .no. . . . . . . .model . . . . . . . . . .achieves. . . . . . . . . . .accuracy. . . . . . . . .beyond. $6 3 \%$ .
150
+
151
+ We note that in our experiments, GNNs-based models seem to often outperform GREAT, somewhat contradicting the results of Hellendoorn et al. [13]. We have performed substantial additional experiments to investigate and verify these results, cf. Sec. A.2. This may have to do with the performance of these models on long sequences or that the GNN has access to more fine-grained information, instead of relations over the projected token sequences. For example, this could be attributed to the lack of syntax and symbol nodes in the representation used in GREAT. Nevertheless, GREAT is noticeably better ( $6 2 . 5 \%$ vs. $5 3 . 8 \%$ ) at detecting NoBug and locating wrong binary operators in PYPIBUGS.
152
+
153
+ Table 5: Bug distribution $( \% )$ in different datasets
154
+
155
+ <table><tr><td>Bug Kind</td><td>PYPIBUGS</td><td>RANDOMBUGS</td><td>Selector Samples</td></tr><tr><td>Argument Swapping</td><td>11.9</td><td>8.4</td><td>23.8</td></tr><tr><td>Wrong Assignment</td><td>1.9</td><td>8.5</td><td>5.3</td></tr><tr><td>Wrong Binary Operator</td><td>3.4</td><td>2.4</td><td>2.3</td></tr><tr><td>Wrong Boolean Operator</td><td>8.1</td><td>2.2</td><td>6.4</td></tr><tr><td>Wrong Comparison Operator</td><td>17.1</td><td>8.2</td><td>7.4</td></tr><tr><td>Wrong Literal</td><td>3.7</td><td>11.6</td><td>12.4</td></tr><tr><td>Variable Misuse</td><td>53.8</td><td>58.6</td><td>42.5</td></tr></table>
156
+
157
+ Bug Selector Performance To understand how training of the bug selector proceeds, we perform two experiments. In our first experiment, we take a snapshot of the selector model during training of the PYBUGLAB $+ \mathrm { A u g }$ (GNN) model every 24 hours, after an initial burn-in phase of 12 hours. We then generate 10000 buggy samples using each of these snapshots and then test a fixed model on each of these snapshots. The results of this are shown in Tbl. 4, using a fully trained PYBUGLAB $+ \mathrm { A u g }$ (GNN) model from another training run as a fixed model. We conclude that . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB succeeds. . . .in . . . . . . . . . .learning . . .to . . . . . . . . . .generate. . . . . . . .harder. . .to find ..........bugs, though we can observe the selector model trading off “harder-to-localize” and “harder-tofix” properties. Tests on other models show similar trends, confirming the robustness of this result.
158
+
159
+ Table 4: Development of Performance on Bug Selector Samples
160
+
161
+ <table><tr><td>Training&#x27; Time</td><td>Joint</td><td>Loc</td><td>Repair</td></tr><tr><td>0.5 days</td><td>64.2</td><td>83.8</td><td>72.1</td></tr><tr><td>1.5 days</td><td>62.5</td><td>80.7</td><td>72.9</td></tr><tr><td>2.5 days</td><td>62.0</td><td>83.0</td><td>69.8</td></tr><tr><td>3.5 days</td><td>61.7</td><td>82.5</td><td>69.8</td></tr><tr><td>4.5 days</td><td>61.9</td><td>83.0</td><td>69.5</td></tr><tr><td>5.5 days</td><td>61.1</td><td>83.0</td><td>68.6</td></tr><tr><td>6.5 days</td><td>60.5</td><td>78.7</td><td>72.4</td></tr></table>
162
+
163
+ In a second experiment, we compare the distribution of different bug kinds in PYPIBUGS and RANDOMBUGS with the distribution of bugs sampled from the final snapshot of our selector model from above. The results are shown in Tbl. 5, where we can see that a number of bugs (argument swapping, use of wrong literals and of assignment operators) are substantially over-represented, whereas mistakes in comparison operators and variable misuse are under-represented. This indicates that . . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB generates. . . . . .hard . . .to . . . . . .find, . . . .but. . . .not. . . . . . . . . . . . . .necessarily . . . . . . . . . .realistic . . . . . .bugs.
164
+
165
+ Comparison to CuBERT Finally, we compare our models to CuBERT [15], which uses a masked language modeling objective to pre-train a BERT-like model and then learns bug detectors specific to a class of bugs (e.g., wrong binary operators) on top of this pre-trained model. Note that CuBERT detects $i f$ a bug exists but does not localize it. For the comparison, we create two sub-datasets of PYPIBUGS: PYPIBUGS-WrongOp contains the 501 samples that involve the binary operators supported by CuBERT, and PYPIBUGS-VarMisuse, which contains the 1278 bugs that involve variable misuses. We complete both of these datasets with 501 (resp. 1278) random NoBug code samples from our RANDOMBUGS, to match the 1:1 buggy/non-buggy distribution used in CuBERT’s training. Since CuBERT classification models focus on a single bug type, to compare to PYBUGLAB we mask out all code locations that do not correspond to a bug that could be detected by the corresponding CuBERT model. We then treat the prediction of the NoBug location as a “non-buggy” prediction and all other locations as a “buggy” prediction. For example, for the snippet in Fig. 2, only the locations $l _ { 2 }$ , $l _ { 1 1 }$ , $l _ { 1 4 }$ , $l _ { 1 6 }$ , and $l _ { 2 0 }$ and their corresponding rewrites are considered by PYBUGLAB for the comparison on PYPIBUGS-WrongOp.
166
+
167
+ Tbl. 6 shows the results of comparing the released CuBERT snapshots with the PYBUGLAB +Aug GNN model. We observe that $\divideontimes$ . . . .the . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB models
168
+
169
+ Table 6: Comparison with CuBERT [15]
170
+
171
+ <table><tr><td rowspan="2"></td><td colspan="3">CuBERT</td><td colspan="3">PYBUGLAB (GNN)</td></tr><tr><td>Prec</td><td>Recall</td><td>F1</td><td>Prec</td><td>Recall</td><td>F1</td></tr><tr><td>PYPIBUGs-WrongOp</td><td>0.764</td><td>0.251</td><td>0.378</td><td>0.730</td><td>0.764</td><td>0.746</td></tr><tr><td>PYPIBUGS-VarMisuse</td><td>0.632</td><td>0.403</td><td>0.493</td><td>0.740</td><td>0.840</td><td>0.787</td></tr></table>
172
+
173
+ . . . . .have. . . . . . . . . . . . . . . .substantially . . . . . . .better. . . . . . .recall. . . . . .than. . . . . . . . . . . . . . . . . . .CuBERT-based . . . . . . . . .models, even though they were trained to detect more bug types. When calibrating the CuBERT models to have a recall equal to PYBUGLAB, heir precision drops substantially. In particular, on PYPIBUGS-WrongOp, it is reduced to 0.609, and
174
+
175
+ 1 def make_id(name):
176
+ 2 $\mathbf { r } \ =$ get_rand_string(12)
177
+ 3 if len(name) <= 22:
178
+ 4 name $=$ name[:22]
179
+ 5 return name $\textrm { + } \textrm { -- } \textrm { + } \textrm { \pmb { r } }$ (a) A wrong comparison operator bug (red box) in PYPIBUGS detected and repaired by the GNN PYBUGLAB +Aug models.
180
+
181
+ 1 def update(self, roomId,
182
+ 2 title, \*\*request_params):
183
+ 3 check_type(roomId, basestring)
184
+ 4 check_type(roomId, basestring)
185
+ 5 [...]
186
+
187
+ (b) A variable misuse (red box) caught in an open-source project. GNN PYBUGLAB $+ \mathrm { A u g }$ suggests to rewrite roomId to title. The fixing pull request is found here.
188
+
189
+ Figure 3: Bugs found by PYBUGLAB. Snippets reformatted and abbreviated to fit figure.
190
+
191
+ on PYPIBUGS-VarMisuse, it is reduced to 0.613; in both cases, PYBUGLAB outperforms CuBERT substantially.
192
+
193
+ # 5.2 Qualitative Inspection of Raised Warnings
194
+
195
+ We now take a qualitative look at the raised warnings raised by PYBUGLAB. As example, Fig. 3a shows a sample of PYPIBUGS where the developer used an incorrect comparison operator. Once pointed to it, it is clear to a human that the truncation statement in line 4 has no effect (under the reasonable assumption that name is a string), and that a different comparison operator $( > )$ is necessary.
196
+
197
+ To gain an understanding of the performance of PYBUGLAB on realistic data, we performed an indepth analysis of the cases flagged as bugs by our best-performing model on the code found within the 4k top PyPI packages. We observed a mixture of false positives with few previously unseen real-life bugs, matching the quantitative results in Tbl. 3. First, we find that the majority of the false positives are “incorrect literal” detections. This suggests that learning to detect such bugs is a hard problem. Furthermore, many literals serve as default “configurations” (e.g. the number of retries for a network request) and different values are not bugs. We posit that a large percentage of literal replacements the selector learns to make fall in this category.
198
+
199
+ We also found that some repairs suggested by the model actually produce semantically equivalent code. For example, the model lacks knowledge that two variables refer to the same object in memory (aliasing), and so attempts to “repair” variable misuse bugs by switching between these. Other examples includes checking the return values of standard functions such as Python’s str.find, which returns $^ { - 1 }$ if the query string is not found. In such cases, PYBUGLAB often suggested to rewrite an if $\mathbf { x } \lrcorner \mathbf { f i n d } ( \mathbf { y } ) \ \ll \ - 1$ to if $\mathbf { x } \lrcorner \mathbf { f i n d } ( \mathbf { y } ) \ = - 1$ , which makes no difference in practice. These false negatives can be attributed to the fact that the bug selector model considers such changes as introducing bugs, even though they are not actually changing behavior. This suggests that for better results, the rewrite rules need to ensure that the rewrites are not semantics-preserving and represent bugs.
200
+
201
+ Finally, some reported issues were sufficiently complex that it took us (the human authors) a couple of minutes of thought to conclude that a warning is spurious. Simultaneously, there are some warnings that are “obviously” incorrect to us, but the reasons why the neural models raise them is unclear. This highlights the importance of research on explainability techniques along with better ways to calibrate model confidence. The fact that selectors may introduce spurious “bugs” may also be affecting how the detector model learns. Ideas that have appeared in reinforcement learning, such as the one of Dennis et al. [8], may allow models to improve their performance in spite of spurious bugs.
202
+
203
+ Overall, $\yen 123,456,7$ . . .of. . . . .the . . . . . .1000. . . . . . . . . . .reported . . . . . . . . . . .warnings . . . . . .were. . . . . . . .found . . .to . . .be. . . . . . . . . .real-life. . . . . . .bugs. Of these 19, we reported 11 on GitHub (6 already merged, 5 pending approval). See Appx. G for details. 3 other bugs had already been fixed between the version PYBUGLAB processed and the current version or the project was deprecated, whereas another 5 bugs are minor and we decided not to report them. One of the detected bugs is shown in Fig. 3b. Overall, most of the detected bugs appear within unit tests, logging, or exception handling, possibly because bugs there do not impact the core functionality of a project. However, given the number of such bugs we collected in PYPIBUGS, we believe that such bugs arise equally often in other code, but that they are detected and fixed more quickly.
204
+
205
+ Although our analysis only forms a lower bound on the precision of PYBUGLAB and related methods, it suggests that there is still ample room for future improvements towards making machine learningbased bug detection and repair practically useful.
206
+
207
+ # 6 Related Work
208
+
209
+ Detecting bugs in source code has been researched since the early days of computing. Traditionally, bug detection is tackled as a formal task, where any code that cannot be proved to satisfy some correctness property may contain a bug. This is essential for security- and safety-critical bugs, but not for other — equally common — bugs. In the last decade, software engineering and programming language research have increasingly realized ambiguous information within code (e.g. variable names, comments) contains valuable information and using this information can yield valuable results [2]. The main premise is that patterns in source code, such as patterns in names, control, and data flow can be informative. This information can also be exploited to detect some bugs. For example, Ray et al. [24] noted that even simple language models tend to assign lower probability to buggy code.
210
+
211
+ Multiple static analysis methods have been researched that combine some form of data-oriented bug detection. This ranges from language model-based tools, such as the early work of Wang et al. [32] to specification-mining tools such as the work of Eberhardt et al. [10]. BUGLAB is related to DeepBugs [22] which uses an MLP over a limited window of code tokens and train separate models to detect wrong operators, operands, and argument swappings. BUGLAB opts for a more structured representation of code and a single model. Allamanis et al. [3], Vasic et al. [30], Hellendoorn et al. [13] tackle variable misuse bugs (one of the kinds of bugs included in PYBUGLAB) but either by randomly introducing the bugs in code or using a Cloze-like test. Instead, BUGLAB opts for a selfsupervised approach and tackles a broader range of bugs. Concurrently to this work, Patra and Pradel [21] showed an alternative method for learning to generate realistic bugs. Dinella et al. [9] learn a supervised sequential model that performs graph transformations that replicate small edits in code (refactoring, introducing functionality, bug fixing, etc.). Their model — Hoppity — could serve as a learnable rewrite operation in BUGLAB in future work. Dynamic analysis methods have also been researched with promising results [31], but collecting representative dynamic traces over a diverse set of programs at scale (e.g. from the top Python packages used in this work) is practically impossible.
212
+
213
+ BUGLAB is related to ideas around self-supervised learning recently explored in deep learning, computer vision, and NLP. In our case, we aim to train a bug detection model without using training data from real-life bugs. BUGLAB resembles ELECTRA [6], with the important difference that the rewrites to the input code go beyond single token replacement that need to respect strict constraints of programming languages (syntax, variable scopes) and the model is directly used for bug detection, rather than for pre-training. The main BUGLAB objective Eq. 1 also resembles GANs [12] with the exception that the objective is non-differentiable (introducing a bug alters the discrete data representation), the selector is a structured probabilistic code rewriting model, and that we are mainly interested in the bug detector (analogous to the discriminator) rather than the selector.
214
+
215
+ # 7 Discussion and Conclusions
216
+
217
+ Learned program analyses offer the promise to improve how we develop software. They also offer a great opportunity to study machine learning models that combine formal and probabilistic reasoning. Towards achieving these we presented BUGLAB, a self-supervised approach for learning program analyses, that improves upon baseline methods and detects bugs in real-life code. We also empirically show the limitations of existing bug-detecting machine learning methods, which suffer from impractical false-positive rates. Importantly, we show the large gap of performance of existing methods on corpora of randomly inserted bugs — commonly used in prior work — and real-life bugs.
218
+
219
+ # Acknowledgements
220
+
221
+ We want to thank Sebastian Nowozin and Marwin Segler for helpful discussions, Marwin Segler for comments on a draft of this work, and the anonymous reviewers for useful questions and suggestions. Finally, we would like to thank the contributors to the following open-source tools used: PyTorch [20], PyDriller [27], MessagePack, LibCST, Jedi, Kubernetes, Helm.
222
+
223
+ References
224
+ [1] M. Allamanis. The adverse effects of code duplication in machine learning models of code. In Proceedings of the 2019 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, pages 143–153, 2019.
225
+ [2] M. Allamanis, E. T. Barr, P. Devanbu, and C. Sutton. A survey of machine learning for big code and naturalness. ACM Computing Surveys (CSUR), 51(4):1–37, 2018.
226
+ [3] M. Allamanis, M. Brockschmidt, and M. Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations (ICLR), 2018.
227
+ [4] M. Allamanis, E. Barr, S. Ducousso, and Z. Gao. Typilus: Neural type hints. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 91–105. Association for Computing Machinery (ACM), 2020.
228
+ [5] T. Bachlechner, B. P. Majumder, H. H. Mao, G. W. Cottrell, and J. McAuley. Rezero is all you need: Fast convergence at large depth. arXiv preprint arXiv:2003.04887, 2020.
229
+ [6] K. Clark, M.-T. Luong, Q. V. Le, and C. D. Manning. ELECTRA: Pre-training text encoders as discriminators rather than generators. arXiv preprint arXiv:2003.10555, 2020.
230
+ [7] M. Cvitkovic, B. Singh, and A. Anandkumar. Deep learning on code with an unbounded vocabulary. In Machine Learning 4 Programming, 2018.
231
+ [8] M. Dennis, N. Jaques, E. Vinitsky, A. Bayen, S. Russell, A. Critch, and S. Levine. Emergent complexity and zero-shot transfer via unsupervised environment design. arXiv preprint arXiv:2012.02096, 2020.
232
+ [9] E. Dinella, H. Dai, Z. Li, M. Naik, L. Song, and K. Wang. Hoppity: Learning graph transformations to detect and fix bugs in programs. In International Conference on Learning Representations, 2019.
233
+ [10] J. Eberhardt, S. Steffen, V. Raychev, and M. Vechev. Unsupervised learning of API aliasing specifications. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 745–759, 2019.
234
+ [11] J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning, pages 1263–1272, 2017.
235
+ [12] I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial networks. arXiv preprint arXiv:1406.2661, 2014.
236
+ [13] V. J. Hellendoorn, C. Sutton, R. Singh, P. Maniatis, and D. Bieber. Global relational models of source code. In International Conference on Learning Representations, 2020.
237
+ [14] R. Just, D. Jalali, L. Inozemtseva, M. D. Ernst, R. Holmes, and G. Fraser. Are mutants a valid substitute for real faults in software testing? In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, pages 654–665, 2014.
238
+ [15] A. Kanade, P. Maniatis, G. Balakrishnan, and K. Shi. Learning and evaluating contextual embedding of source code. In International Conference on Machine Learning (ICML), 2020.
239
+ [16] R.-M. Karampatsis and C. Sutton. How often do single-statement bugs occur? the ManySStuBs4J dataset. In Proceedings of the 17th International Conference on Mining Software Repositories, pages 573–577, 2020.
240
+ [17] J. Katz. Libraries.io Open Source Repository and Dependency Metadata, Jan. 2020. URL https://doi.org/10.5281/zenodo.3626071.
241
+ [18] Y. Li, D. Tarlow, M. Brockschmidt, and R. Zemel. Gated graph sequence neural networks. In International Conference on Learning Representations (ICLR), 2016.
242
+
243
+ [19] S. Merity, C. Xiong, J. Bradbury, and R. Socher. Pointer sentinel mixture models. In International Conference on Learning Representations (ICLR), 2017.
244
+
245
+ [20] A. Paszke, S. Gross, S. Chintala, G. Chanan, E. Yang, Z. DeVito, Z. Lin, A. Desmaison, L. Antiga, and A. Lerer. Automatic differentiation in PyTorch. 2017.
246
+ [21] J. Patra and M. Pradel. Semantic bug seeding: a learning-based approach for creating realistic bugs. In Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pages 906–918, 2021.
247
+ [22] M. Pradel and K. Sen. DeepBugs: A learning approach to name-based bug detection. Proceedings of the ACM on Programming Languages, 2(OOPSLA):1–25, 2018.
248
+ [23] G. Ramakrishnan, J. Henkel, Z. Wang, A. Albarghouthi, S. Jha, and T. Reps. Semantic robustness of models of source code. arXiv preprint arXiv:2002.03043, 2020.
249
+ [24] B. Ray, V. Hellendoorn, S. Godhane, Z. Tu, A. Bacchelli, and P. Devanbu. On the ”naturalness” of buggy code. In 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE), pages 428–439. IEEE, 2016.
250
+ [25] V. Raychev, M. Vechev, and A. Krause. Predicting program properties from Big Code. In Principles of Programming Languages (POPL), 2015.
251
+ [26] A. Rice, E. Aftandilian, C. Jaspan, E. Johnston, M. Pradel, and Y. Arroyo-Paredes. Detecting argument selection defects. Proceedings of the ACM on Programming Languages, 1(OOPSLA): 1–22, 2017.
252
+ [27] D. Spadini, M. Aniche, and A. Bacchelli. PyDriller: Python framework for mining software repositories. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering - ESEC/FSE 2018, pages 908–911, New York, New York, USA, 2018. ACM Press. ISBN 9781450355735. doi: 10.1145/3236024.3264598. URL http://dl.acm.org/citation. cfm?doid $\equiv$ 3236024.3264598.
253
+ [28] D. Tarlow, S. Moitra, A. Rice, Z. Chen, P.-A. Manzagol, C. Sutton, and E. Aftandilian. Learning to fix build errors with Graph2Diff neural networks. In Proceedings of the IEEE/ACM 42nd International Conference on Software Engineering Workshops, pages 19–20, 2020.
254
+ [29] H. Touvron, M. Cord, A. Sablayrolles, G. Synnaeve, and H. Jegou. Going deeper with image ´ transformers. arXiv preprint arXiv:2103.17239, 2021.
255
+ [30] M. Vasic, A. Kanade, P. Maniatis, D. Bieber, and R. Singh. Neural program repair by jointly learning to localize and repair. arXiv preprint arXiv:1904.01720, 2019.
256
+ [31] K. Wang and Z. Su. Blended, precise semantic program embeddings. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 121–134, 2020.
257
+ [32] S. Wang, D. Chollak, D. Movshovitz-Attias, and L. Tan. Bugram: bug detection with n-gram language models. In Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, pages 708–719, 2016.
258
+ [33] J. Wei, M. Goyal, G. Durrett, and I. Dillig. LambdaNet: Probabilistic type inference using graph neural networks. arXiv preprint arXiv:2005.02161, 2020.
parse/train/zOngaSKrElL/zOngaSKrElL_content_list.json ADDED
@@ -0,0 +1,1185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Self-Supervised Bug Detection and Repair ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 240,
8
+ 122,
9
+ 756,
10
+ 148
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Miltiadis Allamanis, Henry Jackson-Flux∗, Marc Brockschmidt Microsoft Research, Cambridge, UK {miallama, mabrocks}@microsoft.com ",
17
+ "bbox": [
18
+ 281,
19
+ 200,
20
+ 717,
21
+ 243
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Abstract ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 462,
31
+ 279,
32
+ 535,
33
+ 295
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Machine learning-based program analyses have recently shown the promise of integrating formal and probabilistic reasoning towards aiding software development. However, in the absence of large annotated corpora, training these analyses is challenging. Towards addressing this, we present BUGLAB, an approach for selfsupervised learning of bug detection and repair. BUGLAB co-trains two models: (1) a detector model that learns to detect and repair bugs in code, (2) a selector model that learns to create buggy code for the detector to use as training data. A Python implementation of BUGLAB improves by up to $30 \\%$ upon baseline methods on a test dataset of 2374 real-life bugs and finds 19 previously unknown bugs in open-source software. ",
40
+ "bbox": [
41
+ 233,
42
+ 310,
43
+ 767,
44
+ 448
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 Introduction ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 174,
54
+ 473,
55
+ 310,
56
+ 491
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Detecting and repairing bugs in source code requires strong reasoning skills over formal structures (e.g. data and control flow) and ambiguous information (e.g. identifier names, coding idioms, and comments). Traditional program analyses are able to detect critical bugs through formal reasoning and combinatorial search, but need to be manually coded by experts. That is a lengthy and costly process, which misses the opportunity to use ambiguous information pervasive within code. ",
63
+ "bbox": [
64
+ 174,
65
+ 505,
66
+ 825,
67
+ 574
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Towards broadening the applicability of such methods, and utilizing ambiguous information, deep learning-based bug detection methods are being investigated [22, 3, 13]. These methods have the potential to further improve the engineering of software we rely on every day. However, many challenges in the area remain open, such as creating robust bug detection and repair methods that cover a wide range of common bugs in the absence of large supervised training corpora. Existing work focuses on randomly inserted bugs [22, 13], Cloze test proxy tasks [3], corpora of small code edits that may contain bugs [9] or build errors [28]. All these approaches rely on datasets of very limited size or ones known not to be representative of the characteristics of bugs found in real code. ",
74
+ "bbox": [
75
+ 174,
76
+ 580,
77
+ 825,
78
+ 691
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "In this work, we propose BUGLAB, a self-supervised approach that trains robust bug detectors by co-training a bug selector that learns to create hard-to-detect bugs (Sec. 2). For example, for a given code snippet with two well-named variables, a variable misuse bug may be easy to detect and repair, whereas an incorrect comparison operator might be significantly harder to identify. We propose a neural architecture for BUGLAB (Sec. 3) and implement it for Python (Sec. 4). Our implementation considers four broad classes of seemingly simple, yet hard-to-detect bugs and shows improved performance over training with randomly-inserted bugs on PYPIBUGS, a new, manually curated test set of 2374 real-life bugs (Sec. 5). Furthermore, we tested our trained models on popular open-source Python packages and identified 19 previously unreported bugs, though false positive rates of $\\sim 9 8 \\%$ remain impractical. We hope that creating machine learning methods that can detect these bugs early and assist developers will speed up software development and allow engineers to deliver more robust software. We release PyPIBugs and our code at https://github.com/ microsoft/neurips21-self-supervised-bug-detection-and-repair. ",
85
+ "bbox": [
86
+ 174,
87
+ 698,
88
+ 825,
89
+ 877
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "2 Self-Supervised Bug Detection ",
96
+ "text_level": 1,
97
+ "bbox": [
98
+ 174,
99
+ 89,
100
+ 457,
101
+ 107
102
+ ],
103
+ "page_idx": 1
104
+ },
105
+ {
106
+ "type": "text",
107
+ "text": "In this section, we first introduce the concept of code rewriting, and then use it to define BUGLAB as a framework for self-supervised learning of bug detection and repair. ",
108
+ "bbox": [
109
+ 174,
110
+ 123,
111
+ 825,
112
+ 151
113
+ ],
114
+ "page_idx": 1
115
+ },
116
+ {
117
+ "type": "text",
118
+ "text": "Code Rewriting Rewriting is common within compilers and their optimizations, test-driven searchbased bug repair tools, mutation testing, and refactoring tools. Rewrites can be semantics-preserving (e.g. renamings of local variables), or semantics-altering (e.g. replacing $> = \\log ~ ! = )$ . ",
119
+ "bbox": [
120
+ 174,
121
+ 170,
122
+ 826,
123
+ 212
124
+ ],
125
+ "page_idx": 1
126
+ },
127
+ {
128
+ "type": "text",
129
+ "text": "Let $s$ denote the set of all syntax trees (not necessarily rooted in the start symbol of the language grammar). Syntax tree locations $\\ell \\in \\{ \\epsilon \\} \\cup \\mathbb { N } ^ { * }$ in a syntax tree $\\mathrm { s } \\in { \\mathcal { S } }$ are recursively defined, where $\\mathrm { s } _ { \\vert \\epsilon } = \\mathrm { s }$ and $\\mathrm { s } _ { | \\ell }$ for $\\ell = \\ell ^ { \\prime } \\circ i$ is the $i$ -th child of $\\mathrm { s } _ { \\vert \\ell ^ { \\prime } }$ (i.e. s|(2,3) denotes the third child of the second child of s). We define a rewrite rule $\\rho = ( \\mathrm { m } _ { \\rho } , \\mathrm { t } _ { \\rho } )$ as a pair of a matching function $\\operatorname { m } _ { \\rho } : S \\{ t r u e , f a l s e \\}$ and a transformation function $\\mathrm { t } _ { \\rho } : { \\mathcal { S } } { \\mathcal { S } }$ . The matching function $\\mathrm { m } _ { \\rho } ( \\mathrm { s } )$ yields true iff the rule $\\rho$ is applicable at the root of a subtree s. The transformation function can be applied to obtain a transformed syntax tree. For convenience, we define $\\mathrm { t } _ { \\rho } ( \\mathrm { s } ) = \\mathrm { s }$ iff $\\mathrm { m } _ { \\rho } ( \\mathrm { s } ) = f a l s e$ . We then write $\\rho ( \\mathrm { s } )$ to indicate the modification of a syntax tree s using $\\rho$ when possible, and otherwise the identity function. For reversible rewrite rules $\\rho$ , we denote the inverse rule as $\\rho ^ { - 1 }$ such that $\\rho ^ { - 1 } ( \\rho ( \\mathrm { s } ) ) = \\mathbf { \\dot { s } }$ holds. We discuss concrete rewrite rules $\\rho$ in Sec. 4. ",
130
+ "bbox": [
131
+ 173,
132
+ 218,
133
+ 825,
134
+ 358
135
+ ],
136
+ "page_idx": 1
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "Given a set of rewrite rules $\\mathcal { R }$ we define the set of “potential rewrites” in a syntax tree s as $R _ { \\mathrm { s } } ^ { \\mathcal { R } } =$ $\\{ \\langle \\ell , \\rho \\rangle \\mid \\rho \\in { \\mathcal { R } } , \\ell$ location in s, $, \\mathbf { m } _ { \\rho } ( \\mathbf { s } _ { | \\ell } ) = t r u e \\}$ . For each tuple $\\langle \\ell , \\rho \\rangle \\in R _ { \\mathrm { s } } ^ { \\mathcal { R } }$ , we use $\\mathrm { s } ^ { \\prime } = \\mathrm { s } [ \\rho ] \\varrho$ to denote the new syntax tree obtained by applying $\\rho$ at location $\\ell$ of s. In BUGLAB, we train models that use rewrites from $R _ { \\mathrm { s } } ^ { \\mathcal { R } }$ to insert and repair bugs. We will discuss such neural models in Sec. 3. ",
141
+ "bbox": [
142
+ 173,
143
+ 364,
144
+ 825,
145
+ 422
146
+ ],
147
+ "page_idx": 1
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "BUGLAB In BUGLAB, we are interested in selfsupervised training of a robust bug detector model $D _ { \\theta }$ with parameters $\\theta$ on an unannotated codebase $C$ . Let $\\mathcal { R }$ be a set of rewrite rules2 that allows to insert and repair bugs. We train $D _ { \\theta }$ to be able to recognize the “hardest” possible rewrites that could be applied on our codebase $C$ For this, we consider the loss $\\mathcal { L } _ { D _ { \\theta } }$ of $D _ { \\theta }$ on a rewritten code snippet $\\mathrm { s } [ \\rho ] _ { \\ell }$ , for which the model needs to predict the repairing rewrite $\\langle \\ell , \\rho ^ { - 1 } \\rangle$ . Formally, we want to minimize the objective ",
152
+ "bbox": [
153
+ 173,
154
+ 440,
155
+ 550,
156
+ 580
157
+ ],
158
+ "page_idx": 1
159
+ },
160
+ {
161
+ "type": "equation",
162
+ "img_path": "images/597426b766af16b530c3086ca1c3bf9cfa4fa1541fefff8ff73eda53f624e93e.jpg",
163
+ "text": "$$\nE _ { \\mathrm { s } \\sim C } \\left[ \\operatorname* { m a x } _ { \\langle \\ell , \\rho \\rangle \\in R _ { \\mathrm { s } } ^ { \\mathcal { R } } } \\mathcal { L } _ { D _ { \\theta } } \\left( \\mathrm { s } [ \\rho ] _ { \\ell } , \\left. \\ell , \\rho ^ { - 1 } \\right. \\right) \\right] .\n$$",
164
+ "text_format": "latex",
165
+ "bbox": [
166
+ 228,
167
+ 590,
168
+ 495,
169
+ 626
170
+ ],
171
+ "page_idx": 1
172
+ },
173
+ {
174
+ "type": "image",
175
+ "img_path": "images/6a90afa1a44c13ced3e725f045bc326e6741157b1e8e404cd0b3127444e41f05.jpg",
176
+ "image_caption": [
177
+ "Figure 1: BUGLAB overview: a selector model $S _ { \\phi }$ decides which (bugintroducing) rewrite to apply to an input code snippet. Then a bug detector $D _ { \\theta }$ tries to locate and repair the inserted bug (if one was inserted). "
178
+ ],
179
+ "image_footnote": [],
180
+ "bbox": [
181
+ 563,
182
+ 434,
183
+ 823,
184
+ 618
185
+ ],
186
+ "page_idx": 1
187
+ },
188
+ {
189
+ "type": "text",
190
+ "text": "However, for any useful detector the set of rewrites $R _ { \\mathrm { s } } ^ { \\mathcal { R } }$ is commonly very large or unbounded and computing the maximum over all $\\langle \\bar { \\ell , } \\rho \\rangle \\in R _ { \\mathrm { s } } ^ { \\mathcal { R } }$ is practically intractable. To address this, BUGLAB introduces a bug selector model $S _ { \\phi }$ (with parameters $\\phi _ { , }$ ), whose goal is to approximate the intractable $\\mathrm { m a x } _ { \\langle \\ell , \\rho \\rangle \\in R _ { \\mathrm { s } } ^ { \\mathcal { R } } } \\mathcal { L } _ { D _ { \\theta } } \\left( \\cdot \\right)$ . We can then sample rewrites from $S _ { \\phi }$ instead of computing the maximum. We denote this as $\\langle \\ell , \\rho \\rangle \\sim S _ { \\phi } ( s )$ and the overall BUGLAB training objective can be written as a min-max optimization problem: ",
191
+ "bbox": [
192
+ 173,
193
+ 645,
194
+ 550,
195
+ 714
196
+ ],
197
+ "page_idx": 1
198
+ },
199
+ {
200
+ "type": "text",
201
+ "text": "",
202
+ "bbox": [
203
+ 176,
204
+ 714,
205
+ 825,
206
+ 757
207
+ ],
208
+ "page_idx": 1
209
+ },
210
+ {
211
+ "type": "equation",
212
+ "img_path": "images/e53606b879b4d2a39b079f53ba9fb551d00be5442d4142c61a4ee1789a5f3c7d.jpg",
213
+ "text": "$$\n\\operatorname* { m a x } _ { \\phi } \\operatorname* { m i n } _ { \\theta } E _ { \\mathrm { s } \\sim C } \\left[ E _ { \\langle \\ell , \\rho \\rangle \\sim S _ { \\phi } ( \\mathrm { s } ) } \\left[ \\mathcal { L } _ { D _ { \\theta } } \\left( \\mathrm { s } [ \\rho ] _ { \\ell } , \\langle \\ell , \\rho ^ { - 1 } \\rangle \\right) \\right] \\right] .\n$$",
214
+ "text_format": "latex",
215
+ "bbox": [
216
+ 315,
217
+ 767,
218
+ 681,
219
+ 792
220
+ ],
221
+ "page_idx": 1
222
+ },
223
+ {
224
+ "type": "text",
225
+ "text": "The two models $S$ and $D$ in BUGLAB are “symmetric” in the sense that they both predict rewrites on code snippets, and only differ in their objectives — one aiming to introduce bugs and one aiming to repair them. In practice, we can and do use the same architecture to model both $S$ and $D$ , which we will discuss in the next section. At test time, we discard $S$ and only use the trained detector $D$ to locate and repair bugs. ",
226
+ "bbox": [
227
+ 174,
228
+ 809,
229
+ 825,
230
+ 880
231
+ ],
232
+ "page_idx": 1
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "3 Neural Models ",
237
+ "text_level": 1,
238
+ "bbox": [
239
+ 174,
240
+ 89,
241
+ 328,
242
+ 106
243
+ ],
244
+ "page_idx": 2
245
+ },
246
+ {
247
+ "type": "text",
248
+ "text": "In this section, we discuss how we represent code in BUGLAB and the neural models we use to learn how to rewrite code in the selector and detector models. ",
249
+ "bbox": [
250
+ 174,
251
+ 121,
252
+ 823,
253
+ 148
254
+ ],
255
+ "page_idx": 2
256
+ },
257
+ {
258
+ "type": "text",
259
+ "text": "Code Representation We consider source code as a set of entities $v _ { i } ~ \\in ~ V$ which relate to each other with a set of typed relations $e _ { k } \\in E$ , where a relation $e _ { k } = ( v _ { i } , r , v _ { j } )$ denotes a relationship between entities $v _ { i }$ and $v _ { j }$ with type $r$ . The entities and relations can be thought as a heterogeneous graph $G = ( V , E )$ . The choice of code entities and their relationships is a form of high-level feature extraction. We discuss concrete entities and relationships for Python in Sec. 4. We also define a projection function $\\mathbb { P } _ { t o k }$ that accepts $V$ and $E$ and returns a sequence $V _ { t o k }$ of the token entities in $V$ with the nodes appearing in relations in $E$ deterministically mapped to elements of $V _ { t o k }$ , i.e. $E _ { t o k } = \\{ ( p ( v _ { i } ) , r , p ( \\hat { v _ { j } } ) ) \\}$ , where $p$ maps the entities in $V$ to $V _ { t o k } . \\mathbb { P } _ { t o k }$ will be used for relational transformer models. ",
260
+ "bbox": [
261
+ 173,
262
+ 154,
263
+ 825,
264
+ 280
265
+ ],
266
+ "page_idx": 2
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "To learn a neural representation of the code entities $v _ { i }$ , first we define an embedding function $e ( v _ { i } )$ which maps the content of each entity to an initial $D$ -dimensional representation. Throughout this work — similar to Allamanis et al. [4] and other previous work — we deterministically split the string representation of each node into subtokens (e.g., fooBar is split into foo and bar), embed them through a learned embedding matrix, and use max pooling to get a single vector. We then “contextualize” the entity representations within $G$ using one of two models: a MLP-based GNN model with max message aggregation and the GREAT relational transformer of Hellendoorn et al. [13] over the token sequence and relations $V _ { t o k } , E _ { t o k } = \\mathbb { P } _ { t o k } ( V , E )$ . GREAT uses both positional encodings and the projected relations in $E _ { t o k }$ . See Appx. A for detailed architecture descriptions. Other models to compute entity representations can be used, but were not explored in this work. ",
271
+ "bbox": [
272
+ 173,
273
+ 285,
274
+ 826,
275
+ 424
276
+ ],
277
+ "page_idx": 2
278
+ },
279
+ {
280
+ "type": "text",
281
+ "text": "We use $\\mathbfit { \\Delta } \\mathbf { r } _ { \\ell }$ to denote the computed vector representation of the entity at location $\\ell$ , independent of the model used to produce it. We use these representations to define our code rewriting models. ",
282
+ "bbox": [
283
+ 173,
284
+ 430,
285
+ 823,
286
+ 458
287
+ ],
288
+ "page_idx": 2
289
+ },
290
+ {
291
+ "type": "text",
292
+ "text": "Probabilistic Code Rewriting Models Both bug selection and bug detection require to model the probability of applying a specific rewrite at a location in a code snippet s, either to introduce or repair a bug. For this, we factorize this task into localization and rewrite-given-location models, i.e. ",
293
+ "bbox": [
294
+ 174,
295
+ 464,
296
+ 823,
297
+ 507
298
+ ],
299
+ "page_idx": 2
300
+ },
301
+ {
302
+ "type": "equation",
303
+ "img_path": "images/e13f1434c8e948af685abaf2f16c7854cbf7b41c33f14f6c15af31b5c452dc11.jpg",
304
+ "text": "$$\np \\left( \\langle \\ell , \\rho \\rangle \\mid \\mathrm { s } , R _ { \\mathrm { s } } ^ { \\mathcal { R } } \\right) = p _ { l o c } { \\big ( } \\ell \\mid \\mathrm { s } , R _ { \\mathrm { s } } ^ { \\mathcal { R } } { \\big ) } p _ { r e w } { \\big ( } \\rho \\mid \\ell , \\mathrm { s } , R _ { \\mathrm { s } } ^ { \\mathcal { R } } { \\big ) } .\n$$",
305
+ "text_format": "latex",
306
+ "bbox": [
307
+ 315,
308
+ 512,
309
+ 681,
310
+ 532
311
+ ],
312
+ "page_idx": 2
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "We model $p _ { l o c }$ as a probability distribution over the relevant locations $\\{ \\ell \\mid \\langle \\ell , \\rho \\rangle \\in R _ { \\mathrm { s } } ^ { \\mathcal { R } } \\} \\cup \\{ \\mathrm { N o B U G } \\}$ , where NoBug is a special location used to indicate that the code is not buggy. In practice, we implement this similar to a pointer net [19] using the representations $\\mathbfit { \\Delta } \\mathbf { r } _ { \\ell }$ (see Appx. A for details). ",
317
+ "bbox": [
318
+ 173,
319
+ 540,
320
+ 828,
321
+ 583
322
+ ],
323
+ "page_idx": 2
324
+ },
325
+ {
326
+ "type": "text",
327
+ "text": "To select rewrites, we use rewrite type-specific learnable rule score functions $w _ { \\rho } \\left( r _ { \\ell } , \\mathcal { M } _ { \\rho } ( \\mathrm { s } , \\ell ) \\right)$ . This function maps a vector representation of an entity $\\mathbf { \\Delta } _ { \\mathbf { \\lambda } ^ { \\mathbf { r } } \\ell }$ and potential additional metadata onto a scalar score. The rule-specific metadata $\\mathcal { M } _ { \\rho } ( \\mathrm { s } , \\ell )$ is defined for some rewrites, e.g. containing representations of other entities that could be used in the location $\\ell$ . We will discuss three concrete rule score functions in Sec. 4. The rewrite probability distribution $p _ { r e w }$ is then modeled by a softmax over the scores of all applicable rewrites at a target location $\\ell$ , i.e. ",
328
+ "bbox": [
329
+ 173,
330
+ 588,
331
+ 826,
332
+ 671
333
+ ],
334
+ "page_idx": 2
335
+ },
336
+ {
337
+ "type": "equation",
338
+ "img_path": "images/20ddd4085466fb2b98456820b56190ab15c90e6176666923f57291d6acdddecb.jpg",
339
+ "text": "$$\np _ { r e w } \\left( \\rho \\mid \\ell , \\mathbf { s } , R _ { \\mathbf { s } } ^ { \\mathcal { R } } \\right) = \\operatorname * { s o f t m a x } _ { \\langle \\ell , \\rho ^ { \\prime } \\rangle \\in R _ { \\mathbf { s } } ^ { \\mathcal { R } } } \\left( w _ { \\rho ^ { \\prime } } \\left( r _ { \\ell } , \\mathcal { M } _ { \\rho ^ { \\prime } } ( \\mathbf { s } , \\ell ) \\right) \\right) .\n$$",
340
+ "text_format": "latex",
341
+ "bbox": [
342
+ 320,
343
+ 678,
344
+ 678,
345
+ 704
346
+ ],
347
+ "page_idx": 2
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "4 A Python Implementation ",
352
+ "text_level": 1,
353
+ "bbox": [
354
+ 174,
355
+ 720,
356
+ 423,
357
+ 738
358
+ ],
359
+ "page_idx": 2
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "This section presents an implementation of BUGLAB for Python called PYBUGLAB. PYBUGLAB currently tackles a large subset of “stupid simple bugs” [16]. Fixing these bugs requires small changes to the code, but commonly has significant impact on code correctness. Such bugs may be thought as a form of a typographical mistake or a copy-paste error, and are often relatively hard to locate by humans but obvious after the fact. They are also quite common, as observed in the empirical statistics of Karampatsis and Sutton [16] and Just et al. [14]. Future work may focus on a broader set of rewrite rules or even learnable rewrites, but as we will observe in Sec. 5 more work is needed towards this. Almost all ideas in PYBUGLAB transfer straightforwardly to other programming languages other than Python, but would require some engineering effort to implement. ",
364
+ "bbox": [
365
+ 173,
366
+ 751,
367
+ 825,
368
+ 877
369
+ ],
370
+ "page_idx": 2
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "PYBUGLAB Code Entities and Relations In this work, we follow related literature (see Sec. 6 for more) and extract entities and relationships that are readily available by tokenizers, parsers, existing simple program analyses, or other Python-specific program analysis tools. The complete list of entities and relationships can be found in Appx. B and include syntactic entities and relations, relations about the intraprocedural data and control flow, types, and documentation. Some notable entities include SyntaxNodes, Tokens, and Symbols (references to variables and functions). Fig. 4 in Appx. B shows a graph of the entities and relationships of the snippet in Fig. 2. ",
375
+ "bbox": [
376
+ 173,
377
+ 882,
378
+ 821,
379
+ 911
380
+ ],
381
+ "page_idx": 2
382
+ },
383
+ {
384
+ "type": "image",
385
+ "img_path": "images/6fa04aa00a25535c0128e4a64746beb8ef02776ba155a61e8b37f97000e3c308.jpg",
386
+ "image_caption": [
387
+ "Figure 2: Code snippet and rewrites available to PYBUGLAB. "
388
+ ],
389
+ "image_footnote": [],
390
+ "bbox": [
391
+ 158,
392
+ 94,
393
+ 831,
394
+ 212
395
+ ],
396
+ "page_idx": 3
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "",
401
+ "bbox": [
402
+ 173,
403
+ 258,
404
+ 825,
405
+ 328
406
+ ],
407
+ "page_idx": 3
408
+ },
409
+ {
410
+ "type": "text",
411
+ "text": "4.1 Bug-Inducing PYBUGLAB Rewrite Rules ",
412
+ "text_level": 1,
413
+ "bbox": [
414
+ 173,
415
+ 343,
416
+ 501,
417
+ 358
418
+ ],
419
+ "page_idx": 3
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "PYBUGLAB focuses on four common kinds of bugs. Fig. 2 shows a code snippet and the rewrites allowed for each location, which number 63 even for this small example. ",
424
+ "bbox": [
425
+ 174,
426
+ 369,
427
+ 823,
428
+ 397
429
+ ],
430
+ "page_idx": 3
431
+ },
432
+ {
433
+ "type": "text",
434
+ "text": "Variable Misuse Originally defined by Allamanis et al. [3] as a Cloze test for source code, Vasic et al. [30] and Hellendoorn et al. [13] reformulated the task to localizing a variable misuse bug (if any) within a snippet and repairing it. PYBUGLAB uses the latter representation. Variable misuse bugs are common, with $1 2 . 8 \\AA - 1 4 . 8 \\%$ found in the ManySStuBs4J corpus [16] and about $6 \\%$ of them caught during Java compilation in the Google build system [28]. To insert and repair variable misuse bugs, PYBUGLAB supports variable-swapping rewrites, such as in locations $l _ { 1 }$ , $l _ { 3 }$ and $l _ { 4 }$ (amongst others) in Fig. 2. To score a variable-swapping rewrite, we use the representation of the rewrite location $\\mathbfit { \\Delta } \\mathbf { r } _ { \\ell }$ along with the representation $\\mathbf { \\Delta } _ { r _ { \\sigma } }$ of a variable Symbol $\\sigma$ that could replace the current variable, i.e. is in-scope and has been defined before $\\ell$ . The rule score function $w _ { \\rho }$ for replacing the variable at $\\ell$ with the symbol $\\sigma$ is then computed as the inner product $\\boldsymbol { r } _ { \\ell } ^ { \\top } \\boldsymbol { r } _ { \\sigma }$ . ",
435
+ "bbox": [
436
+ 173,
437
+ 404,
438
+ 826,
439
+ 544
440
+ ],
441
+ "page_idx": 3
442
+ },
443
+ {
444
+ "type": "text",
445
+ "text": "Argument Swapping (or Argument Selection) First coined by Rice et al. [26], it refers to swapping the arguments of a function invocation, e.g. in $l _ { 6 }$ of Fig. 2. Rice et al. [26] and DeepBugs [22] tackled this problem when all arguments are single identifiers. PYBUGLAB extends this to swapping arbitrary argument expressions. The rule score function $w _ { \\rho }$ for an argument swapping rewrite is a two-layer MLP applied to the concatenation of the output representations of the representation of the parameter and the to-be-swapped arguments arg1, and arg2: MLP $\\left( [ r _ { \\mathrm { p a r a m s } } , r _ { \\mathrm { a r g 1 } } , r _ { \\mathrm { a r g 2 } } ] \\right)$ . ",
446
+ "bbox": [
447
+ 173,
448
+ 550,
449
+ 825,
450
+ 635
451
+ ],
452
+ "page_idx": 3
453
+ },
454
+ {
455
+ "type": "text",
456
+ "text": "Wrong Operator Corrupting operators has a long history in mutation testing [14]. Detecting incorrect operators with deep learning was first tackled by DeepBugs [22] by using learnable embeddings of operators, operands and literals for arithmetic and comparison operators. DeepBugs focused only on binary operators. In PYBUGLAB we tackle all binary operators, including Boolean, arithmetic and comparison operators and two unary operators: logical and arithmetic negation. Locations $l _ { 1 1 }$ , $l _ { 1 4 }$ , $l _ { 1 6 }$ , and $l _ { 2 0 }$ in Fig. 2 are rewrites related to wrong operators. The rule score function $w _ { \\rho }$ for an operator rewrite again uses an inner product, $\\boldsymbol { r } _ { \\ell } ^ { \\top } \\boldsymbol { r } _ { \\mathtt { \\diamond p } }$ , where $\\pmb { r } _ { \\tt o p }$ is a learned embedding for operator op. Note that we rewrite operators only to compatible operators (e.g. $<$ to $>$ but not $^ +$ ). ",
457
+ "bbox": [
458
+ 173,
459
+ 640,
460
+ 825,
461
+ 752
462
+ ],
463
+ "page_idx": 3
464
+ },
465
+ {
466
+ "type": "text",
467
+ "text": "Wrong Literal Corrupting operands, and specifically, literals appearing in the source code, is also a common strategy in mutation testing. As in mutation testing, PYBUGLAB handles a limited number of commonly used literals, allowing rewrites to replace integer literals within the set of $- 2 , - 1 , 0 , 1 , 2$ and swapping the Boolean literal True with False and vice versa. The scoring function is identical to the operator rewrite, using a learnable embedding ${ \\bf { r } } _ { \\mathrm { { 1 i t } } }$ for each literal lit. ",
468
+ "bbox": [
469
+ 174,
470
+ 758,
471
+ 825,
472
+ 828
473
+ ],
474
+ "page_idx": 3
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "4.2 PYBUGLAB Rewrite Rules for Data Augmentation ",
479
+ "text_level": 1,
480
+ "bbox": [
481
+ 173,
482
+ 843,
483
+ 565,
484
+ 858
485
+ ],
486
+ "page_idx": 3
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "We additionally consider more rewrite rules that are not meant to change the program semantics, using them as a form of data augmentation. This is in spirit similar to ideas in computer vision where images are transformed (e.g. rotated, cropped) but maintain their original content. Such rewrites ",
491
+ "bbox": [
492
+ 174,
493
+ 869,
494
+ 825,
495
+ 911
496
+ ],
497
+ "page_idx": 3
498
+ },
499
+ {
500
+ "type": "text",
501
+ "text": "Require: Code dataset $C$ , initial detector/selector model parameters $\\theta ^ { ( 0 ) }$ , $\\phi ^ { ( 0 ) }$ ",
502
+ "bbox": [
503
+ 173,
504
+ 112,
505
+ 686,
506
+ 127
507
+ ],
508
+ "page_idx": 4
509
+ },
510
+ {
511
+ "type": "text",
512
+ "text": "1: for meta-epoch $i = 0$ to $I$ do \n2: // Create dataset of buggy programs: \n3: $C _ { D } ^ { ( i ) } \\gets \\left\\{ \\left( \\mathrm { s } [ \\rho ] _ { \\ell } , \\left. \\ell , \\rho ^ { - 1 } \\right. \\right) \\mid \\mathrm { s } \\in C , k \\mathrm { \\ s a m p l e s \\ } \\left. \\ell , \\rho \\right. \\sim S _ { \\phi ^ { ( i ) } } ( \\mathrm { s } ) \\right\\}$ \n4: $\\theta ^ { ( i + 1 ) } $ update $\\theta ^ { ( i ) }$ by training $D$ on $C _ { D } ^ { ( i ) }$ \n5: // Create dataset of hard-to-detect bugs: \n6: $\\begin{array} { r } { C _ { S } ^ { ( i ) } \\gets \\left\\{ \\left( \\mathrm { s } , \\mathrm { a r g } \\operatorname* { m a x } _ { \\langle \\ell , \\rho \\rangle \\in R _ { \\mathrm { s } } ^ { \\mathcal { R } } } \\left( \\mathcal { L } _ { D _ { \\theta ^ { ( i + 1 ) } } } \\left( \\mathrm { s } [ \\rho ] _ { \\ell } , \\langle \\ell , \\rho ^ { - 1 } \\rangle \\right) \\right) \\right) \\mid \\mathrm { s } \\in C \\right\\} } \\end{array}$ \n7: $\\phi ^ { ( i + 1 ) } $ update $\\phi ^ { ( i ) }$ by training $S$ on $C _ { S } ^ { ( i ) }$ ",
513
+ "bbox": [
514
+ 178,
515
+ 118,
516
+ 686,
517
+ 251
518
+ ],
519
+ "page_idx": 4
520
+ },
521
+ {
522
+ "type": "text",
523
+ "text": "have been shown to yield adversarially robust models of code [23]. Although our goal is not to provide adversarial robustness, we believe that such rewrites can help generalization. PYBUGLAB implements the following rewrites for this purpose: ",
524
+ "bbox": [
525
+ 174,
526
+ 279,
527
+ 825,
528
+ 321
529
+ ],
530
+ "page_idx": 4
531
+ },
532
+ {
533
+ "type": "text",
534
+ "text": "• Variable Renaming renames a local variable to a random name not already in scope. • Comment Deletion removes code comments, including docstrings and inline comments. Such comments commonly contain natural language information that is useful for code comprehension, but usually do not affect program semantics. • Comparison Expression Mirroring swaps the two sides of a comparison operator and changes it appropriately. For example, $\\mathtt { a } < \\mathtt { b }$ is transformed to $\\mathtt { b } > \\mathtt { a }$ . Note that in cases such as $\\mathbf { f } \\circ \\circ ( ) \\ < \\ \\mathsf { b a r } ( )$ , this will change the order of execution of foo and bar, possibly altering program semantics. • If-Else Branch Swapping negates the test condition of an if-else statement or a ternary expressions using DeMorgan’s law and swaps the then body with the else body. ",
535
+ "bbox": [
536
+ 173,
537
+ 332,
538
+ 828,
539
+ 473
540
+ ],
541
+ "page_idx": 4
542
+ },
543
+ {
544
+ "type": "text",
545
+ "text": "4.3 Implementation Details ",
546
+ "text_level": 1,
547
+ "bbox": [
548
+ 174,
549
+ 494,
550
+ 377,
551
+ 510
552
+ ],
553
+ "page_idx": 4
554
+ },
555
+ {
556
+ "type": "text",
557
+ "text": "To make the training computationally tractable we approximate Eq. 1. A simplified, sequential version of our training procedure is shown in Alg. 1. Intuitively, we alternate between training the two models, as the (discrete) sampling of rewrite rules in the selector models precludes direct endto-end training. We first use the current state of the selector model to generate “hard” samples and train the detector model on these samples (we always include the unmodified (i.e., NoBug case) as a sample). Then, we use the loss of the detector model to identify those generated samples that were hardest to detect and train the selector model to produce such samples. ",
558
+ "bbox": [
559
+ 174,
560
+ 520,
561
+ 825,
562
+ 617
563
+ ],
564
+ "page_idx": 4
565
+ },
566
+ {
567
+ "type": "text",
568
+ "text": "In practice, we implemented the training procedure as a system of asynchronously communi$C _ { D / S } ^ { ( 0 ) } , \\bar { C } _ { D / S } ^ { ( 1 ) } , \\dots$ , and all of the described steps happen in parallel. We do not use “generations”of datasets, but instead use two constantly updated “pools” of training data, one state of the corresponding data pool. We remove samples from the data pool once they have been sampled $\\nu$ times for use in training, in spirit similar to replay buffers in reinforcement learning. In our experiments, $\\nu$ was set to 4. We regularly (in separate, concurrent processes) take snapshots of the the current state of the $D$ and $S$ models to generate new elements that are updated to the data pools, matching the procedure described in Alg. 1. We approximate the arg max in line 6 by only considering the $k$ samples chosen in line 3 for each input program. During training of $S$ , we then mask out the unobserved choices before computing the loss. ",
569
+ "bbox": [
570
+ 174,
571
+ 623,
572
+ 826,
573
+ 782
574
+ ],
575
+ "page_idx": 4
576
+ },
577
+ {
578
+ "type": "text",
579
+ "text": "5 Evaluation ",
580
+ "text_level": 1,
581
+ "bbox": [
582
+ 174,
583
+ 801,
584
+ 295,
585
+ 819
586
+ ],
587
+ "page_idx": 4
588
+ },
589
+ {
590
+ "type": "text",
591
+ "text": "We now discuss our new dataset and evaluate PYBUGLAB. We $\\divideontimes$ . . . . . . . . . .highlight. . . . .key . . . . . . . .results. ",
592
+ "bbox": [
593
+ 174,
594
+ 833,
595
+ 738,
596
+ 849
597
+ ],
598
+ "page_idx": 4
599
+ },
600
+ {
601
+ "type": "text",
602
+ "text": "Datasets To train PYBUGLAB we retrieve the 4k most downloaded packages in the Python package index (PyPI) and take $3 . 4 \\mathrm { k }$ of them as training packages, using the rest for test purposes. During training, PYBUGLAB installs each package along with all its dependencies. Installing all the dependencies is important for extracting the entities and the relations beyond local syntactic ones (e.g. type inference, method resolution). For each file, PYBUGLAB checks if it is a duplicate of a file that has already been seen in the training following the method of Allamanis [1] and runs all the relevant program analyses to extract the entities and relationships in each function. When we use additional rewrites for data augmentation, these are applied at the input of the PYBUGLAB pipeline as a form of pre-processing. Following Alg. 1, the bug selector $S$ selects $k = 5$ bugs to introduce, rewrites the source code text, and then the program analyses extract the new entities and relationships for the rewritten code snippets. The initial and rewritten code snippets are then used to create the training data for the detector and selector models. ",
603
+ "bbox": [
604
+ 174,
605
+ 856,
606
+ 825,
607
+ 911
608
+ ],
609
+ "page_idx": 4
610
+ },
611
+ {
612
+ "type": "text",
613
+ "text": "",
614
+ "bbox": [
615
+ 174,
616
+ 90,
617
+ 825,
618
+ 202
619
+ ],
620
+ "page_idx": 5
621
+ },
622
+ {
623
+ "type": "text",
624
+ "text": "We use two testsets to measure performance. First, we create RANDOMBUGS, a testset of 761 445 snippets derived from functions from the $6 0 0 \\mathrm { P y P I }$ test packages (not seen during training). For each function we find within these packages we add it to the dataset along with 9 rewritten functions with a randomly inserted bug. On average graphs have 260 nodes, 601 edges, 25 rewrite locations, and 130 possible rewrites. We also collect a testset of real bugs. Although we conjecture that, in practice, the vast majority of bugs like those discussed in Sec. 4.1 are fixed when developers locally test their software, a few of those slip and then are fixed across different revisions checked into a version control systems. We have crawled the accessible repositories of all $2 8 5 \\mathrm { k }$ packages in the Python Package Index (PyPI), collected and manually filtered bugs captured by the rewrites from Sec. 4.1. $\\divideontimes$ . . . . .This. . . . . .new . . . . . . . . .dataset, . . . . . . . . . . . . . . .PYPIBUGS,. . . . . . . . . .contains. . . . . . .2374 . . . . . . . . . . . . .real-world,. . . . . . .small . . . . . . .bugs. We describe the data collection process in detail in Appx. D. In addition, we consider PYPIBUGS-PostFix: the examples from PYPIBUGS after a bug was fixed - we believe these samples are very likely to not contain any bugs anymore. We publish the dataset at https://www.microsoft.com/en-us/download/103554 and include it in the supplementary material. ",
625
+ "bbox": [
626
+ 173,
627
+ 208,
628
+ 825,
629
+ 402
630
+ ],
631
+ "page_idx": 5
632
+ },
633
+ {
634
+ "type": "text",
635
+ "text": "5.1 Quantitative Evaluation ",
636
+ "text_level": 1,
637
+ "bbox": [
638
+ 174,
639
+ 428,
640
+ 380,
641
+ 443
642
+ ],
643
+ "page_idx": 5
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "Our first experiment aims to evaluate whether the BUGLAB training framework yields more precise bug detectors. We consider two model architectures, using either GNNs or the GREAT transformer to compute embeddings of code entities (architecture details and hyperparameter choices can be found in Appx. A). We use four different training strategies: “supervised” is training only a bug detector on a fixed dataset of 1 million functions from the $3 . 4 \\mathrm { k }$ training packages with randomly inserted bugs. “Random Selector” refers to a variant of PYBUGLAB using a bug selector model that uniformly at random picks a rewrite to insert bugs. Finally, PYBUGLAB and PYBUGLAB $+ \\mathrm { A u g }$ use our framework from Sec. 2, with the latter also using additional rewrites to augment our code corpus. For the fully supervised model, we train with early stopping over a validation set; the other models are trained for a fixed number of 300 epochs (with $2 0 0 \\mathrm { k }$ training samples per epoch) for the bug detector3 and the last detector model is used for evaluation. ",
648
+ "bbox": [
649
+ 174,
650
+ 457,
651
+ 825,
652
+ 608
653
+ ],
654
+ "page_idx": 5
655
+ },
656
+ {
657
+ "type": "table",
658
+ "img_path": "images/9a6ef7f5e2c7b5670ec7841f26aeaf6731accd922bc485b255de9a3c978fbd12.jpg",
659
+ "table_caption": [
660
+ "Table 1: Accuracies $( \\% )$ for different training strategies and model architectures on RANDOMBUGS. "
661
+ ],
662
+ "table_footnote": [],
663
+ "table_body": "<table><tr><td rowspan=\"3\"></td><td colspan=\"6\">RANDOMBUGS</td></tr><tr><td></td><td>GNN</td><td></td><td></td><td>GREAT</td><td></td></tr><tr><td>Joint</td><td>Loc</td><td>Repair</td><td>Joint</td><td>Loc</td><td>Repair</td></tr><tr><td>Supervised</td><td>62.4</td><td>73.6</td><td>81.2</td><td>51.0</td><td>61.9</td><td>76.3</td></tr><tr><td>Random Selector</td><td>69.4</td><td>79.6</td><td>84.0</td><td>63.9</td><td>73.6</td><td>82.0</td></tr><tr><td>PYBUGLAB</td><td>69.6</td><td>80.4</td><td>84.2</td><td>64.0</td><td>74.3</td><td>82.3</td></tr><tr><td>PYBUGLAB +Aug</td><td>70.3</td><td>81.1</td><td>84.5</td><td>65.3</td><td>75.3</td><td>82.5</td></tr></table>",
664
+ "bbox": [
665
+ 433,
666
+ 646,
667
+ 821,
668
+ 751
669
+ ],
670
+ "page_idx": 5
671
+ },
672
+ {
673
+ "type": "text",
674
+ "text": "Effectiveness of BUGLAB Training We first consider the performance of different models on the synthetic RANDOMBUGS dataset. Tbl. 1 shows the accuracy of predicting a full bug repair correctly (“Joint”) and analogous to Eq. 2 break this up into a localization accuracy (“Loc”) of predicting the correct location (or NoBug for correct examples) and a repair accuracy (“Repair”) for selecting the correct rewrite given the buggy location. ",
675
+ "bbox": [
676
+ 174,
677
+ 616,
678
+ 419,
679
+ 753
680
+ ],
681
+ "page_idx": 5
682
+ },
683
+ {
684
+ "type": "text",
685
+ "text": "",
686
+ "bbox": [
687
+ 179,
688
+ 753,
689
+ 617,
690
+ 767
691
+ ],
692
+ "page_idx": 5
693
+ },
694
+ {
695
+ "type": "text",
696
+ "text": "We observe that $\\divideontimes$ . . . . . . . . . . . . . . . . . . . . .BUGLAB-training. . . . . . .leads. . . .to . . . . . . .more. . . . . . . .robust. . . . . .bug . . . . . . . . . . .detectors. . . . . . . . . . . . .compared. . .to. . . . . . . .other methods .......... for both GNNs and GREAT. Random selector models — a form of data augmentation — improve performance over supervised methods but mostly on in-distribution RANDOMBUGS samples. As expected, $\\divideontimes$ . . . . . . . . . . . . .augmenting. . . . .the . . . . . .code. . . . . . . . .dataset. . . . . . .helps . . . . . . . . . . . . . . . . .generalization, but does not make a substantial difference. Expanding the kinds of rewrites used to augment the data and learning to select them may improve performance in the future. ",
697
+ "bbox": [
698
+ 173,
699
+ 773,
700
+ 825,
701
+ 859
702
+ ],
703
+ "page_idx": 5
704
+ },
705
+ {
706
+ "type": "table",
707
+ "img_path": "images/45931fde220989a07d0269fc66c433e7865bbe57c0647970de9be2941d785c74.jpg",
708
+ "table_caption": [
709
+ "Table 2: Results for different training strategies and model architectures on PYPIBUGS. "
710
+ ],
711
+ "table_footnote": [],
712
+ "table_body": "<table><tr><td></td><td colspan=\"6\">PYPIBUGS</td><td colspan=\"4\">PYPIBUGS-PostFix</td></tr><tr><td></td><td colspan=\"3\">GNN</td><td colspan=\"3\">GREAT</td><td colspan=\"2\">GNN</td><td colspan=\"2\">GREAT</td></tr><tr><td></td><td>Joint</td><td>Loc</td><td>Repair</td><td>Joint</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Joint AUC</td><td>Loc</td><td>Joint AUC</td></tr><tr><td>Supervised</td><td>20.0</td><td>28.4</td><td>61.8</td><td>16.8</td><td>25.8</td><td>58.6</td><td>17.8</td><td>0.087</td><td>20.7</td><td>0.044</td></tr><tr><td>Random Selector</td><td>21.2</td><td>27.0</td><td>69.2</td><td>20.6</td><td>26.8</td><td>67.2</td><td>47.5</td><td>0.108</td><td>52.5</td><td>0.117</td></tr><tr><td>PYBUGLAB</td><td>24.2</td><td>31.3</td><td>70.7</td><td>24.0</td><td>32.8</td><td>67.9</td><td>32.9</td><td>0.160</td><td>28.6</td><td>0.140</td></tr><tr><td>PYBUGLAB +Aug</td><td>26.4</td><td>33.5</td><td>72.0</td><td>23.2</td><td>29.7</td><td>68.8</td><td>32.6</td><td>0.187</td><td>48.2</td><td>0.129</td></tr></table>",
713
+ "bbox": [
714
+ 173,
715
+ 103,
716
+ 820,
717
+ 205
718
+ ],
719
+ "page_idx": 6
720
+ },
721
+ {
722
+ "type": "table",
723
+ "img_path": "images/bd939f82906d67d424796b5296bcfff95df172b83ccdaf77a3cbb3c270dc7c2c.jpg",
724
+ "table_caption": [
725
+ "Table 3: Localization and Repair Accuracy $( \\% )$ per bug kind for the PYBUGLAB +Aug model. "
726
+ ],
727
+ "table_footnote": [],
728
+ "table_body": "<table><tr><td rowspan=\"3\">Bug Type</td><td colspan=\"4\">RANDOMBUGS</td><td colspan=\"4\">PYPIBUGS</td></tr><tr><td colspan=\"2\">GNN</td><td colspan=\"2\">GREAT</td><td colspan=\"2\">GNN</td><td colspan=\"2\">GREAT</td></tr><tr><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td></tr><tr><td>Argument Swapping</td><td>85.0</td><td>57.3</td><td>65.5</td><td>57.2</td><td>33.2</td><td>73.9</td><td>24.3</td><td>72.7</td></tr><tr><td>Wrong Assign Op</td><td>96.1</td><td>99.1</td><td>94.5</td><td>98.6</td><td>20.0</td><td>68.9</td><td>14.0</td><td>58.1</td></tr><tr><td>Wrong Binary Op</td><td>83.0</td><td>85.2</td><td>77.3</td><td>81.4</td><td>27.2</td><td>54.3</td><td>36.6</td><td>43.7</td></tr><tr><td>Wrong Boolean Op</td><td>71.8</td><td>99.5</td><td>43.6</td><td>99.5</td><td>27.6</td><td>96.9</td><td>15.7</td><td>97.2</td></tr><tr><td>Wrong Comparison Op</td><td>83.9</td><td>79.3</td><td>80.0</td><td>76.4</td><td>33.7</td><td>66.1</td><td>31.1</td><td>53.5</td></tr><tr><td>Wrong Literal</td><td>71.7</td><td>74.7</td><td>66.6</td><td>71.6</td><td>21.6</td><td>78.4</td><td>17.9</td><td>79.5</td></tr><tr><td>Variable Misuse</td><td>84.9</td><td>88.4</td><td>78.2</td><td>86.3</td><td>35.3</td><td>70.5</td><td>34.0</td><td>69.4</td></tr><tr><td>NoBUG</td><td>53.8</td><td></td><td>62.5</td><td></td><td></td><td></td><td></td><td></td></tr></table>",
729
+ "bbox": [
730
+ 173,
731
+ 234,
732
+ 823,
733
+ 404
734
+ ],
735
+ "page_idx": 6
736
+ },
737
+ {
738
+ "type": "text",
739
+ "text": "Furthermore, $\\ast { \\mathrm { l o u g } } .$ . . . . . . . . . . . . . .localization . . .is . . . . . . .much . . . . . . . .harder. . . . . .than . . . . . . . .repair . . .at . .a . . . . . . .given . . . . . . . . . .location. This is somewhat expected: there are many more candidate locations compared to potential repairs at a given location. However, this suggests that research should focus on the localization problem rather than repair. ",
740
+ "bbox": [
741
+ 174,
742
+ 429,
743
+ 825,
744
+ 473
745
+ ],
746
+ "page_idx": 6
747
+ },
748
+ {
749
+ "type": "text",
750
+ "text": "We now turn to the results on PYPIBUGS, shown in Tbl. 2, which also includes the accuracy of choosing the special NoBug location on the PYPIBUGS-PostFix dataset, as well as the area under the precision recall curve for the results on both PYPIBUGS and PYPIBUGS-PostFix. ",
751
+ "bbox": [
752
+ 176,
753
+ 478,
754
+ 821,
755
+ 521
756
+ ],
757
+ "page_idx": 6
758
+ },
759
+ {
760
+ "type": "text",
761
+ "text": "We find that $\\divideontimes$ . . . . . . . . . .detecting. . . . .and. . . . . . . . . . . .repairing . . . . . . . . .real-life. . . . . . .bugs . .is. . . . . . . . . . . . . . .significantly. . . . . . . .harder. . . . . .than. . . . . . . . . . .handling . . . . . . . . . . . .randomly . . . . . . . . .inserted. . . . . .bugs. As PYBUGLAB models trained using a learned bug selector outperform those using a “Random Selector”, we speculate that the learned selector avoids generating easy-to-detect bugs, focusing the detector model on recognizing deeper semantic patterns. Despite this, improvements in RANDOMBUGS often correlate with improvements in PYPIBUGS. This is encouraging: collecting PYPIBUGS-like datasets is costly; corpora with random bugs can help measure relative improvements to some extent. Finally, we find that $\\divideontimes$ . . . . . . . . . . . . . .recognizing . . . . . . . . . . . . .non-buggy . . . . . . . . . .samples. . .is . . . . . .very . . . . . .hard, and in particular, does not always profit from training in PYBUGLAB. ",
762
+ "bbox": [
763
+ 173,
764
+ 526,
765
+ 826,
766
+ 641
767
+ ],
768
+ "page_idx": 6
769
+ },
770
+ {
771
+ "type": "text",
772
+ "text": "In our qualitative analysis (Sec. 5.2), we observed that the models raised some confident but incorrect warnings at very “odd” locations. However, these warnings were different across models. We have tested an ensembling strategy averaging the output probabilities of five separately trained GNN models. This results in localization and repair accuracies of $8 3 . 0 \\%$ and $8 5 . 4 \\%$ on RANDOMBUGS (vs. $8 1 . 1 \\%$ and $8 4 . 5 \\%$ ) and $3 4 . 4 \\%$ and $7 2 . 2 \\%$ on PYPIBUGS (vs. $3 3 . 5 \\%$ and $7 2 . 0 \\%$ ). As we discuss in Sec. 5.2 finding the cause of the “spurious” warnings is important future work. ",
773
+ "bbox": [
774
+ 174,
775
+ 647,
776
+ 825,
777
+ 731
778
+ ],
779
+ "page_idx": 6
780
+ },
781
+ {
782
+ "type": "text",
783
+ "text": "Per-Bug Evaluation To better understand which bugs are hard to detect, we break down the results the best-performing PYBUGLAB $+ \\mathrm { A u g }$ models on RANDOMBUGS by type of bug in Tbl. 3. We observe that incorrect literals are some of the hardest bugs to detect. Incorrect assignment operators $( e . g . = \\mathrm { a n d } + = )$ ) are easy to detect in RANDOMBUGS, but significantly harder in PYPIBUGS. This may be attributed to class imbalance, with simple assignment $( = )$ being the majority class. $\\divideontimes$ Detecting . . . . . . . . . . . . . .if .a. . . . . . . . .snippet. . . . .has . .a . . . . .bug . . .or . . . .not. . . . . . . .seems . . .to . . .be. . . .the. . . . . . . . .hardest. . . . . .task:. . . .no. . . . . . . .model . . . . . . . . . .achieves. . . . . . . . . . .accuracy. . . . . . . . .beyond. $6 3 \\%$ . ",
784
+ "bbox": [
785
+ 173,
786
+ 737,
787
+ 825,
788
+ 824
789
+ ],
790
+ "page_idx": 6
791
+ },
792
+ {
793
+ "type": "text",
794
+ "text": "We note that in our experiments, GNNs-based models seem to often outperform GREAT, somewhat contradicting the results of Hellendoorn et al. [13]. We have performed substantial additional experiments to investigate and verify these results, cf. Sec. A.2. This may have to do with the performance of these models on long sequences or that the GNN has access to more fine-grained information, instead of relations over the projected token sequences. For example, this could be attributed to the lack of syntax and symbol nodes in the representation used in GREAT. Nevertheless, GREAT is noticeably better ( $6 2 . 5 \\%$ vs. $5 3 . 8 \\%$ ) at detecting NoBug and locating wrong binary operators in PYPIBUGS. ",
795
+ "bbox": [
796
+ 174,
797
+ 827,
798
+ 825,
799
+ 911
800
+ ],
801
+ "page_idx": 6
802
+ },
803
+ {
804
+ "type": "table",
805
+ "img_path": "images/8037918e569bcf21bec36b8e0c64c703d98d376bc99408953d5a9a1d383a3d17.jpg",
806
+ "table_caption": [
807
+ "Table 5: Bug distribution $( \\% )$ in different datasets "
808
+ ],
809
+ "table_footnote": [],
810
+ "table_body": "<table><tr><td>Bug Kind</td><td>PYPIBUGS</td><td>RANDOMBUGS</td><td>Selector Samples</td></tr><tr><td>Argument Swapping</td><td>11.9</td><td>8.4</td><td>23.8</td></tr><tr><td>Wrong Assignment</td><td>1.9</td><td>8.5</td><td>5.3</td></tr><tr><td>Wrong Binary Operator</td><td>3.4</td><td>2.4</td><td>2.3</td></tr><tr><td>Wrong Boolean Operator</td><td>8.1</td><td>2.2</td><td>6.4</td></tr><tr><td>Wrong Comparison Operator</td><td>17.1</td><td>8.2</td><td>7.4</td></tr><tr><td>Wrong Literal</td><td>3.7</td><td>11.6</td><td>12.4</td></tr><tr><td>Variable Misuse</td><td>53.8</td><td>58.6</td><td>42.5</td></tr></table>",
811
+ "bbox": [
812
+ 215,
813
+ 103,
814
+ 782,
815
+ 229
816
+ ],
817
+ "page_idx": 7
818
+ },
819
+ {
820
+ "type": "text",
821
+ "text": "",
822
+ "bbox": [
823
+ 174,
824
+ 272,
825
+ 823,
826
+ 300
827
+ ],
828
+ "page_idx": 7
829
+ },
830
+ {
831
+ "type": "text",
832
+ "text": "Bug Selector Performance To understand how training of the bug selector proceeds, we perform two experiments. In our first experiment, we take a snapshot of the selector model during training of the PYBUGLAB $+ \\mathrm { A u g }$ (GNN) model every 24 hours, after an initial burn-in phase of 12 hours. We then generate 10000 buggy samples using each of these snapshots and then test a fixed model on each of these snapshots. The results of this are shown in Tbl. 4, using a fully trained PYBUGLAB $+ \\mathrm { A u g }$ (GNN) model from another training run as a fixed model. We conclude that . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB succeeds. . . .in . . . . . . . . . .learning . . .to . . . . . . . . . .generate. . . . . . . .harder. . .to find ..........bugs, though we can observe the selector model trading off “harder-to-localize” and “harder-tofix” properties. Tests on other models show similar trends, confirming the robustness of this result. ",
833
+ "bbox": [
834
+ 174,
835
+ 306,
836
+ 549,
837
+ 460
838
+ ],
839
+ "page_idx": 7
840
+ },
841
+ {
842
+ "type": "text",
843
+ "text": "",
844
+ "bbox": [
845
+ 176,
846
+ 462,
847
+ 825,
848
+ 488
849
+ ],
850
+ "page_idx": 7
851
+ },
852
+ {
853
+ "type": "table",
854
+ "img_path": "images/c3149cb1f9f5d33fffe426f0377edd65043e8b7a01d9e6d5a8af81a8671b2daa.jpg",
855
+ "table_caption": [
856
+ "Table 4: Development of Performance on Bug Selector Samples "
857
+ ],
858
+ "table_footnote": [],
859
+ "table_body": "<table><tr><td>Training&#x27; Time</td><td>Joint</td><td>Loc</td><td>Repair</td></tr><tr><td>0.5 days</td><td>64.2</td><td>83.8</td><td>72.1</td></tr><tr><td>1.5 days</td><td>62.5</td><td>80.7</td><td>72.9</td></tr><tr><td>2.5 days</td><td>62.0</td><td>83.0</td><td>69.8</td></tr><tr><td>3.5 days</td><td>61.7</td><td>82.5</td><td>69.8</td></tr><tr><td>4.5 days</td><td>61.9</td><td>83.0</td><td>69.5</td></tr><tr><td>5.5 days</td><td>61.1</td><td>83.0</td><td>68.6</td></tr><tr><td>6.5 days</td><td>60.5</td><td>78.7</td><td>72.4</td></tr></table>",
860
+ "bbox": [
861
+ 560,
862
+ 332,
863
+ 823,
864
+ 459
865
+ ],
866
+ "page_idx": 7
867
+ },
868
+ {
869
+ "type": "text",
870
+ "text": "In a second experiment, we compare the distribution of different bug kinds in PYPIBUGS and RANDOMBUGS with the distribution of bugs sampled from the final snapshot of our selector model from above. The results are shown in Tbl. 5, where we can see that a number of bugs (argument swapping, use of wrong literals and of assignment operators) are substantially over-represented, whereas mistakes in comparison operators and variable misuse are under-represented. This indicates that . . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB generates. . . . . .hard . . .to . . . . . .find, . . . .but. . . .not. . . . . . . . . . . . . .necessarily . . . . . . . . . .realistic . . . . . .bugs. ",
871
+ "bbox": [
872
+ 174,
873
+ 494,
874
+ 826,
875
+ 579
876
+ ],
877
+ "page_idx": 7
878
+ },
879
+ {
880
+ "type": "text",
881
+ "text": "Comparison to CuBERT Finally, we compare our models to CuBERT [15], which uses a masked language modeling objective to pre-train a BERT-like model and then learns bug detectors specific to a class of bugs (e.g., wrong binary operators) on top of this pre-trained model. Note that CuBERT detects $i f$ a bug exists but does not localize it. For the comparison, we create two sub-datasets of PYPIBUGS: PYPIBUGS-WrongOp contains the 501 samples that involve the binary operators supported by CuBERT, and PYPIBUGS-VarMisuse, which contains the 1278 bugs that involve variable misuses. We complete both of these datasets with 501 (resp. 1278) random NoBug code samples from our RANDOMBUGS, to match the 1:1 buggy/non-buggy distribution used in CuBERT’s training. Since CuBERT classification models focus on a single bug type, to compare to PYBUGLAB we mask out all code locations that do not correspond to a bug that could be detected by the corresponding CuBERT model. We then treat the prediction of the NoBug location as a “non-buggy” prediction and all other locations as a “buggy” prediction. For example, for the snippet in Fig. 2, only the locations $l _ { 2 }$ , $l _ { 1 1 }$ , $l _ { 1 4 }$ , $l _ { 1 6 }$ , and $l _ { 2 0 }$ and their corresponding rewrites are considered by PYBUGLAB for the comparison on PYPIBUGS-WrongOp. ",
882
+ "bbox": [
883
+ 173,
884
+ 585,
885
+ 826,
886
+ 779
887
+ ],
888
+ "page_idx": 7
889
+ },
890
+ {
891
+ "type": "text",
892
+ "text": "Tbl. 6 shows the results of comparing the released CuBERT snapshots with the PYBUGLAB +Aug GNN model. We observe that $\\divideontimes$ . . . .the . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB models ",
893
+ "bbox": [
894
+ 173,
895
+ 785,
896
+ 356,
897
+ 871
898
+ ],
899
+ "page_idx": 7
900
+ },
901
+ {
902
+ "type": "table",
903
+ "img_path": "images/55b3364d400dfb104c428ee8540f8da946936e41c3e3c9c9a4e40abf08959203.jpg",
904
+ "table_caption": [
905
+ "Table 6: Comparison with CuBERT [15] "
906
+ ],
907
+ "table_footnote": [],
908
+ "table_body": "<table><tr><td rowspan=\"2\"></td><td colspan=\"3\">CuBERT</td><td colspan=\"3\">PYBUGLAB (GNN)</td></tr><tr><td>Prec</td><td>Recall</td><td>F1</td><td>Prec</td><td>Recall</td><td>F1</td></tr><tr><td>PYPIBUGs-WrongOp</td><td>0.764</td><td>0.251</td><td>0.378</td><td>0.730</td><td>0.764</td><td>0.746</td></tr><tr><td>PYPIBUGS-VarMisuse</td><td>0.632</td><td>0.403</td><td>0.493</td><td>0.740</td><td>0.840</td><td>0.787</td></tr></table>",
909
+ "bbox": [
910
+ 364,
911
+ 796,
912
+ 823,
913
+ 864
914
+ ],
915
+ "page_idx": 7
916
+ },
917
+ {
918
+ "type": "text",
919
+ "text": ". . . . .have. . . . . . . . . . . . . . . .substantially . . . . . . .better. . . . . . .recall. . . . . .than. . . . . . . . . . . . . . . . . . .CuBERT-based . . . . . . . . .models, even though they were trained to detect more bug types. When calibrating the CuBERT models to have a recall equal to PYBUGLAB, heir precision drops substantially. In particular, on PYPIBUGS-WrongOp, it is reduced to 0.609, and ",
920
+ "bbox": [
921
+ 181,
922
+ 869,
923
+ 826,
924
+ 911
925
+ ],
926
+ "page_idx": 7
927
+ },
928
+ {
929
+ "type": "text",
930
+ "text": "1 def make_id(name): \n2 $\\mathbf { r } \\ =$ get_rand_string(12) \n3 if len(name) <= 22: \n4 name $=$ name[:22] \n5 return name $\\textrm { + } \\textrm { -- } \\textrm { + } \\textrm { \\pmb { r } }$ (a) A wrong comparison operator bug (red box) in PYPIBUGS detected and repaired by the GNN PYBUGLAB +Aug models. ",
931
+ "bbox": [
932
+ 163,
933
+ 108,
934
+ 468,
935
+ 213
936
+ ],
937
+ "page_idx": 8
938
+ },
939
+ {
940
+ "type": "text",
941
+ "text": "1 def update(self, roomId, \n2 title, \\*\\*request_params): \n3 check_type(roomId, basestring) \n4 check_type(roomId, basestring) \n5 [...] ",
942
+ "bbox": [
943
+ 486,
944
+ 97,
945
+ 774,
946
+ 160
947
+ ],
948
+ "page_idx": 8
949
+ },
950
+ {
951
+ "type": "text",
952
+ "text": "(b) A variable misuse (red box) caught in an open-source project. GNN PYBUGLAB $+ \\mathrm { A u g }$ suggests to rewrite roomId to title. The fixing pull request is found here. ",
953
+ "bbox": [
954
+ 496,
955
+ 174,
956
+ 825,
957
+ 213
958
+ ],
959
+ "page_idx": 8
960
+ },
961
+ {
962
+ "type": "text",
963
+ "text": "Figure 3: Bugs found by PYBUGLAB. Snippets reformatted and abbreviated to fit figure. ",
964
+ "bbox": [
965
+ 207,
966
+ 220,
967
+ 789,
968
+ 236
969
+ ],
970
+ "page_idx": 8
971
+ },
972
+ {
973
+ "type": "text",
974
+ "text": "on PYPIBUGS-VarMisuse, it is reduced to 0.613; in both cases, PYBUGLAB outperforms CuBERT substantially. ",
975
+ "bbox": [
976
+ 173,
977
+ 277,
978
+ 825,
979
+ 306
980
+ ],
981
+ "page_idx": 8
982
+ },
983
+ {
984
+ "type": "text",
985
+ "text": "5.2 Qualitative Inspection of Raised Warnings ",
986
+ "text_level": 1,
987
+ "bbox": [
988
+ 174,
989
+ 338,
990
+ 508,
991
+ 354
992
+ ],
993
+ "page_idx": 8
994
+ },
995
+ {
996
+ "type": "text",
997
+ "text": "We now take a qualitative look at the raised warnings raised by PYBUGLAB. As example, Fig. 3a shows a sample of PYPIBUGS where the developer used an incorrect comparison operator. Once pointed to it, it is clear to a human that the truncation statement in line 4 has no effect (under the reasonable assumption that name is a string), and that a different comparison operator $( > )$ is necessary. ",
998
+ "bbox": [
999
+ 174,
1000
+ 372,
1001
+ 825,
1002
+ 428
1003
+ ],
1004
+ "page_idx": 8
1005
+ },
1006
+ {
1007
+ "type": "text",
1008
+ "text": "To gain an understanding of the performance of PYBUGLAB on realistic data, we performed an indepth analysis of the cases flagged as bugs by our best-performing model on the code found within the 4k top PyPI packages. We observed a mixture of false positives with few previously unseen real-life bugs, matching the quantitative results in Tbl. 3. First, we find that the majority of the false positives are “incorrect literal” detections. This suggests that learning to detect such bugs is a hard problem. Furthermore, many literals serve as default “configurations” (e.g. the number of retries for a network request) and different values are not bugs. We posit that a large percentage of literal replacements the selector learns to make fall in this category. ",
1009
+ "bbox": [
1010
+ 174,
1011
+ 434,
1012
+ 825,
1013
+ 545
1014
+ ],
1015
+ "page_idx": 8
1016
+ },
1017
+ {
1018
+ "type": "text",
1019
+ "text": "We also found that some repairs suggested by the model actually produce semantically equivalent code. For example, the model lacks knowledge that two variables refer to the same object in memory (aliasing), and so attempts to “repair” variable misuse bugs by switching between these. Other examples includes checking the return values of standard functions such as Python’s str.find, which returns $^ { - 1 }$ if the query string is not found. In such cases, PYBUGLAB often suggested to rewrite an if $\\mathbf { x } \\lrcorner \\mathbf { f i n d } ( \\mathbf { y } ) \\ \\ll \\ - 1$ to if $\\mathbf { x } \\lrcorner \\mathbf { f i n d } ( \\mathbf { y } ) \\ = - 1$ , which makes no difference in practice. These false negatives can be attributed to the fact that the bug selector model considers such changes as introducing bugs, even though they are not actually changing behavior. This suggests that for better results, the rewrite rules need to ensure that the rewrites are not semantics-preserving and represent bugs. ",
1020
+ "bbox": [
1021
+ 173,
1022
+ 551,
1023
+ 825,
1024
+ 689
1025
+ ],
1026
+ "page_idx": 8
1027
+ },
1028
+ {
1029
+ "type": "text",
1030
+ "text": "Finally, some reported issues were sufficiently complex that it took us (the human authors) a couple of minutes of thought to conclude that a warning is spurious. Simultaneously, there are some warnings that are “obviously” incorrect to us, but the reasons why the neural models raise them is unclear. This highlights the importance of research on explainability techniques along with better ways to calibrate model confidence. The fact that selectors may introduce spurious “bugs” may also be affecting how the detector model learns. Ideas that have appeared in reinforcement learning, such as the one of Dennis et al. [8], may allow models to improve their performance in spite of spurious bugs. ",
1031
+ "bbox": [
1032
+ 174,
1033
+ 695,
1034
+ 825,
1035
+ 792
1036
+ ],
1037
+ "page_idx": 8
1038
+ },
1039
+ {
1040
+ "type": "text",
1041
+ "text": "Overall, $\\yen 123,456,7$ . . .of. . . . .the . . . . . .1000. . . . . . . . . . .reported . . . . . . . . . . .warnings . . . . . .were. . . . . . . .found . . .to . . .be. . . . . . . . . .real-life. . . . . . .bugs. Of these 19, we reported 11 on GitHub (6 already merged, 5 pending approval). See Appx. G for details. 3 other bugs had already been fixed between the version PYBUGLAB processed and the current version or the project was deprecated, whereas another 5 bugs are minor and we decided not to report them. One of the detected bugs is shown in Fig. 3b. Overall, most of the detected bugs appear within unit tests, logging, or exception handling, possibly because bugs there do not impact the core functionality of a project. However, given the number of such bugs we collected in PYPIBUGS, we believe that such bugs arise equally often in other code, but that they are detected and fixed more quickly. ",
1042
+ "bbox": [
1043
+ 174,
1044
+ 799,
1045
+ 825,
1046
+ 911
1047
+ ],
1048
+ "page_idx": 8
1049
+ },
1050
+ {
1051
+ "type": "text",
1052
+ "text": "Although our analysis only forms a lower bound on the precision of PYBUGLAB and related methods, it suggests that there is still ample room for future improvements towards making machine learningbased bug detection and repair practically useful. ",
1053
+ "bbox": [
1054
+ 174,
1055
+ 90,
1056
+ 825,
1057
+ 133
1058
+ ],
1059
+ "page_idx": 9
1060
+ },
1061
+ {
1062
+ "type": "text",
1063
+ "text": "6 Related Work ",
1064
+ "text_level": 1,
1065
+ "bbox": [
1066
+ 174,
1067
+ 152,
1068
+ 321,
1069
+ 170
1070
+ ],
1071
+ "page_idx": 9
1072
+ },
1073
+ {
1074
+ "type": "text",
1075
+ "text": "Detecting bugs in source code has been researched since the early days of computing. Traditionally, bug detection is tackled as a formal task, where any code that cannot be proved to satisfy some correctness property may contain a bug. This is essential for security- and safety-critical bugs, but not for other — equally common — bugs. In the last decade, software engineering and programming language research have increasingly realized ambiguous information within code (e.g. variable names, comments) contains valuable information and using this information can yield valuable results [2]. The main premise is that patterns in source code, such as patterns in names, control, and data flow can be informative. This information can also be exploited to detect some bugs. For example, Ray et al. [24] noted that even simple language models tend to assign lower probability to buggy code. ",
1076
+ "bbox": [
1077
+ 174,
1078
+ 185,
1079
+ 825,
1080
+ 310
1081
+ ],
1082
+ "page_idx": 9
1083
+ },
1084
+ {
1085
+ "type": "text",
1086
+ "text": "Multiple static analysis methods have been researched that combine some form of data-oriented bug detection. This ranges from language model-based tools, such as the early work of Wang et al. [32] to specification-mining tools such as the work of Eberhardt et al. [10]. BUGLAB is related to DeepBugs [22] which uses an MLP over a limited window of code tokens and train separate models to detect wrong operators, operands, and argument swappings. BUGLAB opts for a more structured representation of code and a single model. Allamanis et al. [3], Vasic et al. [30], Hellendoorn et al. [13] tackle variable misuse bugs (one of the kinds of bugs included in PYBUGLAB) but either by randomly introducing the bugs in code or using a Cloze-like test. Instead, BUGLAB opts for a selfsupervised approach and tackles a broader range of bugs. Concurrently to this work, Patra and Pradel [21] showed an alternative method for learning to generate realistic bugs. Dinella et al. [9] learn a supervised sequential model that performs graph transformations that replicate small edits in code (refactoring, introducing functionality, bug fixing, etc.). Their model — Hoppity — could serve as a learnable rewrite operation in BUGLAB in future work. Dynamic analysis methods have also been researched with promising results [31], but collecting representative dynamic traces over a diverse set of programs at scale (e.g. from the top Python packages used in this work) is practically impossible. ",
1087
+ "bbox": [
1088
+ 174,
1089
+ 316,
1090
+ 826,
1091
+ 523
1092
+ ],
1093
+ "page_idx": 9
1094
+ },
1095
+ {
1096
+ "type": "text",
1097
+ "text": "BUGLAB is related to ideas around self-supervised learning recently explored in deep learning, computer vision, and NLP. In our case, we aim to train a bug detection model without using training data from real-life bugs. BUGLAB resembles ELECTRA [6], with the important difference that the rewrites to the input code go beyond single token replacement that need to respect strict constraints of programming languages (syntax, variable scopes) and the model is directly used for bug detection, rather than for pre-training. The main BUGLAB objective Eq. 1 also resembles GANs [12] with the exception that the objective is non-differentiable (introducing a bug alters the discrete data representation), the selector is a structured probabilistic code rewriting model, and that we are mainly interested in the bug detector (analogous to the discriminator) rather than the selector. ",
1098
+ "bbox": [
1099
+ 174,
1100
+ 529,
1101
+ 825,
1102
+ 655
1103
+ ],
1104
+ "page_idx": 9
1105
+ },
1106
+ {
1107
+ "type": "text",
1108
+ "text": "7 Discussion and Conclusions ",
1109
+ "text_level": 1,
1110
+ "bbox": [
1111
+ 176,
1112
+ 674,
1113
+ 434,
1114
+ 691
1115
+ ],
1116
+ "page_idx": 9
1117
+ },
1118
+ {
1119
+ "type": "text",
1120
+ "text": "Learned program analyses offer the promise to improve how we develop software. They also offer a great opportunity to study machine learning models that combine formal and probabilistic reasoning. Towards achieving these we presented BUGLAB, a self-supervised approach for learning program analyses, that improves upon baseline methods and detects bugs in real-life code. We also empirically show the limitations of existing bug-detecting machine learning methods, which suffer from impractical false-positive rates. Importantly, we show the large gap of performance of existing methods on corpora of randomly inserted bugs — commonly used in prior work — and real-life bugs. ",
1121
+ "bbox": [
1122
+ 174,
1123
+ 705,
1124
+ 826,
1125
+ 804
1126
+ ],
1127
+ "page_idx": 9
1128
+ },
1129
+ {
1130
+ "type": "text",
1131
+ "text": "Acknowledgements ",
1132
+ "text_level": 1,
1133
+ "bbox": [
1134
+ 176,
1135
+ 824,
1136
+ 338,
1137
+ 840
1138
+ ],
1139
+ "page_idx": 9
1140
+ },
1141
+ {
1142
+ "type": "text",
1143
+ "text": "We want to thank Sebastian Nowozin and Marwin Segler for helpful discussions, Marwin Segler for comments on a draft of this work, and the anonymous reviewers for useful questions and suggestions. Finally, we would like to thank the contributors to the following open-source tools used: PyTorch [20], PyDriller [27], MessagePack, LibCST, Jedi, Kubernetes, Helm. ",
1144
+ "bbox": [
1145
+ 176,
1146
+ 856,
1147
+ 826,
1148
+ 911
1149
+ ],
1150
+ "page_idx": 9
1151
+ },
1152
+ {
1153
+ "type": "text",
1154
+ "text": "References \n[1] M. Allamanis. The adverse effects of code duplication in machine learning models of code. In Proceedings of the 2019 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, pages 143–153, 2019. \n[2] M. Allamanis, E. T. Barr, P. Devanbu, and C. Sutton. A survey of machine learning for big code and naturalness. ACM Computing Surveys (CSUR), 51(4):1–37, 2018. \n[3] M. Allamanis, M. Brockschmidt, and M. Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations (ICLR), 2018. \n[4] M. Allamanis, E. Barr, S. Ducousso, and Z. Gao. Typilus: Neural type hints. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 91–105. Association for Computing Machinery (ACM), 2020. \n[5] T. Bachlechner, B. P. Majumder, H. H. Mao, G. W. Cottrell, and J. McAuley. Rezero is all you need: Fast convergence at large depth. arXiv preprint arXiv:2003.04887, 2020. \n[6] K. Clark, M.-T. Luong, Q. V. Le, and C. D. Manning. ELECTRA: Pre-training text encoders as discriminators rather than generators. arXiv preprint arXiv:2003.10555, 2020. \n[7] M. Cvitkovic, B. Singh, and A. Anandkumar. Deep learning on code with an unbounded vocabulary. In Machine Learning 4 Programming, 2018. \n[8] M. Dennis, N. Jaques, E. Vinitsky, A. Bayen, S. Russell, A. Critch, and S. Levine. Emergent complexity and zero-shot transfer via unsupervised environment design. arXiv preprint arXiv:2012.02096, 2020. \n[9] E. Dinella, H. Dai, Z. Li, M. Naik, L. Song, and K. Wang. Hoppity: Learning graph transformations to detect and fix bugs in programs. In International Conference on Learning Representations, 2019. \n[10] J. Eberhardt, S. Steffen, V. Raychev, and M. Vechev. Unsupervised learning of API aliasing specifications. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 745–759, 2019. \n[11] J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning, pages 1263–1272, 2017. \n[12] I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial networks. arXiv preprint arXiv:1406.2661, 2014. \n[13] V. J. Hellendoorn, C. Sutton, R. Singh, P. Maniatis, and D. Bieber. Global relational models of source code. In International Conference on Learning Representations, 2020. \n[14] R. Just, D. Jalali, L. Inozemtseva, M. D. Ernst, R. Holmes, and G. Fraser. Are mutants a valid substitute for real faults in software testing? In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, pages 654–665, 2014. \n[15] A. Kanade, P. Maniatis, G. Balakrishnan, and K. Shi. Learning and evaluating contextual embedding of source code. In International Conference on Machine Learning (ICML), 2020. \n[16] R.-M. Karampatsis and C. Sutton. How often do single-statement bugs occur? the ManySStuBs4J dataset. In Proceedings of the 17th International Conference on Mining Software Repositories, pages 573–577, 2020. \n[17] J. Katz. Libraries.io Open Source Repository and Dependency Metadata, Jan. 2020. URL https://doi.org/10.5281/zenodo.3626071. \n[18] Y. Li, D. Tarlow, M. Brockschmidt, and R. Zemel. Gated graph sequence neural networks. In International Conference on Learning Representations (ICLR), 2016. ",
1155
+ "bbox": [
1156
+ 171,
1157
+ 87,
1158
+ 830,
1159
+ 922
1160
+ ],
1161
+ "page_idx": 10
1162
+ },
1163
+ {
1164
+ "type": "text",
1165
+ "text": "[19] S. Merity, C. Xiong, J. Bradbury, and R. Socher. Pointer sentinel mixture models. In International Conference on Learning Representations (ICLR), 2017. ",
1166
+ "bbox": [
1167
+ 171,
1168
+ 90,
1169
+ 826,
1170
+ 121
1171
+ ],
1172
+ "page_idx": 11
1173
+ },
1174
+ {
1175
+ "type": "text",
1176
+ "text": "[20] A. Paszke, S. Gross, S. Chintala, G. Chanan, E. Yang, Z. DeVito, Z. Lin, A. Desmaison, L. Antiga, and A. Lerer. Automatic differentiation in PyTorch. 2017. \n[21] J. Patra and M. Pradel. Semantic bug seeding: a learning-based approach for creating realistic bugs. In Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pages 906–918, 2021. \n[22] M. Pradel and K. Sen. DeepBugs: A learning approach to name-based bug detection. Proceedings of the ACM on Programming Languages, 2(OOPSLA):1–25, 2018. \n[23] G. Ramakrishnan, J. Henkel, Z. Wang, A. Albarghouthi, S. Jha, and T. Reps. Semantic robustness of models of source code. arXiv preprint arXiv:2002.03043, 2020. \n[24] B. Ray, V. Hellendoorn, S. Godhane, Z. Tu, A. Bacchelli, and P. Devanbu. On the ”naturalness” of buggy code. In 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE), pages 428–439. IEEE, 2016. \n[25] V. Raychev, M. Vechev, and A. Krause. Predicting program properties from Big Code. In Principles of Programming Languages (POPL), 2015. \n[26] A. Rice, E. Aftandilian, C. Jaspan, E. Johnston, M. Pradel, and Y. Arroyo-Paredes. Detecting argument selection defects. Proceedings of the ACM on Programming Languages, 1(OOPSLA): 1–22, 2017. \n[27] D. Spadini, M. Aniche, and A. Bacchelli. PyDriller: Python framework for mining software repositories. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering - ESEC/FSE 2018, pages 908–911, New York, New York, USA, 2018. ACM Press. ISBN 9781450355735. doi: 10.1145/3236024.3264598. URL http://dl.acm.org/citation. cfm?doid $\\equiv$ 3236024.3264598. \n[28] D. Tarlow, S. Moitra, A. Rice, Z. Chen, P.-A. Manzagol, C. Sutton, and E. Aftandilian. Learning to fix build errors with Graph2Diff neural networks. In Proceedings of the IEEE/ACM 42nd International Conference on Software Engineering Workshops, pages 19–20, 2020. \n[29] H. Touvron, M. Cord, A. Sablayrolles, G. Synnaeve, and H. Jegou. Going deeper with image ´ transformers. arXiv preprint arXiv:2103.17239, 2021. \n[30] M. Vasic, A. Kanade, P. Maniatis, D. Bieber, and R. Singh. Neural program repair by jointly learning to localize and repair. arXiv preprint arXiv:1904.01720, 2019. \n[31] K. Wang and Z. Su. Blended, precise semantic program embeddings. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 121–134, 2020. \n[32] S. Wang, D. Chollak, D. Movshovitz-Attias, and L. Tan. Bugram: bug detection with n-gram language models. In Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, pages 708–719, 2016. \n[33] J. Wei, M. Goyal, G. Durrett, and I. Dillig. LambdaNet: Probabilistic type inference using graph neural networks. arXiv preprint arXiv:2005.02161, 2020. ",
1177
+ "bbox": [
1178
+ 169,
1179
+ 98,
1180
+ 828,
1181
+ 785
1182
+ ],
1183
+ "page_idx": 11
1184
+ }
1185
+ ]
parse/train/zOngaSKrElL/zOngaSKrElL_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/zOngaSKrElL/zOngaSKrElL_model.json ADDED
The diff for this file is too large to render. See raw diff