Datasets:
Add files using upload-large-folder tool
Browse files- md/train/27acGyyI1BY/27acGyyI1BY.md +408 -0
- md/train/3qMwV98zLIk/3qMwV98zLIk.md +284 -0
- md/train/5UZ-AcwFDKJ/5UZ-AcwFDKJ.md +254 -0
- md/train/AHOs7Sm5H7R/AHOs7Sm5H7R.md +0 -0
- md/train/B1ElR4cgg/B1ElR4cgg.md +365 -0
- md/train/B1l6qiR5F7/B1l6qiR5F7.md +300 -0
- md/train/BJlRs34Fvr/BJlRs34Fvr.md +350 -0
- md/train/BJwFrvOeg/BJwFrvOeg.md +262 -0
- md/train/BkgrBgSYDS/BkgrBgSYDS.md +0 -0
- md/train/BkrSv0lA-/BkrSv0lA-.md +507 -0
- md/train/BydjJte0-/BydjJte0-.md +385 -0
- md/train/ChWy1anEuow/ChWy1anEuow.md +396 -0
- md/train/GWRkOYr4jxQ/GWRkOYr4jxQ.md +301 -0
- md/train/H1loF2NFwr/H1loF2NFwr.md +393 -0
- md/train/H1uR4GZRZ/H1uR4GZRZ.md +314 -0
- md/train/HJDBUF5le/HJDBUF5le.md +312 -0
- md/train/HJgEMpVFwB/HJgEMpVFwB.md +274 -0
- md/train/HJlnC1rKPB/HJlnC1rKPB.md +433 -0
- md/train/HJx38iC5KX/HJx38iC5KX.md +303 -0
- md/train/HJxJ2h4tPr/HJxJ2h4tPr.md +375 -0
- md/train/Hk2aImxAb/Hk2aImxAb.md +241 -0
- md/train/HkpbnH9lx/HkpbnH9lx.md +402 -0
- md/train/HkxJpnVtPr/HkxJpnVtPr.md +0 -0
- md/train/Hyg96gBKPS/Hyg96gBKPS.md +334 -0
- md/train/HygBZnRctX/HygBZnRctX.md +472 -0
- md/train/LyjH88yV7F/LyjH88yV7F.md +215 -0
- md/train/OAMrSPRRxJx/OAMrSPRRxJx.md +433 -0
- md/train/OG18MI5TRL/OG18MI5TRL.md +315 -0
- md/train/QRBvLayFXI/QRBvLayFXI.md +257 -0
- md/train/S1xBioR5KX/S1xBioR5KX.md +400 -0
- md/train/SJe5P6EYvS/SJe5P6EYvS.md +270 -0
- md/train/SJeLIgBKPS/SJeLIgBKPS.md +0 -0
- md/train/SkYMnLxRW/SkYMnLxRW.md +256 -0
- md/train/SyevDaVYwr/SyevDaVYwr.md +354 -0
- md/train/SylOlp4FvH/SylOlp4FvH.md +500 -0
- md/train/SywMS6ZfM/SywMS6ZfM.md +517 -0
- md/train/YqYt54gU-XV/YqYt54gU-XV.md +346 -0
- md/train/_89s8ViNwwj/_89s8ViNwwj.md +269 -0
- md/train/mjyMGFL8N2/mjyMGFL8N2.md +331 -0
- md/train/nCY83KxoehA/nCY83KxoehA.md +460 -0
- md/train/pvCLqcsLJ1N/pvCLqcsLJ1N.md +382 -0
- md/train/rk6H0ZbRb/rk6H0ZbRb.md +334 -0
- md/train/rkecl1rtwB/rkecl1rtwB.md +320 -0
- md/train/rkl03ySYDH/rkl03ySYDH.md +352 -0
- md/train/ryZ283gAZ/ryZ283gAZ.md +448 -0
- md/train/ryebG04YvB/ryebG04YvB.md +268 -0
- md/train/ryrGawqex/ryrGawqex.md +310 -0
- md/train/v8b3e5jN66j/v8b3e5jN66j.md +304 -0
- md/train/vYVI1CHPaQg/vYVI1CHPaQg.md +601 -0
- md/train/weBSeGTv0i/weBSeGTv0i.md +419 -0
md/train/27acGyyI1BY/27acGyyI1BY.md
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NEURAL ODE PROCESSES
|
| 2 |
+
|
| 3 |
+
Cristian Bodnar∗, Ben Day∗, Jacob Moss∗ & Pietro Lio\`
|
| 4 |
+
|
| 5 |
+
Alexander Norcliffe∗ † Department of Computer Science University College London London, United Kingdom ucabino@ucl.ac.uk
|
| 6 |
+
|
| 7 |
+
Department of Computer Science
|
| 8 |
+
University of Cambridge
|
| 9 |
+
Cambridge, United Kingdom
|
| 10 |
+
{cb2015, bjd39, jm2311, pl219}@cam.ac.uk
|
| 11 |
+
|
| 12 |
+
# ABSTRACT
|
| 13 |
+
|
| 14 |
+
Neural Ordinary Differential Equations (NODEs) use a neural network to model the instantaneous rate of change in the state of a system. However, despite their apparent suitability for dynamics-governed time-series, NODEs present a few disadvantages. First, they are unable to adapt to incoming data-points, a fundamental requirement for real-time applications imposed by the natural direction of time. Second, time-series are often composed of a sparse set of measurements that could be explained by many possible underlying dynamics. NODEs do not capture this uncertainty. In contrast, Neural Processes (NPs) are a new class of stochastic processes providing uncertainty estimation and fast data-adaptation, but lack an explicit treatment of the flow of time. To address these problems, we introduce Neural ODE Processes (NDPs), a new class of stochastic processes determined by a distribution over Neural ODEs. By maintaining an adaptive data-dependent distribution over the underlying ODE, we show that our model can successfully capture the dynamics of low-dimensional systems from just a few data-points. At the same time, we demonstrate that NDPs scale up to challenging high-dimensional time-series with unknown latent dynamics such as rotating MNIST digits.
|
| 15 |
+
|
| 16 |
+
# 1 INTRODUCTION
|
| 17 |
+
|
| 18 |
+
Many time-series that arise in the natural world, such as the state of a harmonic oscillator, the populations in an ecological network or the spread of a disease, are the product of some underlying dynamics. Sometimes, as in the case of a video of a swinging pendulum, these dynamics are latent and do not manifest directly in the observation space. Neural Ordinary Differential Equations (NODEs) (Chen et al., 2018), which use a neural network to parametrise the derivative of an ODE, have become a natural choice for capturing the dynamics of such time-series (C¸ agatay Yıldız et al., ˘ 2019; Rubanova et al., 2019; Norcliffe et al., 2020; Kidger et al., 2020; Morrill et al., 2020).
|
| 19 |
+
|
| 20 |
+
However, despite their fundamental connection to dynamics-governed time-series, NODEs present certain limitations that hinder their adoption in these settings. Firstly, NODEs cannot adjust predictions as more data is collected without retraining the model. This ability is particularly important for real-time applications, where it is desirable that models adapt to incoming data points as time passes and more data is collected. Secondly, without a larger number of regularly spaced measurements, there is usually a range of plausible underlying dynamics that can explain the data. However, NODEs do not capture this uncertainty in the dynamics. As many real-world time-series are comprised of sparse sets of measurements, often irregularly sampled, the model can fail to represent the diversity of suitable solutions. In contrast, the Neural Process (Garnelo et al., 2018a;b) family offers a class of (neural) stochastic processes designed for uncertainty estimation and fast adaptation to changes in the observed data. However, NPs modelling time-indexed random functions lack an explicit treatment of time. Designed for the general case of an arbitrary input domain, they treat time as an unordered set and do not explicitly consider the time-delay between different observations.
|
| 21 |
+
|
| 22 |
+
To address these limitations, we introduce Neural ODE Processes (NDPs), a new class of stochastic processes governed by stochastic data-adaptive dynamics. Our probabilistic Neural ODE formulation relies on and extends the framework provided by NPs, and runs parallel to other attempts to incorporate application-specific inductive biases in this class of models such as Attentive NPs (Kim et al., 2019), ConvCNPs (Gordon et al., 2019), and MPNPs (Day et al., 2020). We demonstrate that NDPs can adaptively capture many potential dynamics of low-dimensional systems when faced with limited amounts of data. Additionally, we show that our approach scales to high-dimensional time series with latent dynamics such as rotating MNIST digits (Casale et al., 2018). Our code and datasets are available at https://github.com/crisbodnar/ndp.
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
Figure 1: Schematic diagram of Neural ODE Processes. Left: Observations from a time series, the context set $\bullet$ , are encoded and aggregated to form $\mathbfit { \Delta } \mathbf { r }$ which parametrises the latent variables $D$ and $L _ { 0 }$ . Middle: A sample is drawn from $L _ { 0 }$ and $D$ , initialising and conditioning the ODE, respectively. Each sample produces a plausible, coherent trajectory. Right: Predictions at a target time, $t _ { i } ^ { \mathbb { T } }$ , are made by decoding the state of the ODE, $l ( t _ { i } ^ { \mathbb { T } } )$ together with $t _ { i } ^ { \mathbb { T } }$ . An example is shown with the $\bigcirc$ connected from the ODE position plot to the Predictions plot. Middle & right: the bold lines in each plot refer to the same sample, fainter lines to other samples. $A l l$ : The plots are illustrations only.
|
| 26 |
+
|
| 27 |
+
# 2 BACKGROUND AND FORMAL PROBLEM STATEMENT
|
| 28 |
+
|
| 29 |
+
Problem Statement We consider modelling random functions $F : \mathcal T \to \mathcal y$ , where $\boldsymbol { \mathcal { T } } = [ t _ { 0 } , \infty )$ represents time and $\mathcal { V } \subset \mathbb { R } ^ { d }$ is a compact subset of $\mathbb { R } ^ { d }$ . We assume $F$ has a distribution $\mathcal { D }$ , induced by another distribution $\mathcal { D } ^ { \prime }$ over some underlying dynamics that govern the time-series. Given a specific instantation $\mathcal { F }$ of $F$ , let $\mathbb { C } = \{ ( t _ { i } ^ { \mathbb { C } } , y _ { i } ^ { \mathbb { C } } ) \} _ { i \in I _ { \mathbb { C } } }$ be a set of samples from $\mathcal { F }$ with some indexing set $I _ { \mathbb { C } }$ . We refer to $\mathbb { C }$ as the context points, as denoted by the superscript $\mathbb { C }$ . For a given context $\mathbb { C }$ , the task is to predict the values $\{ \hat { y } _ { j } ^ { \mathbb { T } } \} _ { j \in I _ { \mathbb { T } } }$ that $\mathcal { F }$ takes at a set of target times $\{ t _ { j } ^ { \mathbb { T } } \} _ { j \in I _ { \mathbb { T } } }$ , where $I _ { \mathbb { T } }$ is another index set. We call $\mathbb { T } = \{ ( t _ { j } ^ { \mathbb { T } } , y _ { j } ^ { \mathbb { T } } ) \}$ the target set. Additionally let $t _ { \mathbb { C } } = \{ t _ { i } | i \in I _ { \mathbb { C } } \}$ and similarly define $y _ { \mathbb { C } } , t _ { \mathbb { T } }$ and $y _ { \mathbb { T } }$ . Conventionally, as in Garnelo et al. (2018b), the target set forms a superset of the context set and we have $\mathbb { C } \subseteq \mathbb { T }$ . Optionally, it might also be natural to consider that the initial time and observation $( t _ { 0 } , y _ { 0 } )$ are always included in $\mathbb { C }$ . During training, we let the model learn from a dataset of (potentially irregular) time-series sampled from $F$ . We are interested in learning the underlying distribution over the dynamics as well as the induced distribution over functions. We note that when the dynamics are not latent and manifest directly in the observation space $\mathcal { V }$ , the distribution over ODE trajectories and the distribution over functions coincide.
|
| 30 |
+
|
| 31 |
+
Neural ODEs NODEs are a class of models that parametrize the velocity $\dot { z }$ of a state $_ z$ with the help of a neural network $\dot { z } = f _ { \theta } ( z , t )$ . Given the initial time $t _ { 0 }$ and target time $t _ { i } ^ { \mathbb { T } }$ , NODEs predict the corresponding state $\hat { y } _ { i } ^ { \mathbb { T } }$ by performing the following integration and decoding operations:
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
z ( t _ { 0 } ) = h _ { 1 } ( y _ { 0 } ) , \qquad z ( t _ { i } ^ { \mathbb { T } } ) = z ( t _ { 0 } ) + \int _ { t _ { 0 } } ^ { t _ { i } ^ { \mathbb { T } } } f _ { \theta } ( z ( t ) , t ) d t , \qquad \hat { y } _ { i } ^ { \mathbb { T } } = h _ { 2 } ( z ( t _ { i } ^ { \mathbb { T } } ) ) ,
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
where $h _ { 1 }$ and $h _ { 2 }$ can be neural networks. When the dimensionality of $_ { z }$ is greater than that of $\textbf { { y } }$ and $h _ { 1 } , h _ { 2 }$ are linear, the resulting model is an Augmented Neural ODE (Dupont et al., 2019) with input layer augmentation (Massaroli et al., 2020). The extra dimensions offer the model additional flexibility as well as the ability to learn higher-order dynamics (Norcliffe et al., 2020).
|
| 38 |
+
|
| 39 |
+
Neural Processes (NPs) NPs model a random function $F : \mathcal { X } \mathcal { Y }$ , where $\mathcal { X } \subseteq \mathbb { R } ^ { d _ { 1 } }$ and $\mathcal { V } \subseteq \mathbb { R } ^ { d _ { 2 } }$ . The NP represents a given instantiation $\mathcal { F }$ of $F$ through the global latent variable $_ { z }$ , which parametrises the variation in $F$ . Thus, we have $\mathcal { F } ( \pmb { x } _ { i } ) = g ( \pmb { x } _ { i } , z )$ . For a given context set $\mathbb { C } = \{ ( \pmb { x } _ { i } ^ { \mathbb { C } } , \pmb { y } _ { i } ^ { \mathbb { C } } ) \}$ and target set $\pmb { x } _ { 1 : n } , \pmb { y } _ { 1 : n }$ , the generative process is given by:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
p ( \pmb { y } _ { 1 : n } , z | \pmb { x } _ { 1 : n } , \mathbb { C } ) = p ( z | \mathbb { C } ) \prod _ { i = 1 } ^ { n } \mathcal { N } ( \pmb { y } _ { i } | g ( \pmb { x } _ { i } , z ) , \sigma ^ { 2 } ) ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where $p ( z )$ is chosen to be a multivariate standard normal distribution and $\pmb { y } _ { 1 : n }$ is a shorthand for the sequence $\left( \pmb { y } _ { 1 } , \dots , \pmb { y } _ { n } \right)$ . The model can be trained using an amortised variational inference procedure that naturally gives rise to a permutation-invariant encoder $q _ { \theta } ( z | \mathbb { C } )$ , which stores the information about the context points. Conditioned on this information, the decoder $g ( { \pmb x } , z )$ can make predictions at any input location $_ { \textbf { \em x } }$ . We note that while the domain $\mathcal { X }$ of the random function $F$ is arbitrary, in this work we are interested only in stochastic functions with domain on the real line (time-series). Therefore, from here our notation will reflect that, using $t$ as the input instead of $_ { \textbf { \em x } }$ . The output $\textbf { { y } }$ remains the same.
|
| 46 |
+
|
| 47 |
+
# 3 NEURAL ODE PROCESSES
|
| 48 |
+
|
| 49 |
+
Model Overview We introduce Neural ODE Processes (NDPs), a class of dynamics-based models that learn to approximate random functions defined over time. To that end, we consider an NP whose context is used to determine a distribution over ODEs. Concretely, the context infers a distribution over the initial position (and optionally – the initial velocity) and, at the same time, stochastically controls its derivative function. The positions given by the ODE trajectories at any time $t _ { i } ^ { \mathbb { T } }$ are then decoded to give the predictions. In what follows, we offer a detailed description of each component of the model. A schematic of the model can be seen in Figure 1.
|
| 50 |
+
|
| 51 |
+
# 3.1 GENERATIVE PROCESS
|
| 52 |
+
|
| 53 |
+
We first describe the generative process behind NDPs. A graphical model perspective of this process is also included in Figure 2.
|
| 54 |
+
|
| 55 |
+
Encoder and Aggregator Consider a given context set $\mathbb { C } =$ $\{ ( t _ { i } ^ { \mathbb { C } } , { \pmb y } _ { i } ^ { \mathbb { C } } ) \} _ { i \in I _ { \mathbb { C } } }$ of observed points. We encode this context into two latent variables $L ( t _ { 0 } ) \sim q _ { L } ( l ( t _ { 0 } ) | \mathbb { C } )$ and $D \sim q _ { D } ( d | \mathbb { C } )$ , representing the initial state and the global control of an ODE, respectively. To parametrise the distribution of the latter variable, the NDP encoder produces a representation $\pmb { r } _ { i } = f _ { e } \big ( \big ( t _ { i } ^ { \mathbb { C } } , \pmb { y } _ { i } ^ { \mathbb { C } } \big ) \big )$ for each context pair $( t _ { i } ^ { \mathbb { C } } , \pmb { y } _ { i } ^ { \mathbb { C } } )$ . The function $f _ { e }$ is as a neural network, fully connected or convolutional, depending on the nature of $\textbf { { y } }$ . An aggregator combines all the representations $\mathbf { \nabla } _ { \mathbf { r } _ { i } }$ to form a global representation, $\pmb { r }$ , that parametrises the distribution of the global latent context, $D \sim q _ { D } ( \mathbf { \boldsymbol { d } } | \mathbb { C } ) = \mathcal { N } \big ( \boldsymbol { z } | \mu _ { D } ( \boldsymbol { r } ) , \operatorname { d i a g } ( \boldsymbol { \sigma } _ { D } ( \boldsymbol { r } ) ) \big )$ . As the aggregator must preserve order invariance, we choose to take the element-wise mean. The distribution of $L _ { 0 }$ might be parametrised identically as a function of the whole context by $q _ { L } ( \pmb { d } | \mathbb { C } )$ , and, in particular, if the initial observation $\mathbf { { \boldsymbol { \psi } } } _ { 0 }$ is always known, then $q _ { L } ( \bar { l } ( 0 ) | \mathbb { C } ) = q _ { L } ( l ( 0 ) | y _ { 0 } ) = \mathcal { N } \big ( l ( 0 ) | \mu _ { L } ( y _ { 0 } ) , \mathrm { d i a g } ( \sigma _ { L } ( y _ { 0 } ) ) \big ) .$ .
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
Figure 2: Graphical model of NDPs. The dark nodes denote observed random variables, while the light nodes denote hidden random variables. $I _ { \mathbb { C } }$ and $I _ { \mathbb { T } }$ represent the indexing sets for the context and target points, respectively. Full arrows show the generative process. Dotted arrows indicate inference.
|
| 59 |
+
|
| 60 |
+
Latent ODE To obtain a distribution over functions, we are interested in capturing the dynamics that govern the time-series and exploiting the temporal nature of the data. To that end, we allow the latent context to evolve according to a Neural ODE (Chen et al., 2018) with initial position $L ( 0 )$ and controlled by $D$ . These two random variables factorise the uncertainty in the underlying dynamics into an uncertainty over the initial conditions (given by $L ( t _ { 0 } ) \dot { { \mathrm { . } } }$ ) and an uncertainty over the ODE derivative, given by $D$ .
|
| 61 |
+
|
| 62 |
+
By using the target times, $t _ { 1 : n } ^ { \mathbb { T } } = ( t _ { 1 } ^ { \mathbb { T } } , . . . , t _ { N } ^ { \mathbb { T } } )$ , the latent state at a given time is found by evolving a Neural ODE:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\boldsymbol { l } ( t _ { i } ^ { \mathbb { T } } ) = \boldsymbol { l } ( t _ { 0 } ) + \int _ { t _ { 0 } } ^ { t _ { i } ^ { \mathbb { T } } } \boldsymbol { f } _ { \theta } ( \boldsymbol { l } ( t ) , \boldsymbol { d } , t ) \boldsymbol { d } t ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $f _ { \theta }$ is a neural network that models the derivative of $\imath$ . As explained above, we allow $^ d$ to modulate the derivative of this ODE by acting as a global control signal. Ultimately, for fixed initial conditions, this results in an uncertainty over the ODE trajectories.
|
| 69 |
+
|
| 70 |
+
Decoder To obtain a prediction at a time $t _ { i } ^ { \mathbb { T } }$ , we decode the random state of the ODE at time $t _ { i } ^ { \mathbb { T } }$ , given by $L ( t _ { i } ^ { \mathbb { T } } )$ . Assuming that the outputs are noisy, for a given sample $l ( t _ { i } ^ { \mathbb { T } } )$ from this stochastic state, the decoder $g$ produces a distribution over $Y _ { t _ { i } } ^ { \mathbb { T } } \sim p \big ( { y } _ { i } ^ { \mathbb { T } } | g ( l ( t _ { i } ^ { \mathbb { T } } ) , t _ { i } ) \big )$ parametrised by the decoder output. Concretely, for regression tasks, we take the target output to be normally distributed with constant (or optionally learned) variance $Y _ { t _ { i } } ^ { \mathbb { T } } \sim \mathcal { N } \big ( { \pmb y } _ { i } | g ( \bar { l } ( t _ { i } ) , t _ { i } \big ) , \sigma ^ { 2 } \big )$ . When $Y _ { t _ { i } } ^ { \mathbb { T } }$ is a random vector formed of independent binary random variables (e.g. a black and white image), we use a Bernoulli distribution $\begin{array} { r } { Y _ { t _ { i } } ^ { \mathbb { T } } \sim \prod _ { j = 1 } ^ { \dim ( Y ) } } \end{array}$ Bernoulli $\left( g ( l ( t _ { i } ) , t _ { i } ) _ { j } \right)$ .
|
| 71 |
+
|
| 72 |
+
Putting everything together, for a set of observed context points $\mathbb { C }$ , the generative process of NDPs is given by the expression below, where we emphasise once again that $\displaystyle l ( t _ { i } )$ also implicitly depends on $\boldsymbol { l } ( 0 )$ and $^ d$ .
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
p ( \pmb { y } _ { 1 : n } , l ( 0 ) , d | t _ { 1 : n } , \mathbb { C } ) = p \big ( l ( 0 ) | \mathbb { C } \big ) p ( d | \mathbb { C } \big ) \prod _ { i = 1 } ^ { n } p \big ( \pmb { y } _ { i } | g ( l ( t _ { i } ) , t _ { i } ) \big ) ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
We remark that NDPs generalise NPs defined over time. If the latent NODE learns the trivial velocity $f _ { \theta } ( l ( t ) , \pmb { d } , t ) = 0$ , the random state $L ( t ) = L ( t _ { 0 } )$ remains constant at all times $t$ . In this case, the distribution over functions is directly determined by $L ( t _ { 0 } ) \sim p ( l ( t _ { 0 } ) | \mathbb { C } )$ , which substitutes the random variable $Z$ from a regular NP. For greater flexibility, the control signal $^ d$ can also be supplied to the decoder ${ \mathbf { } } g ( l ( t ) , d , t )$ . This shows that, in principle, NDPs are at least as expressive as NPs. Therefore, NDPs could be a sensible choice even in applications where the time-series are not solely determined by some underlying dynamics, but are also influenced by other generative factors.
|
| 79 |
+
|
| 80 |
+
# 3.2 LEARNING AND INFERENCE
|
| 81 |
+
|
| 82 |
+
Since the true posterior is intractable because of the highly non-linear generative process, the model is trained using an amortised variational inference procedure. The variational lower-bound on the probability of the target values given the known context $\log p ( y _ { \mathbb { T } } | t _ { \mathbb { T } } , y _ { \mathbb { C } } )$ is as follows:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\mathbb { E } _ { q } \big ( l ( t _ { 0 } ) , d | t _ { \mathbb { T } } , y \mathbb { r } \big ) \left[ \sum _ { i \in I _ { \mathbb { T } } } \log p ( y _ { i } | l ( t _ { 0 } ) , d , t _ { i } ) + \log \frac { q _ { L } ( l ( t _ { 0 } ) | t _ { \mathbb { C } } , y _ { \mathbb { C } } ) } { q _ { L } ( l ( t _ { 0 } ) | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } + \log \frac { q _ { D } ( d | t _ { \mathbb { C } } , y _ { \mathbb { C } } ) } { q _ { D } ( d | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \right] ,
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where $q _ { L } , q _ { D }$ give the variational posteriors (the encoders described in Section 3.1). The full derivation can be found in Appendix B. We use the reparametrisation trick to backpropagate the gradients of this loss. During training, we sample random contexts of different sizes to allow the model to become sensitive to the size of the context and the location of its points. We train using mini-batches composed of multiple contexts. For that, we use an extended ODE that concatenates the independent ODE states of each sample in the batch and integrates over the union of all the times in the batch (Rubanova et al., 2019). Pseudo-code for this training procedure is also given in Appendix $\textrm { C }$ .
|
| 89 |
+
|
| 90 |
+
# 3.3 MODEL VARIATIONS
|
| 91 |
+
|
| 92 |
+
Here we present the different ways to implement the model. The majority of the variation is in the architecture of the decoder. However, it is possible to vary the encoder such that $f _ { e } \big ( ( t _ { i } ^ { \mathbb { C } } , y _ { i } ^ { \mathbb { C } } ) \big )$ can be a multi-layer-perceptron, or additionally contain convolutions.
|
| 93 |
+
|
| 94 |
+
Neural ODE Process (NDP) In this setup the decoder is an arbitrary function $g ( l ( t _ { i } ^ { \mathbb { T } } ) , d , t _ { i } ^ { \mathbb { T } } )$ of the latent position at the time of interest, the control signal, and time. This type of model is particularly suitable for high-dimensional time-series where the dynamics are fundamentally latent. The inclusion of $^ d$ in the decoder offers the model additional flexibility and makes it a good default choice for most tasks.
|
| 95 |
+
|
| 96 |
+
Second Order Neural ODE Process (ND2P) This variation has the same decoder architecture as NDP, however the latent ODE evolves according to a second order ODE. The latent state, $\imath$ , is split into a “position”, $\boldsymbol { l } _ { 1 }$ and “velocity”, $l _ { 2 }$ , with $\dot { l _ { 1 } } = { l _ { 2 } }$ and $\dot { l _ { 2 } } = f _ { \theta } ( l _ { 1 } , l _ { 2 } , d , t )$ . This model is designed for time-series where the dynamics are second-order, which is often the case for physical systems (C¸ agatay Yıldız et al., 2019; Norcliffe et al., 2020). ˘
|
| 97 |
+
|
| 98 |
+
NDP Latent-Only (NDP-L) The decoder is a linear transformation of the latent state $\begin{array} { r l } { g ( l ( t _ { i } ^ { \mathbb { T } } ) ) = } \end{array}$ $W ( l ( t _ { i } ^ { \mathbb { T } } ) ) + b$ . This model is suitable for the setting when the dynamics are fully observed (i.e. they are not latent) and, therefore, do not require any decoding. This would be suitable for simple functions generated by ODEs, for example, sines and exponentials. This decoder implicitly contains information about time and $^ d$ because the ODE evolution depends on these variables as described in Equation 3.
|
| 99 |
+
|
| 100 |
+
ND2P Latent-Only (ND2P-L) This model combines the assumption of second-order dynamics with the idea that the dynamics are fully observed. The decoder is a linear layer of the latent state as in NDP-L and the phase space dynamics are constrained as in ND2P.
|
| 101 |
+
|
| 102 |
+
# 3.4 NEURAL ODE PROCESSES AS STOCHASTIC PROCESSES
|
| 103 |
+
|
| 104 |
+
The Kolmogorov Extension Theorem states that exchangeability and consistency are necessary and sufficient conditions for a collection of joint marginal distributions to define a stochastic process Øksendal (2003); Garnelo et al. (2018b). We define these conditions and show that the NDP model satisfies them. The proofs can be found in Appendix A.
|
| 105 |
+
|
| 106 |
+
Definition 3.1 (Exchangeability). Exchangeability refers to the invariance of the joint distribution $\rho _ { t _ { 1 : n } } ( \pmb { y } _ { 1 : n } )$ under permutations of $\scriptstyle { \pmb { y } } _ { 1 : n }$ . That is, for a permutation $\pi$ of $\{ 1 , 2 , . . . , n \}$ , $\pi ( t _ { 1 : n } ) =$ $\left( t _ { \pi ( 1 ) } , . . . , t _ { \pi ( n ) } \right)$ and $\pi ( \pmb { y } _ { 1 : n } ) = ( \pmb { y } _ { \pi ( 1 ) } , . . . , \pmb { y } _ { \pi ( n ) } )$ , the joint probability distribution $\rho _ { t _ { 1 : n } } ( \pmb { y } _ { 1 : n } )$ is invariant if $\rho _ { t _ { 1 : n } } ( { \pmb y } _ { 1 : n } ) = \rho _ { \pi ( t _ { 1 : n } ) } ( \pi ( { \pmb y } _ { 1 : n } ) )$ .
|
| 107 |
+
|
| 108 |
+
Proposition 3.1. NDPs satisfy the exchangeability condition.
|
| 109 |
+
|
| 110 |
+
Definition 3.2 (Consistency). Consistency says if a part of a sequence is marginalised out, then the joint probability distribution is the same as if it was only originally taken from the smaller sequence $\begin{array} { r } { \rho _ { t _ { 1 : m } } ( { \pmb y } _ { 1 : m } ) = \mathbf { \bar { \int } } \rho _ { t _ { 1 : n } } ( { \pmb y } _ { 1 : n } ) d { \pmb y } _ { m + 1 : n } } \end{array}$ .
|
| 111 |
+
|
| 112 |
+
Proposition 3.2. NDPs satisfy the consistency condition.
|
| 113 |
+
|
| 114 |
+
It is important to note that the stochasticity comes from sampling the latent $\boldsymbol { l } ( 0 )$ and $^ d$ . There is no stochasticity within the ODE, such as Brownian motion, though stochastic ODEs have previously been explored (Liu et al., 2019; Tzen & Raginsky, 2019; Jia & Benson, 2020; Li et al., 2020). For any given pair $\boldsymbol { l } ( 0 )$ and $^ d$ , both the latent state trajectory and the observation space trajectory are fully determined. We also note that outside the NP family and differently from our approach, NODEs have been used to generate continuous stochastic processes by transforming the density of another latent process (Deng et al., 2020).
|
| 115 |
+
|
| 116 |
+
# 3.5 RUNNING TIME COMPLEXITY
|
| 117 |
+
|
| 118 |
+
For a model with $n$ context points and $m$ target points, an NP has running time complexity $O ( n { + } m )$ , since the model only has to encode each context point and decode each target point. However, a Neural ODE Process has added complexity due to the integration process. Firstly, the integration itself has runtime complexity $O ( \mathrm { N F E } )$ , where NFE is the number of function evaluations. In turn, the worst-case NFE depends on the minimum step size $\delta$ the ODE solver has to use and the maximum time we are interested in, which we denote by $t _ { \mathrm { m a x } }$ . Secondly, for settings where the target times are not already ordered, an additional $O ( m \log ( m ) )$ term is added for sorting them. This ordering is required by the ODE solver.
|
| 119 |
+
|
| 120 |
+
Therefore, given that $m \geq n$ and assuming a constant $t _ { \mathrm { m a x } }$ exists, the worst-case complexity of NDPs is $O \big ( m \log ( m ) \big )$ . For applications where the times are already sorted (e.g. real-time applications), the complexity falls back to the original $O ( n + m )$ . In either case, NDPs scale well with the size of the input. We note, however, that the integration steps $\left. t _ { \operatorname* { m a x } } \right/ \delta$ could result in a very large constant, hidden by the big- $O$ notation. Nonetheless, modern ODE solvers use adaptive step sizes that adjust to the data that has been supplied and this should alleviate this problem. In our experiments, when sorting is used, we notice the NDP models are between 1 and 1.5 orders of magnitude slower to train than NPs in terms of wall-clock time. At the same time, this limitation of the method is traded-off by a significantly faster loss decay per epoch and superior final performance. We provide a table of time ratios from our 1D experiments, from section 4.1, in Appendix D.
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
Figure 3: We present example posteriors of trained models and the loss during training of the NP and NDP models for the sine data. We find that NDPs are able to produce a greater range of functions when a single context point is provided, and a sharper, better targeted range as more points in the time series are observed. Quantitatively, NDPs train to a lower loss in fewer epochs, as may be expected for functions that are generated by ODEs. Both models were trained for 30 epochs.
|
| 124 |
+
|
| 125 |
+
# 4 EXPERIMENTS
|
| 126 |
+
|
| 127 |
+
To test the proposed advantages of NDPs we carried out various experiments on time series data. For the low-dimensional experiments in Sections 4.1 and 4.2, we use an MLP architecture for the encoder and decoder. For the high-dimensional experiments in Section 4.3, we use a convolutional architecture for both. We train the models using RMSprop (Tieleman & Hinton, 2012) with learning rate $1 \times 1 0 ^ { - 3 }$ . Additional model and task details can be found in Appendices F and G, respectively.
|
| 128 |
+
|
| 129 |
+
# 4.1 ONE DIMENSIONAL REGRESSION
|
| 130 |
+
|
| 131 |
+
We begin with a set of 1D regression tasks of differing complexity—sine waves, exponentials, straight lines and damped oscillators—that can be described by ODEs. For each task, the functions are determined by a set of parameters (amplitude, shift, etc) with pre-defined ranges. To generate the distribution over functions, we sample these parameters from a uniform distribution over their respective ranges. We use 490 time-series for training and evaluate on 10 separate test time-series. Each series contains 100 points. We repeat this procedure across 5 different random seeds to compute the standard error. Additional details can be found in Appendix G.1.
|
| 132 |
+
|
| 133 |
+
The left and middle panels of Figure 3 show how NPs and NDPs adapt on the sine task to incoming data points. When a single data-point has been supplied, NPs have incorrectly collapsed the distribution over functions to a set of almost horizontal lines. NDPs, on the other hand, are able to produce a wide range of possible trajectories. Even when a large number of points have been supplied, the NP posterior does not converge on a good fit, whereas NDPs correctly capture the true sine curve. In the right panel of Figure 3, we show the test-set MSE as a function of the training epoch. It can be seen that NDPs train in fewer iterations to a lower test loss despite having approximately $10 \%$ fewer parameters than NPs. We conducted an ablation study, training all model variants on all the 1D datasets, with final test MSE losses provided in Table 1 and training plots in Appendix G.1.
|
| 134 |
+
|
| 135 |
+
We find that NDPs either strongly outperform NPs (sine, linear), or their standard errors overlap (exponential, oscillators). For the exponential and harmonic oscillator tasks, where the models perform similarly, many points are close to zero in each example and as such it is possible to achieve a low MSE score by producing outputs that are also around zero. In contrast, the sine and linear datasets have a significant variation in the $y$ -values over the range, and we observe that NPs perform considerably worse than the NDP models on these tasks.
|
| 136 |
+
|
| 137 |
+
Table 1: Final MSE Loss on 1D regression tasks with standard error (lower is better). Bold indicates that the model performance is within error at the $9 5 \%$ confidence level, with underline indicating the best estimate for top-performer. NPs perform similarly to NDPs and their variants on the exponential and oscillator tasks, where $y$ -values are close to zero. For the sine and linear tasks, where $y$ values vary significantly over the time range, NPs perform worse than NDPs and their variants.
|
| 138 |
+
|
| 139 |
+
<table><tr><td colspan="5">MSE ×10-2</td></tr><tr><td>Model</td><td>Sine</td><td>Linear</td><td>Exponential</td><td> Oscillators</td></tr><tr><td>NP</td><td>5.93 ± 0.96</td><td>5.85 ± 0.70</td><td>0.29 ± 0.03</td><td>0.64 ± 0.06</td></tr><tr><td>NDP</td><td>2.09 ±0.12</td><td>3.76 ± 0.32</td><td>0.31± 0.08</td><td>0.72 ± 0.08</td></tr><tr><td>ND2P</td><td>2.75 ± 0.19</td><td>4.37 ± 1.14</td><td>0.25 ± 0.04</td><td>0.55 ± 0.03</td></tr><tr><td>NDP-L</td><td>2.51 ± 0.24</td><td>4.77 ± 0.67</td><td>0.40 ± 0.04</td><td>0.72 ± 0.04</td></tr><tr><td>ND2P-L</td><td>2.64 ± 0.30</td><td>3.16 ± 0.46</td><td>0.39 ± 0.05</td><td>0.66 ± 0.03</td></tr></table>
|
| 140 |
+
|
| 141 |
+
The difference between NDP and the best of the other model variants is not significant across the set of tasks. As such, we consider only NDPs for the remainder of the paper as this is the least constrained model version: they have unrestricted latent phase-space dynamics, unlike the secondorder counterparts, and a more expressive decoder architecture, unlike the latent-only variants. In addition, NDPs train in a faster wall clock time than the other variants, as shown in Appendix D.
|
| 142 |
+
|
| 143 |
+
Active Learning We perform an active learning experiment on the sines dataset to evaluate both the uncertainty estimates produced by the models and how well they adapt to new information. Provided with an initial context point, additional points are greedily queried according to the model uncertainty. Higher quality uncertainty estimation and better adaptation will result in more information being acquired at each step, and therefore a faster and greater reduction in error. As shown in Figure 4, NDPs also perform better in this setting.
|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
Figure 4: Active learning on the sines dataset. Left: NPs querying the points of highest uncertainty. Middle: NDPs querying the points of highest uncertainty, qualitatively it outperforms NPs. Right: MSE plots of four different querying regimes, NPs and NDPS looking actively and randomly, NDP Active decreases the MSE the fastest.
|
| 147 |
+
|
| 148 |
+
# 4.2 PREDATOR-PREY DYNAMICS
|
| 149 |
+
|
| 150 |
+
The Lotka-Volterra Equations are used to model the dynamics of a two species system, where one species predates on the other. The populations of the prey, $u$ , and the predator, $v$ , are given by the differential equations $\dot { u } = \alpha u - \beta u v , \dot { v } = \delta u v - \gamma v$ , for positive real parameters, $\alpha , \beta , \delta , \gamma$ . Intuitively, when prey is plentiful, the predator population increases $( + \delta u v )$ , and when there are many predators, the prey population falls $( - \beta u v )$ . The populations exhibit periodic behaviour, with the phase-space orbit determined by the conserved quantity $V = \delta u - \bar { \gamma } \ln ( u ) + \beta v - \alpha \ln ( v )$ . Thus for any predator-prey system there exists a range of stable functions describing the dynamics, with any particular realisation being determined by the initial conditions, $( u _ { 0 } , v _ { 0 } )$ . We consider the system $( \bar { \alpha } , \beta , \gamma , \delta ) = ( ^ { 2 } / 3 , ^ { 4 } / 3 , 1 , 1 )$ .
|
| 151 |
+
|
| 152 |
+
We generate sample time-series from the Lotka Volterra system by considering different starting configurations; $( \bar { u } _ { 0 } , v _ { 0 } ) = ( 2 E , E )$ , where $E$ is sampled from a uniform distribution in the range (0.25, 1.0). The training set consists of 40 such samples, with a further 10 samples forming the test set. As before, each time series consists of 100 time samples and we evaluate across 5 different random seeds to obtain a standard error.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 5: NPs and NDPs on the Lotka-Volterra task. Black is used for targets or ground truth, solid lines for mean predictions over 50 samples, and dashed lines for sample trajectories. In the left and middle plots, the shaded regions show the min-max range over 50 samples, in the right plot the shaded region was produced using kernel density estimation. Left: NPs are less able to model the dynamics, diverging from the ground truth even in regions with dense context sampling, whereas the NDP is both more accurate and varies more appropriately. Middle: Plotting the theoretically conserved quantity $V$ better exposes how the models deviate from the ground truth Right: In phase space $( u , v )$ the NDP is more clearly seen to better track the ground truth.
|
| 156 |
+
|
| 157 |
+
We find that NDPs are able to train in fewer epochs to a lower loss (Appendix G.2). We record final test MSEs $( \times 1 0 ^ { - 2 } )$ at $4 4 \pm 4$ for the NPs and $1 5 \pm 2$ for the NDPs. As in the 1D tasks, NDPs perform better despite having a representation $\mathbfit { \Delta } \mathbf { r }$ and context $_ { z }$ with lower dimensionality, leading to $10 \%$ fewer parameters than NPs. Figure 5 presents these advantages for a single time series.
|
| 158 |
+
|
| 159 |
+
# 4.3 VARIABLE ROTATING MNIST
|
| 160 |
+
|
| 161 |
+
To test our model on high-dimensional time-series with latent dynamics, we consider the rotating MNIST digits (Casale et al., 2018; C¸ agatay Yıldız et al., 2019). In the original task, samples of ˘ digit $\mathbf { \overleftarrow { 3 } } \overrightarrow { }$ start upright and rotate once over 16 frames $( = 3 6 0 ^ { \circ } s ^ { - 1 }$ ) (i.e. constant angular velocity, zero angular shift). However, since we are interested in time-series with variable latent dynamics and increased variability in the initial conditions as in our formal problem statement, we consider a more challenging version of the task. In our adaptation, the angular velocity varies between samples in the range $( 3 6 \bar { 0 } ^ { \circ } \pm 6 0 ^ { \circ } ) s ^ { - 1 }$ and each sample starts at a random initial rotation. To induce some irregularity in each time-series in the training dataset, we remove five randomly chosen time-steps (excluding the initial time $t _ { 0 }$ ) from each time-series. Overall, we generate a dataset with 1, 000 training time-series, 100 validation time-series and 200 test time-series, each using disjoint combinations of different calligraphic styles and dynamics. We compare NPs and NDPs using identical convolutional networks for encoding the images in the context. We assume that the initial image $y _ { 0 }$ (i.e. the image at $t _ { 0 }$ ) is always present in the context. As such, for NDPs, we compute the distribution of $L _ { 0 }$ purely by encoding $y _ { 0 }$ and disregarding the other samples in the context, as described in Section 3. We train the NP for 500 epochs and use the validation set error to checkpoint the best model for testing. We follow a similar procedure for the NDP model but, due to the additional computational load introduced by the integration operation, only train for 50 epochs.
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 6: Predictions on the test set of Variable Rotating MNIST. NDP is able to extrapolate beyond the training time range whereas NP cannot even learn to reconstruct the digit.
|
| 165 |
+
|
| 166 |
+
In Figure 6, we include the predictions offered by the two models on a time-series from the test dataset, which was not seen in training by either of the models. Despite the lower number of epochs they are trained for, NDPs are able to interpolate and even extrapolate on the variable velocity MNIST dataset, while also accurately capturing the calligraphic style of the digit. NPs struggle on this challenging task and are unable to produce anything resembling the digits. In order to better understand this wide performance gap, we also train in Appendix G.3 the exact same models on the easier Rotating MNIST task from C¸ agatay Yıldız et al. (2019) where the angular velocity and initial ˘ rotation are constant. In this setting, the two models perform similarly since the NP model can rely on simple interpolations without learning any dynamics.
|
| 167 |
+
|
| 168 |
+
# 5 DISCUSSION AND RELATED WORK
|
| 169 |
+
|
| 170 |
+
We now consider two perspectives on how Neural ODE Processes relate to existing work and discuss the model in these contexts.
|
| 171 |
+
|
| 172 |
+
NDPs as Neural Processes From the perspective of stochastic processes, NDPs can be seen as a generalisation of NPs defined over time and, as such, existing improvements in this family are likely orthogonal to our own. For instance, following the work of Kim et al. (2019), we would expect adding an attention mechanism to NDPs to reduce uncertainty around context points. Additionally, the intrinsic sequential nature of time could be further exploited to model a dynamically changing sequence of NDPs as in Sequential NPs (Singh et al., 2019). For application domains where the observations evolve on a graph structure, such as traffic networks, relational information could be exploited with message passing operation as in MPNPs (Day et al., 2020).
|
| 173 |
+
|
| 174 |
+
NDPs as Neural ODEs From a dynamics perspective, NDPs can be thought of as an amortised Bayesian Neural ODE. In this sense, $\mathrm { O D E ^ { 2 } }$ VAE (C¸ agatay Yıldız et al., 2019) is the model that is ˘ most closely related to our method. While there are many common ideas between the two, significant differences exist. Firstly, NDPs do not use an explicit Bayesian Neural Network but are linked to them through the theoretical connections inherited from NPs (Garnelo et al., 2018b). NDPs handle uncertainty through latent variables, whereas $\mathrm { O D E ^ { 2 } }$ VAE uses a distribution over the NODE’s weights. Secondly, NDPs stochastically condition the ODE derivative function and initial state on an arbitrary context set of variable size. In contrast, ODE2VAE conditions only the initial position and initial velocity on the first element and the first $M$ elements in the sequence, respectively. Therefore, our model can dynamically adapt the dynamics to any observed time points. From that point of view, our model also runs parallel to other attempts of making Neural ODEs capable of dynamically adapting to irregularly sampled data (Kidger et al., 2020). We conclude this section by remarking that any Latent NODE, as originally defined in Chen et al. (2018), is also a stochastic process. However, regular Latent NODEs are not trained to use a data-adaptive prior over the latent context, but use a fixed standard-normal prior. This corresponds to the case when $\mathbb { C } = \mathbb { T }$ as remarked by Le et al. (2018). Additionally, they also only model an uncertainty in the initial position of the ODE, but do not consider an uncertainty in the derivative function.
|
| 175 |
+
|
| 176 |
+
# 6 CONCLUSION
|
| 177 |
+
|
| 178 |
+
We introduce Neural ODE Processes (NDPs), a new class of stochastic processes suitable for modelling data-adaptive stochastic dynamics. First, NDPs tackle the two main problems faced by Neural ODEs applied to dynamics-governed time series: adaptability to incoming data points and uncertainty in the underlying dynamics when the data is sparse and, potentially, irregularly sampled. Second, they add an explicit treatment of time as an additional inductive bias inside Neural Processes. To do so, NDPs include a probabilistic ODE as an additional encoded structure, thereby incorporating the assumption that the time-series is the direct or latent manifestation of an underlying ODE. Furthermore, NDPs maintain the scalability of NPs to large inputs. We evaluate our model on synthetic 1D and 2D data, as well as higher-dimensional problems such as rotating MNIST digits. Our method exhibits superior training performance when compared with NPs, yielding a lower loss in fewer iterations. Whether or not the underlying ODE of the data is latent, we find that where there is a fundamental ODE governing the dynamics, NDPs perform well.
|
| 179 |
+
|
| 180 |
+
# REFERENCES
|
| 181 |
+
|
| 182 |
+
Francesco Paolo Casale, Adrian V Dalca, Luca Saglietti, Jennifer Listgarten, and Nicolo Fusi. Gaussian Process Prior Variational Autoencoders. arXiv e-prints, art. arXiv:1810.11738, October 2018.
|
| 183 |
+
|
| 184 |
+
Ricky TQ Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. In Advances in neural information processing systems, pp. 6571–6583, 2018.
|
| 185 |
+
|
| 186 |
+
Ben Day, Cat˘ alina Cangea, Arian R. Jamasb, and Pietro Li ˘ o. Message passing neural processes, \` 2020.
|
| 187 |
+
|
| 188 |
+
Ruizhi Deng, Bo Chang, Marcus A. Brubaker, Greg Mori, and Andreas Lehrmann. Modeling continuous stochastic processes with dynamic normalizing flows. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 189 |
+
|
| 190 |
+
Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml.
|
| 191 |
+
|
| 192 |
+
Emilien Dupont, Arnaud Doucet, and Yee Whye Teh. Augmented neural odes. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and R. Garnett (eds.), ´ Advances in Neural Information Processing Systems 32, pp. 3140–3150. Curran Associates, Inc., 2019. URL http: //papers.nips.cc/paper/8577-augmented-neural-odes.pdf.
|
| 193 |
+
|
| 194 |
+
Marta Garnelo, Dan Rosenbaum, Chris J. Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo J. Rezende, and S. M. Ali Eslami. Conditional neural processes, 2018a.
|
| 195 |
+
|
| 196 |
+
Marta Garnelo, Jonathan Schwarz, Dan Rosenbaum, Fabio Viola, Danilo J. Rezende, S. M. Ali Eslami, and Yee Whye Teh. Neural processes, 2018b.
|
| 197 |
+
|
| 198 |
+
Jonathan Gordon, Wessel P. Bruinsma, Andrew Y. K. Foong, James Requeima, Yann Dubois, and Richard E. Turner. Convolutional conditional neural processes, 2019.
|
| 199 |
+
|
| 200 |
+
Junteng Jia and Austin R. Benson. Neural jump stochastic differential equations, 2020.
|
| 201 |
+
|
| 202 |
+
Patrick Kidger, James Morrill, James Foster, and Terry Lyons. Neural controlled differential equations for irregular time series. arXiv preprint arXiv:2005.08926, 2020.
|
| 203 |
+
|
| 204 |
+
Hyunjik Kim, Andriy Mnih, Jonathan Schwarz, Marta Garnelo, Ali Eslami, Dan Rosenbaum, Oriol Vinyals, and Yee Whye Teh. Attentive neural processes, 2019.
|
| 205 |
+
|
| 206 |
+
Tuan Anh Le, Hyunjik Kim, Marta Garnelo, Dan Rosenbaum, Jonathan Schwarz, and Yee Whye Teh. Empirical evaluation of neural process objectives. In NeurIPS workshop on Bayesian Deep Learning, 2018.
|
| 207 |
+
|
| 208 |
+
Xuechen Li, Ting-Kam Leonard Wong, Ricky T. Q. Chen, and David Duvenaud. Scalable gradients for stochastic differential equations, 2020.
|
| 209 |
+
|
| 210 |
+
Xuanqing Liu, Tesi Xiao, Si Si, Qin Cao, Sanjiv Kumar, and Cho-Jui Hsieh. Neural sde: Stabilizing neural ode networks with stochastic noise, 2019.
|
| 211 |
+
|
| 212 |
+
Stefano Massaroli, Michael Poli, Jinkyoo Park, Atsushi Yamashita, and Hajime Asama. Dissecting neural odes, 2020.
|
| 213 |
+
|
| 214 |
+
James Morrill, Patrick Kidger, Cristopher Salvi, James Foster, and Terry Lyons. Neural cdes for long time series via the log-ode method, 2020.
|
| 215 |
+
|
| 216 |
+
Alexander Norcliffe, Cristian Bodnar, Ben Day, Nikola Simidjievski, and Pietro Lio. On second \` order behaviour in augmented neural odes, 2020.
|
| 217 |
+
|
| 218 |
+
Bernt Øksendal. Stochastic differential equations. In Stochastic differential equations, pp. 65–84. Springer, 2003.
|
| 219 |
+
|
| 220 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and ´ R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019.
|
| 221 |
+
|
| 222 |
+
Yulia Rubanova, Ricky T. Q. Chen, and David Duvenaud. Latent odes for irregularly-sampled time series, 2019.
|
| 223 |
+
|
| 224 |
+
Gautam Singh, Jaesik Yoon, Youngsung Son, and Sungjin Ahn. Sequential neural processes. In Advances in Neural Information Processing Systems, pp. 10254–10264, 2019.
|
| 225 |
+
|
| 226 |
+
T. Tieleman and G. Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
|
| 227 |
+
|
| 228 |
+
Belinda Tzen and Maxim Raginsky. Neural stochastic differential equations: Deep latent gaussian models in the diffusion limit, 2019.
|
| 229 |
+
|
| 230 |
+
Ben H Williams, Marc Toussaint, and Amos J Storkey. Extracting motion primitives from natural handwriting data. In International Conference on Artificial Neural Networks, pp. 634–643. Springer, 2006.
|
| 231 |
+
|
| 232 |
+
C¸ agatay Yıldız, Markus Heinonen, and Harri L ˘ ahdesm ¨ aki. Ode ¨ 2vae: Deep generative second order odes with bayesian neural networks, 2019.
|
| 233 |
+
|
| 234 |
+
# ACKNOWLEDGEMENTS
|
| 235 |
+
|
| 236 |
+
We’d like to thank Cat˘ alina Cangea and Nikola Simidjievski for their feedback on an earlier ver- ˘ sion of this work, and Felix Opolka for many discussions in this area. We were greatly enabled and are indebted to the developers of a great number of open-source projects, most notably the torchdiffeq library. Jacob Moss is funded by a GSK grant.
|
| 237 |
+
|
| 238 |
+
# A STOCHASTIC PROCESS PROOFS
|
| 239 |
+
|
| 240 |
+
Before giving the proofs, we state the following important Lemma.
|
| 241 |
+
|
| 242 |
+
Lemma A.1. As in NPs, the decoder output $g ( l ( t ) , t )$ can be seen as a function $\mathcal { F } ( t )$ for a given fixed $\boldsymbol { l } ( t _ { 0 } )$ and $^ d$ .
|
| 243 |
+
|
| 244 |
+
Proof. This follows directly from the fact that $\begin{array} { r } { l ( t ) = l ( t _ { 0 } ) + \int _ { t _ { 0 } } ^ { \mathbb { T } } f _ { \theta } ( l ( t ) , t , \pmb { d } ) d t } \end{array}$ can be seen as a function of $t$ and that the integration process is deterministic for a given pair $\boldsymbol { l } ( t _ { 0 } )$ and $^ d$ (i.e. for fixed initial conditions and control).
|
| 245 |
+
|
| 246 |
+
Proposition 3.1 NDPs satisfy the exchangeability condition.
|
| 247 |
+
|
| 248 |
+
Proof. This follows directly from Lemma A.1, since any permutation on $t _ { 1 : n }$ would automatically act on $\mathcal { F } _ { 1 : n }$ and consequently on $p ( \pmb { y } _ { 1 : n } , l ( t _ { 0 } ) , \pmb { d } | t _ { 1 : n } )$ , for any given ${ l } ( t _ { 0 } ) , d$ . □
|
| 249 |
+
|
| 250 |
+
Proposition 3.2 NDPs satisfy the consistency condition.
|
| 251 |
+
|
| 252 |
+
Proof. Based on Lemma A.1 we can write the joint distribution (similarly to a regular NP) as follows:
|
| 253 |
+
|
| 254 |
+
$$
|
| 255 |
+
\rho _ { t _ { 1 : n } } ( y _ { 1 : n } ) = \int p ( \mathcal { F } ) \prod _ { i = 1 } ^ { n } p ( \pmb { y } _ { i } | \mathcal { F } ( t _ { i } ) ) d \mathcal { F } .
|
| 256 |
+
$$
|
| 257 |
+
|
| 258 |
+
Because the density of any $\mathbf { \nabla } _ { \mathbf { \psi } _ { 3 } } \mathbf { \psi } _ { 2 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \qquad \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 }$ depends only on the corresponding $t _ { i }$ , integrating out any subset of ${ \pmb y } _ { 1 : n }$ gives the joint distribution of the remaining random variables in the sequence. Thus, consistency is guaranteed. □
|
| 259 |
+
|
| 260 |
+
# B ELBO DERIVATION
|
| 261 |
+
|
| 262 |
+
As noted in Lemma A.1, the joint probability $p ( \pmb { y } , l ( t _ { 0 } ) , \pmb { d } | t ) = p ( l ( t _ { 0 } ) ) p ( \pmb { d } ) p ( \pmb { y } | g ( l ( t ) , \pmb { d } , t ) )$ can still be seen as a function that depends only on $t$ , since the ODE integration process is deterministic for a given $\boldsymbol { l } ( t _ { 0 } )$ and $^ d$ . Therefore, the ELBO derivation proceeds as usual (Garnelo et al., 2018b). For convenience, let ${ \boldsymbol z } = ( l ( t _ { 0 } ) , d )$ denote the concatenation of the two latent vectors and $q ( z ) =$ $q _ { L } ( l ( t _ { 0 } ) ) q _ { D } ( d )$ . First, we derive the ELBO for $\log p ( y _ { \mathbb { T } } | t _ { \mathbb { T } } )$ .
|
| 263 |
+
|
| 264 |
+
$$
|
| 265 |
+
\begin{array} { r l } { \log p ( y _ { \mathbb { T } } | t _ { \mathbb { T } } ) = D _ { \mathrm { K L } } \big ( q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) \| p ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) \big ) + \mathcal { L } _ { \mathrm { E L B o } } } & { } \\ { \geq \mathcal { L } _ { \mathrm { E L B O } } = \mathbb { E } _ { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \big [ - \log q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) + \log p ( y _ { \mathbb { T } } , z | t _ { \mathbb { T } } ) \big ] } & { } \\ { = - \mathbb { E } _ { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \log q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) + \mathbb { E } _ { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \big [ \log p ( z ) + \log p ( y _ { \mathbb { T } } | t _ { \mathbb { T } } , z ) \big ] } & { } \\ { = \mathbb { E } _ { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \Bigg [ \displaystyle \sum _ { i \in I _ { \mathbb { T } } } \log p ( y _ { i } | z , t _ { i } ) + \log \frac { p ( z ) } { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \Bigg ] } & { } \end{array}
|
| 266 |
+
$$
|
| 267 |
+
|
| 268 |
+
Noting that at training time, we want to maximise $\log p ( y _ { \mathbb { T } } | t _ { \mathbb { T } } , y _ { \mathbb { C } } )$ . Using the derivation above, we obtain a similar lower-bound, but with a new prior $p ( z | t _ { \mathbb { C } } , y _ { \mathbb { C } } )$ , updated to reflect the additional information supplied by the context.
|
| 269 |
+
|
| 270 |
+
$$
|
| 271 |
+
\log p ( y _ { \mathbb { T } } | t _ { \mathbb { T } } , y _ { \mathbb { C } } ) \geq \mathbb { E } _ { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \left[ \sum _ { i \in I _ { \mathbb { T } } } \log p ( y _ { i } | z , t _ { i } ) + \log \frac { p ( z | t _ { \mathbb { C } } , y _ { \mathbb { C } } ) } { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \right]
|
| 272 |
+
$$
|
| 273 |
+
|
| 274 |
+
If we approximate the true $p ( z | t _ { \mathbb { C } } , y _ { \mathbb { C } } )$ with the variational posterior, this takes the final form
|
| 275 |
+
|
| 276 |
+
$$
|
| 277 |
+
\log p ( y _ { \mathbb { T } } | t _ { \mathbb { T } } , y _ { \mathbb { C } } ) \geq \mathbb { E } _ { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \left[ \sum _ { i \in I _ { \mathbb { T } } } \log p ( y _ { i } | z , t _ { i } ) + \log \frac { q ( z | t _ { \mathbb { C } } , y _ { \mathbb { C } } ) } { q ( z | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \right]
|
| 278 |
+
$$
|
| 279 |
+
|
| 280 |
+
Splitting ${ z } = ( l ( t _ { 0 } ) , d )$ back into its constituent parts, we obtain the loss function
|
| 281 |
+
|
| 282 |
+
$$
|
| 283 |
+
\mathbb { E } _ { q } \big ( l ( t _ { 0 } ) , d | t _ { \tau } , y _ { \tau } \big ) \left[ \sum _ { i \in I _ { \tau } } \log p ( y _ { i } | l ( t _ { 0 } ) , d , t _ { i } ) + \log \frac { q _ { L } ( l ( t _ { 0 } ) | t _ { \mathbb { C } } , y _ { \mathbb { C } } ) } { q _ { L } ( l ( t _ { 0 } ) | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } + \log \frac { q _ { D } ( d | t _ { \mathbb { C } } , y _ { \mathbb { C } } ) } { q _ { D } ( d | t _ { \mathbb { T } } , y _ { \mathbb { T } } ) } \right] .
|
| 284 |
+
$$
|
| 285 |
+
|
| 286 |
+
# C LEARNING AND INFERENCE PROCEDURE
|
| 287 |
+
|
| 288 |
+
We include below the pseudocode for training NDPs. For clarity of exposition, we give code for a single time-series. However, in practice, we batch all the operations in lines $6 - 1 5$ .
|
| 289 |
+
|
| 290 |
+
Algorithm 1: Learning and Inference in Neural ODE Processes
|
| 291 |
+
|
| 292 |
+
<table><tr><td></td><td>Input :A dataset of time-series {Xk},k ≤K,where K is the total number of time-series</td></tr><tr><td></td><td>Initialise NDP model with parameters θ</td></tr><tr><td></td><td>Let m be the number of context points and n the number of extra target points</td></tr><tr><td></td><td>fori ← O to training_steps do</td></tr><tr><td>3 4</td><td>Sample m from U[1,max_context_points]</td></tr><tr><td>5</td><td>Sample n fromU[1,max_extra_target_points]</td></tr><tr><td>6</td><td>Uniformly sample a time-series Xk</td></tr><tr><td>7</td><td>Uniformly sample from Xk the target points T = (tT,yT),where tT is the time batch with</td></tr><tr><td></td><td>shape (m + n,1) and yr is the corresponding outputs batch with shape (m + n, dim(y)) Extract the (unordered) context set C = T[O : m]</td></tr><tr><td>8 9</td><td>Compute q(𝑙(to),d|C) using the variational encoder</td></tr><tr><td>10</td><td>Compute q(𝑙(to),d|T) using the variational encoder</td></tr><tr><td></td><td>// During training,we sample from q(l(to),d|T)</td></tr><tr><td>11</td><td>Sample l(to),d from q(l(to),d|T) Integrate to compute l(t) as in Equation 3 for all times t ∈ tT</td></tr><tr><td>12 13</td><td>foreach time t ∈tT do</td></tr><tr><td>14</td><td>Use decoder to compute p(y(t)lg(l(t)),t)</td></tr><tr><td>15</td><td></td></tr><tr><td>16</td><td>Compute loss LELBo based on Equation 5</td></tr><tr><td></td><td>0←θ-αVθLELBO</td></tr></table>
|
| 293 |
+
|
| 294 |
+
It is worth highlighting that during training we sample ${ l ( t _ { 0 } ) , d }$ from the target-conditioned posterior, rather than the context-conditioned posterior. In contrast, at inference time we sample from the context-conditioned posterior.
|
| 295 |
+
|
| 296 |
+
# D WALL CLOCK TRAINING TIMES
|
| 297 |
+
|
| 298 |
+
To explore the additional term in the runtime given in Section 3.5, we record the wall clock time for each model to train for 30 epochs on the 1D synthetic datasets, over 5 seeds. Then we take the ratio of a given model and the NP. The experiments were run on an Nvidia Titan $X P$ . The results can be seen in Table 2.
|
| 299 |
+
|
| 300 |
+
# E SIZE OF LATENT ODE
|
| 301 |
+
|
| 302 |
+
To investigate how many dimensions the ODE $\imath$ should have we carry out an ablation study, looking at the performance on the 1D sine dataset. We train models with $\imath$ -dimension $\{ 1 , 2 , 5 , 1 0 , 1 5 , 2 0 \}$ for 30 epochs. Figure 7 shows training plots for $\mathrm { d i m } ( l ) = \{ 1 , 2 , 1 0 , 2 0 \}$ , and final MSE values are given in Table 3.
|
| 303 |
+
|
| 304 |
+
Table 2: Table of ratios, of Neural ODE Process and Neural Process training times on different 1D synthetic datasets. We see that NDP/NP is the lowest (i.e. fastest) in each case.
|
| 305 |
+
|
| 306 |
+
<table><tr><td>Time Ratios</td><td>Sine</td><td>Exponential</td><td>Linear</td><td>Oscillators</td></tr><tr><td>NDP/NP</td><td>22.1 ± 0.9</td><td>23.6 ± 0.9</td><td>10.9 ± 1.4</td><td>22.2 ± 2.3</td></tr><tr><td>ND2P/NP</td><td>55.2 ± 6.3</td><td>32.4 ± 1.5</td><td>14.2 ± 0.3</td><td>35.8 ± 0.7</td></tr><tr><td>NDP-L/NP</td><td>55.2 ± 6.2</td><td>47.5 ± 18.0</td><td>14.7 ± 1.5</td><td>25.3 ± 0.5</td></tr><tr><td>ND2P-L/NP</td><td>43.7 ± 1.9</td><td>27.9 ± 1.1</td><td>15.1 ± 1.6</td><td>32.8 ± 1.1</td></tr><tr><td>NP Training Time /s</td><td>22.4 ± 0.2</td><td>45.5 ± 0.3</td><td>100.9 ± 0.3</td><td>23.2 ± 0.4</td></tr></table>
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure 7: Training plots of NDP with ODEs of different sizes, training on the sine dataset. We see that for $\dim ( l ) = 1$ , the model trains slowly, as would be expected for a sine curve where at least 2 dimensions are needed to learn second order and test performance is close to the standard NP. The other models train at approximately the same rate.
|
| 310 |
+
|
| 311 |
+
We see that when $\dim ( l ) = 1$ , NDPs are slow to train and require more epochs. This is because sine curves are second-order ODEs, and at least two dimensions are required to learn second-order dynamics (one for the position and one for the velocity). When $\dim ( l ) = 1$ , NDPs perform similarly to NPs, which is expected when the latent ODE is unable to capture the underlying dynamics. We then see that for all other dimensions, NDPs train at approximately the same rate (over epochs) and have similar final MSE scores. As the dimension increases beyond 10, the test MSE increases, indicating overfitting.
|
| 312 |
+
|
| 313 |
+
# F ARCHITECTURAL DETAILS
|
| 314 |
+
|
| 315 |
+
For the experiments with low dimensionality (1D, 2D), the architectural details are as follows:
|
| 316 |
+
|
| 317 |
+
• Encoder: $[ t _ { i } , y _ { i } ] r _ { i }$ : Multilayer Perceptron, 2 hidden layers, ReLU activations.
|
| 318 |
+
• Aggregator: $r _ { 1 : n } \to r$ : Taking the mean.
|
| 319 |
+
• Representation to Hidden: $r h$ : One linear layer followed by ReLU.
|
| 320 |
+
• Hidden to $L ( t _ { 0 } )$ Mean: $h \mu _ { L }$ : One linear layer.
|
| 321 |
+
• Hidden to $L ( t _ { 0 } )$ Variance: $h \sigma _ { L }$ : One linear layer, followed by sigmoid, multiplied by 0.9 add 0.1, i.e. $\sigma _ { L } = 0 . 1 + 0 . 9 \times \mathrm { s i g m o i d } ( W h + b )$ .
|
| 322 |
+
• Hidden to $D ( t _ { 0 } )$ Mean: $h \mu _ { L }$ : One linear layer.
|
| 323 |
+
• Hidden to $D ( t _ { 0 } )$ Variance: $h \sigma _ { D }$ : One linear layer, followed by sigmoid, multiplied by 0.9 add 0.1, i.e. $\sigma _ { D } = 0 . 1 + 0 . 9 \times \mathrm { s i g m o i d } ( W h + b )$ .
|
| 324 |
+
• ODE Layers: $[ l , d , t ] \to i$ : Multilayer Perceptron, two hidden layers, tanh activations.
|
| 325 |
+
• Decoder: $g ( l ( t _ { i } ^ { \mathbb { T } } ) , d , t _ { i } ^ { \mathbb { T } } ) \to y _ { i } ^ { \mathbb { T } }$ , for the NDP model and ND2P described in section 3.3, this function is a linear layer, acting on a concatenation of the latent state and a function of $l ( t _ { i } ^ { \mathbb { T } } )$ , $^ d$ , and $t _ { i } ^ { \mathbb { T } }$ . $g ( l ( t _ { i } ^ { \mathbb { T } } ) , \mathbf { \dot { d } } , t _ { i } ^ { \mathbb { T } } ) = \mathbf { \tilde { W } } ( l ( t _ { i } ^ { \mathbb { T } } ) | | h ( l ( t _ { i } ^ { \mathbb { T } } ) , \mathbf { d } , t _ { i } ^ { \mathbb { T } } ) ) + b .$ . Where $h$ is a Multilayer Perceptron with two hidden layers and ReLU activations.
|
| 326 |
+
|
| 327 |
+
Table 3: Final MSE values for NDPs training on the sine dataset with different sized ODEs, with NP performance included for reference. Peak performance is found when $\mathrm { d i m } ( l ) = 2$ , which is to be expected as the true dynamics are 2-dimensional. For $\dim ( l ) = 1$ , the MSE is highest, and within error of the NP. Performance degrades with increasing $\dim ( l )$ , with overfitting becoming a problem for $\dim ( l ) = 2 0$ .
|
| 328 |
+
|
| 329 |
+
<table><tr><td>l-dimension</td><td>MSE ×10-2</td><td>Training Times/s</td></tr><tr><td>NP</td><td>5.9 ± 0.9</td><td>22.4± 0.2</td></tr><tr><td>1</td><td>5.6 ± 1.3</td><td>299.7 ± 20.5</td></tr><tr><td>2</td><td>1.7 ± 0.1</td><td>413.8 ± 52.9</td></tr><tr><td>5</td><td>2.2 ± 0.2</td><td>414.8 ± 13.1</td></tr><tr><td>10</td><td>2.1 ± 0.1</td><td>496.7 ± 20.5</td></tr><tr><td>15</td><td>2.6 ± 0.2</td><td>618.0 ± 30.7</td></tr><tr><td>20</td><td>3.1 ± 0.3</td><td>652.0 ± 38.8</td></tr></table>
|
| 330 |
+
|
| 331 |
+
For the high-dimensional experiments (Rotating MNIST).
|
| 332 |
+
|
| 333 |
+
• Encoder: $\left[ t _ { i } , y _ { i } \right] \to r _ { i }$ : Convolutional Neural Network, 4 layers with 16, 32, 64, 128 channels respectively and kernel size of 5, stride 2. ReLU activations. Batch normalisation.
|
| 334 |
+
• Aggregator: $r _ { 1 : n } \to r$ : Taking the mean.
|
| 335 |
+
• Representation to $D$ Hidden: $\pmb { r } \pmb { h } _ { D }$ : One linear layer followed by ReLU.
|
| 336 |
+
• Hidden to $D$ Mean: $h _ { D } \mu _ { D }$ : One linear layer.
|
| 337 |
+
• Hidden to $D$ Variance: $h _ { D } \to \sigma _ { z }$ : One linear layer, followed by sigmoid, multiplied by 0.9 add 0.1, i.e. $\sigma _ { D } = 0 . 1 + 0 . 9 \times \mathrm { s i g m o i d } ( W h + b )$ .
|
| 338 |
+
• $\mathbf { { \boldsymbol { \psi } } } _ { 0 }$ to $L ( t _ { 0 } )$ Hidden: $y _ { 0 } h _ { L }$ : Convolutional Neural Network, 4 layers with 16, 32, 64, 128 channels respectively and kernel size of 5, stride 2. ReLU activations. Batch normalisation.
|
| 339 |
+
• $L ( t _ { 0 } )$ Hidden to $L ( t _ { 0 } )$ Mean: $h _ { L } \to \mu _ { L }$ : One linear layer.
|
| 340 |
+
• $L ( t _ { 0 } )$ Hidden to $L ( t _ { 0 } )$ Variance: $h _ { L } \ \to \ \sigma _ { z }$ : One linear layer, followed by sigmoid, multiplied by 0.9 add 0.1, i.e. $\sigma _ { L } = 0 . 1 + 0 . 9 \times \mathrm { s i g m o i d } ( W h + b )$ .
|
| 341 |
+
• ODE Layers: $[ l , d , t ] \to i$ : Multilayer Perceptron, two hidden layers, tanh activations.
|
| 342 |
+
• Decoder: $g ( l ( t _ { i } ^ { \mathbb { T } } ) ) \to y _ { i } ^ { \mathbb { T } }$ : 1 linear layer followed by a 4 layer transposed Convolutional Neural Network with 32, 128, 64, 32 channels respectively. ReLU activations. Batch normalisation.
|
| 343 |
+
|
| 344 |
+
# G TASK DETAILS AND ADDITIONAL RESULTS
|
| 345 |
+
|
| 346 |
+
# G.1 ONE DIMENSIONAL REGRESSION
|
| 347 |
+
|
| 348 |
+
We carried out an ablation study over model variations on various 1D synthetic tasks—sines, exponentials, straight lines and harmonic oscillators. Each task is based on some function described by a set of parameters that are sampled over to produce a distribution over functions. In every case, the parameters are sampled from uniform distributions. A trajectory example is formed by sampling from the parameter distributions and then sampling from that function at evenly spaced timestamps, $t$ , over a fixed range to produce 100 data points $( t , y )$ . We give the equations for these tasks in terms of their defining parameters and the ranges for these parameters in Table 4.
|
| 349 |
+
|
| 350 |
+
To test after each epoch, 10 random context points are taken, and then the mean-squared error and negative log probability are calculated over all the points (not just a subset of the target points). Each model was trained 5 times on each dataset (with different weight initialisation). We used a batch size of 5, with context size ranging from 1 to 10, and the extra target size ranging from 0 to 5.1 The results are presented in Figure 8.
|
| 351 |
+
|
| 352 |
+
<table><tr><td>Task</td><td>Form</td><td>a</td><td>b</td><td>t</td><td># train</td><td>#test</td></tr><tr><td>Sines</td><td>y=asin(t-b)</td><td>(-1,1)</td><td>(-1/2,1/2)</td><td>(-π,π)</td><td>490</td><td>10</td></tr><tr><td>Exponentials</td><td>y = @/60 × exp(t-b)</td><td>(-1,1)</td><td>(-1/2,1/2)</td><td>(-1,4)</td><td>490</td><td>10</td></tr><tr><td>Straight lines</td><td>y=at+b</td><td>(-1,1)</td><td>(-1/2,1/2)</td><td>(0,5)</td><td>490</td><td>10</td></tr><tr><td>Oscillators</td><td>y = asin(t -b)exp(-t/2)</td><td>(-1,1)</td><td>(-1/2,1/2)</td><td>(0,5)</td><td>490</td><td>10</td></tr></table>
|
| 353 |
+
|
| 354 |
+
Table 4: Task details for 1D regression. $a$ and $b$ are sampled uniformly at random from the given ranges. $t$ is sampled at 100 regularly spaced intervals over the given range. 490 training examples and 10 test examples were used in every case.
|
| 355 |
+
|
| 356 |
+
All models perform better than NPs, with fewer parameters (approximately $10 \%$ less). Because there are no significant differences between the different models, we use NDP in the remainder of the experiments, because it has the fewest model restrictions. The phase space dynamics are not restricted like its second-order variant, and the decoder has a more expressive architecture than the latent-only variants. It also trains the fastest in wall clock time seen in Appendix D.
|
| 357 |
+
|
| 358 |
+
# G.2 LOTKA-VOLTERRA SYSTEM
|
| 359 |
+
|
| 360 |
+
To generate samples from the Lotka Volterra system, we sample different starting configurations, $( \boldsymbol { u _ { 0 } } , \boldsymbol { \bar { v } _ { 0 } } ) = ( 2 E , \boldsymbol { \bar { E } } )$ , where $E$ is sampled from a uniform distribution in the range (0.25, 1.0). We then evolve the Lotka Volterra system
|
| 361 |
+
|
| 362 |
+
$$
|
| 363 |
+
\frac { d u } { d t } = \alpha u - \beta u v , \qquad \frac { d v } { d t } = \delta u v - \gamma v .
|
| 364 |
+
$$
|
| 365 |
+
|
| 366 |
+
using $( \alpha , \beta , \gamma , \delta ) = ( ^ { 2 } / 3 , { ^ 4 } / 3 , 1 , 1 )$ . This is evolved from $t = 0$ to $t = 1 5$ and then the times are rescaled by dividing by 10.
|
| 367 |
+
|
| 368 |
+
The training for the Lotka-Volterra system can be seen in Figure 9. This was taken across 5 seeds, with a training set of 40 trajectories, 10 test trajectories and batch size 5. We use a context size ranging from 1 to 100, and extra target size ranging from 0 to 45. The test context size was fixed at 90 query times. NDP trains slightly faster with lower loss, as expected.
|
| 369 |
+
|
| 370 |
+
# G.3 ROTATING MNIST & ADDITIONAL RESULTS
|
| 371 |
+
|
| 372 |
+
To better understand what makes vanilla NPs fail on our Variable Rotating MNIST from Section 4.3, we train the exact same models on the simpler Rotating MNIST dataset (C¸ agatay Yıldız et al., 2019). ˘ In this dataset, all digits start in the same position and rotate with constant velocity. Additionally, the fourth rotation is removed from all the time-series in the training dataset. We follow the same training procedure as in Section 4.3.
|
| 373 |
+
|
| 374 |
+
We report in Figure 10 the predictions for the two models on a random time-series from the validation dataset. First, NPs and NDPs perform similarly well at interpolation and extrapolation within the time-interval used in training. As an exception but in agreement with the results from ODE2VAE, NDPs produces a slightly better reconstruction for the fourth time step in the time-series. Second, neither model is able to extrapolate the dynamics beyond the time-range seen in training (i.e. the last five time-steps).
|
| 375 |
+
|
| 376 |
+
Overall, these observations suggest that for the simpler RotMNIST dataset, explicit modelling of the dynamics is not necessary and the tasks can be learnt easily by interpolating between the context points. And indeed, it seems that even NDPs, which should be able to learn solutions that extrapolate, collapse on these simpler solutions present in the parameter space, instead of properly learning the desired latent dynamics. A possible explanation is that the Variable Rotating MNIST dataset can be seen as an image augmentation process which makes the convolutional features to be approximately rotation equivariant. In this way, the NDP can also learn rotation dynamics in the spatial dimensions of the convolutional features.
|
| 377 |
+
|
| 378 |
+
Finally, in Figure 11, we plot the reconstructions of different digit styles on the test dataset of Variable Rotating MNIST. This confirms that NDPs are able to capture different calligraphic styles.
|
| 379 |
+
|
| 380 |
+

|
| 381 |
+
Figure 8: Training model variants on 1D synthetic datasets. NPs train slower in all cases. All Neural ODE Process variants train approximately at the same rate. With the latent-only variants performing slightly worse than the more expressive model variants. Additionally, ND2P performs slightly better than NDP on the damped oscillator and linear sets, because they are naturally easier to learn as second-order ODEs.
|
| 382 |
+
|
| 383 |
+
# G.4 HANDWRITTEN CHARACTERS
|
| 384 |
+
|
| 385 |
+
The CharacterTrajectories dataset consists of single-stroke handwritten digits recorded using an electronic tablet (Williams et al., 2006; Dua & Graff, 2017). The trajectories of the pen tip in two dimensions, $( x , y )$ , are of varying length, with a force cut-off used to determine the start and end of a stroke. We consider a reduced dataset, containing only letters that were written in a single stroke, this disregards letters such as “f”, “i” and “t”. Whilst it is not obvious that character trajectories should follow an ODE, the related Neural Controlled Differential Equation (NCDEs) model has been applied successfully to this task (Kidger et al., 2020). We train with a training set with 49600 examples, a test set with 400 examples and a batch size of 200. We use a context size ranging between 1 and 100, an extra target size ranging between 0 and 100 and a fixed test context size of 20. We visualise the training of the models in Figure 12 and the models plotting posteriors in Figure 13.
|
| 386 |
+
|
| 387 |
+

|
| 388 |
+
Figure 9: Training NP and NDP on the Lotka-Volterra equations. Due to the additional encoding structure of NDP, it can be seen that NDPs train in fewer iterations, to a lower loss than NPs.
|
| 389 |
+
|
| 390 |
+

|
| 391 |
+
Figure 10: Predictions on the simpler Rotating MNIST dataset. NPs are also able to perform well on this task, but NDPs are not able to extrapolate beyond the maximum training time.
|
| 392 |
+
|
| 393 |
+
We observe that NPs and NDPs are unable to successfully learn the time series as well as NCDEs. We record final test MSEs $( \times 1 0 ^ { - 1 } )$ at $4 . 6 \pm 0 . 1$ for NPs and a slightly lower $3 . 4 \pm 0 . 1$ for NDPs. We believe the reason is because handwritten digits do not follow an inherent ODE solution, especially given the diversity of handwriting styles for the same letter. We conjecture that Neural Controlled Differential Equations were able to perform well on this dataset due to the control process. Controlled ODEs follow the equation:
|
| 394 |
+
|
| 395 |
+
$$
|
| 396 |
+
z ( T ) = z ( t _ { 0 } ) + \int _ { t _ { 0 } } ^ { \mathbb { T } } f _ { \theta } ( z ( t ) , t ) { \frac { d X ( t ) } { d t } } d t , \qquad z ( t _ { 0 } ) = h _ { 1 } ( x ( t _ { 0 } ) ) , \qquad { \hat { x } } ( T ) = h _ { 2 } ( z ( T ) )
|
| 397 |
+
$$
|
| 398 |
+
|
| 399 |
+
Where $X ( t )$ is the natural cubic spline through the observed points ${ \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf } { \mathbf { } } { \mathbf { } } { \mathbf } { } \mathbf { } { \mathbf { } \mathbf { } } { \mathbf { } \mathbf { } } { \mathbf } { \mathbf { } } { \mathbf } { \mathbf { } } { \mathbf } { \mathbf } { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } { \mathbf } { \mathbf } { \mathbf } { \mathbf } { \mathbf } { \mathbf } { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { \mathbf } { \mathbf } { \mathbf } \mathbf { } \mathbf { \mathbf } { \mathbf } \mathbf { } \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf \mathbf { \mathbf \mathbf } \mathbf { \mathbf \mathbf } \mathbf { \mathbf \mathbf } \mathbf { \mathbf \mathbf } \mathbf { \mathbf \mathbf \mathbf } \mathbf { \mathbf \mathbf } \mathbf \mathbf { \mathbf } $ . If the learnt $f _ { \theta }$ is an identity operation, then the result returned will be the cubic spline through the observed points. Therefore, a controlled ODE can learn an identity with a small perturbation, which is easier to learn with the aid of a control process, rather than learning the entire ODE trajectory.
|
| 400 |
+
|
| 401 |
+

|
| 402 |
+
Figure 11: NDP is able to capture different styles in the Variable Rotating MNIST dataset.
|
| 403 |
+
|
| 404 |
+

|
| 405 |
+
Figure 12: NPs and NDPs training on handwriting. NDPs perform slightly better, achieving a lower loss in fewer iterations. However this is a marginal improvement, and we believe it is down to significant diversity in the dataset, due to there being no fundamental differential equation for handwriting.
|
| 406 |
+
|
| 407 |
+

|
| 408 |
+
Figure 13: We test the models on drawing the letter “a” with varying numbers of context points. For a few context points, the trajectories are diverse and not entirely recognisable. As more context points are observed, the trajectories become less diverse and start approaching an “a”. We expect that with more training, and editing the hyperparameters, such as batch size, or the number of hidden layers this model would improve. Additionally, we observe that NDP qualitatively outperforms NP on a small number and a large number of context points.
|
md/train/3qMwV98zLIk/3qMwV98zLIk.md
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FlexMatch: Boosting Semi-Supervised Learning with Curriculum Pseudo Labeling
|
| 2 |
+
|
| 3 |
+
Bowen Zhang∗ Tokyo Institute of Technology bowen.z.ab@m.titech.ac.jp
|
| 4 |
+
|
| 5 |
+
Yidong Wang∗ Tokyo Institute of Technology wang.y.ca@m.titech.ac.jp
|
| 6 |
+
|
| 7 |
+
Wenxin Hou Microsoft wenxinhou@microsoft.com
|
| 8 |
+
|
| 9 |
+
Hao Wu Tokyo Institute of Technology wu.h.aj@m.titech.ac.jp
|
| 10 |
+
|
| 11 |
+
Jindong Wang† Microsoft Research Asia jindwang@microsoft.com
|
| 12 |
+
|
| 13 |
+
Manabu Okumura† Tokyo Institute of Technology oku@pi.titech.ac.jp
|
| 14 |
+
|
| 15 |
+
Takahiro Shinozaki† Tokyo Institute of Technology shinot@ict.e.titech.ac.jp
|
| 16 |
+
|
| 17 |
+
# Abstract
|
| 18 |
+
|
| 19 |
+
The recently proposed FixMatch achieved state-of-the-art results on most semisupervised learning (SSL) benchmarks. However, like other modern SSL algorithms, FixMatch uses a pre-defined constant threshold for all classes to select unlabeled data that contribute to the training, thus failing to consider different learning status and learning difficulties of different classes. To address this issue, we propose Curriculum Pseudo Labeling (CPL), a curriculum learning approach to leverage unlabeled data according to the model’s learning status. The core of CPL is to flexibly adjust thresholds for different classes at each time step to let pass informative unlabeled data and their pseudo labels. CPL does not introduce additional parameters or computations (forward or backward propagation). We apply CPL to FixMatch and call our improved algorithm FlexMatch. FlexMatch achieves state-of-the-art performance on a variety of SSL benchmarks, with especially strong performances when the labeled data are extremely limited or when the task is challenging. For example, FlexMatch achieves $1 3 . 9 6 \%$ and $1 8 . 9 6 \%$ error rate reduction over FixMatch on CIFAR-100 and STL-10 datasets respectively, when there are only 4 labels per class. CPL also significantly boosts the convergence speed, e.g., FlexMatch can use only 1/5 training time of FixMatch to achieve even better performance. Furthermore, we show that CPL can be easily adapted to other SSL algorithms and remarkably improve their performances. We open-source our code at https://github.com/TorchSSL/TorchSSL.
|
| 20 |
+
|
| 21 |
+
# 1 Introduction
|
| 22 |
+
|
| 23 |
+
Semi-supervised learning (SSL) has attracted increasing attention in recent years due to its superiority in leveraging a large amount of unlabeled data. This is particularly advantageous when the labeled data are limited in quantity or laborious to obtain. Consistency regularization [1–3] and pseudo labeling [4–8] are two powerful techniques for utilizing unlabeled data and have been widely used in modern SSL algorithms [9–13]. The recently proposed FixMatch [14] achieves competitive results by combining these techniques with weak and strong data augmentations and using cross-entropy loss as the consistency regularization criterion.
|
| 24 |
+
|
| 25 |
+
However, a drawback of FixMatch and other popular SSL algorithms such as Pseudo-Labeling [4] and Unsupervised Data Augmentation (UDA) [11] is that they rely on a fixed threshold to compute the unsupervised loss, using only unlabeled data whose prediction confidence is above the threshold. While this strategy can make sure that only high-quality unlabeled data contribute to the model training, it ignores a considerable amount of other unlabeled data, especially at the early stage of the training process, where only a few unlabeled data have their prediction confidence above the threshold. Moreover, modern SSL algorithms handle all classes equally without considering their different learning difficulties.
|
| 26 |
+
|
| 27 |
+
To address these issues, we propose Curriculum Pseudo Labeling (CPL), a curriculum learning [15] strategy to take into account the learning status of each class for semi-supervised learning. CPL substitutes the pre-defined thresholds with flexible thresholds that are dynamically adjusted for each class according to the current learning status. Notably, this process does not introduce any additional parameter (hyper-parameter or trainable parameter) or extra computation (forward or back propagation). We apply this curriculum learning strategy directly to FixMatch and call the improved algorithm FlexMatch.
|
| 28 |
+
|
| 29 |
+
While the training speed remains as efficient as that of FixMatch, FlexMatch converges significantly faster and achieves state-of-the-art performances on most SSL image classification benchmarks. The benefit of introducing CPL is particularly remarkable when the labels are scarce or when the task is challenging. For instance, on the STL-10 dataset, FlexMatch achieves relative performance improvement over FixMatch by $1 8 . 9 6 \%$ , $1 6 . 1 1 \%$ , and $7 . 6 8 \%$ when the label amount is 400, 2500, and 10000 respectively. Moreover, CPL further shows its superiority by boosting the convergence speed – with CPL, FlexMatch takes less than 1/5 training time of FixMatch to reach its final accuracy. Adapting CPL to other modern SSL algorithms also leads to improvements in accuracy and convergence speed.
|
| 30 |
+
|
| 31 |
+
To sum up, this paper makes the following three contributions:
|
| 32 |
+
|
| 33 |
+
• We propose Curriculum Pseudo Labeling (CPL), a curriculum learning approach of dynamically leveraging unlabeled data for SSL. It is almost cost-free and can be easily integrated to other SSL methods.
|
| 34 |
+
• CPL significantly boosts the accuracy and convergence performance of several popular SSL algorithms on common benchmarks. Specifically, FlexMatch, the integration of FixMatch and CPL, achieves state-of-the-art results.
|
| 35 |
+
• We open-source TorchSSL, a unified PyTorch-based semi-supervised learning codebase for the fair study of SSL algorithms. TorchSSL includes implementations of popular SSL algorithms and their corresponding training strategies, and is easy to use or customize.
|
| 36 |
+
|
| 37 |
+
# 2 Background
|
| 38 |
+
|
| 39 |
+
Consistency regularization follows the continuity assumption of SSL [1, 2]. The most basic consistency loss in SSL, such as in $\Pi$ Model [9], Mean Teacher [10] and MixMatch [12], is the ℓ-2 loss:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\sum _ { b = 1 } ^ { \mu B } | | p _ { m } ( y | \omega ( u _ { b } ) ) - p _ { m } ( y | \omega ( u _ { b } ) ) | | _ { 2 } ^ { 2 } ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where $B$ is the batch size of labeled data, $\mu$ is the ratio of unlabeled data to labeled data, $\omega$ is a stochastic data augmentation function (thus the two terms in Eq.(1) are different), $u _ { b }$ denotes a piece of unlabeled data, and $p _ { m }$ represents the output probability of the model. With the introduction of pseudo labeling techniques [5, 7], the consistency regularization is converted to an entropy minimization process [16], which is more suitable for the classification task. The improved consistency loss with pseudo labeling can be represented as:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\frac { 1 } { \mu B } \sum _ { b = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { m } ( y | \omega ( u _ { b } ) ) ) > \tau ) H ( \hat { p } _ { m } ( y | \omega ( u _ { b } ) ) , p _ { m } ( y | \omega ( u _ { b } ) ) ) ,
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Figure 1: Illustration of Curriculum Pseudo Label (CPL). The estimated learning effects of each class are decided by the number of unlabeled data samples falling into this class and above the fixed threshold. They are then used to adjust the flexible thresholds to let pass the optimal unlabeled data. Note that the estimated learning effects do not always grow – they may also decrease if the predictions of the unlabeled data fall into other classes in later iterations.
|
| 53 |
+
|
| 54 |
+
where $H$ is cross-entropy, $\tau$ is the pre-defined threshold and $\hat { p } _ { m } ( y | \omega ( u _ { b } ) )$ is the pseudo label that can either be a ‘hard’ one-hot label [4, 14] or a sharpened ‘soft’ one [11]. The intention of using a threshold is to mask out noisy unlabeled data that have low prediction confidence.
|
| 55 |
+
|
| 56 |
+
FixMatch utilizes such consistency regularization with strong augmentation to achieve competitive performance. For unlabeled data, FixMatch first uses weak augmentation to generate artificial labels. These labels are then used as the target of strongly-augmented data. The unsupervised loss term in FixMatch thereby has the form:
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\frac { 1 } { \mu B } \sum _ { b = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { m } ( y | \omega ( u _ { b } ) ) ) > \tau ) H ( \hat { p } _ { m } ( y | \omega ( u _ { b } ) ) , p _ { m } ( y | \Omega ( u _ { b } ) ) ) ,
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where $\Omega$ is a strong augmentation function instead of weak augmentation $\omega$ .
|
| 63 |
+
|
| 64 |
+
Of the aforementioned works, the pre-defined threshold $( \tau )$ is constant. We believe this can be improved because the data of some classes may be inherently more difficult to learn than others. Curriculum learning [15] is a learning strategy where learning samples are gradually introduced according to the model’s learning process. In such a way, the model is always optimally challenged. This technique is widely employed in deep learning research [17–21].
|
| 65 |
+
|
| 66 |
+
# 3 FlexMatch
|
| 67 |
+
|
| 68 |
+
# 3.1 Curriculum Pseudo Labeling
|
| 69 |
+
|
| 70 |
+
While current SSL algorithms render pseudo labels of only high-confidence unlabeled data cut off by a pre-defined threshold, CPL renders the pseudo labels to different classes and at different time steps. Such a process is realized by adjusting the thresholds according to the model’s learning status of each class.
|
| 71 |
+
|
| 72 |
+
However, it is non-trivial to dynamically determine the thresholds according to the learning status. The most ideal approach would be calculating evaluation accuracies for each class and use them to scale the threshold, as:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
T _ { t } ( c ) = a _ { t } ( c ) \cdot \tau ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
where $\mathcal { T } _ { t } ( c )$ is the flexible threshold for class $c$ at time step $t$ and $a _ { t } ( c )$ is the corresponding evaluation accuracy. In this way, lower accuracy that indicates a less satisfactory learning status of the class will lead to a lower threshold that encourages more samples of this class to be learned. Since we cannot use the evaluation set in the model learning process, one may have to separate an extra validation set from the training set for such accuracy evaluations. However, this practice show two fatal problems: First, such a labeled validation set separated from the training set is expensive under SSL scenario as the labeled data are already scarce. Second, to dynamically adjust the thresholds in the training process, accuracy evaluations must be done continually at each time step $t$ , which will considerably slow down the training speed.
|
| 79 |
+
|
| 80 |
+
In this work, we propose Curriculum Pseudo Labeling (CPL) for semi-supervised learning. Our CPL uses an alternative way to estimate the learning status, which does not introduce additional inference processes, nor needs an extra validation set. As believed in [14], a high threshold that filters out noisy pseudo labels and leaves only high-quality ones can considerably reduce the confirmation bias [22]. Therefore, our key assumption is that when the threshold is high, the learning effect of a class can be reflected by the number of samples whose predictions fall into this class and above the threshold. Namely, the class with fewer samples having their prediction confidence reach the threshold is considered to have a greater learning difficulty or a worse learning status, formulated as:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\sigma _ { t } ( c ) = \sum _ { n = 1 } ^ { N } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { m , t } ( y | u _ { n } ) ) > \tau ) \cdot \mathbb { 1 } ( \arg \operatorname* { m a x } ( p _ { m , t } ( y | u _ { n } ) = c ) .
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where $\sigma _ { t } ( c )$ reflects the learning effect of class $c$ at time step $t$ . $p _ { m , t } ( y | u _ { n } )$ is the model’s prediction for unlabeled data $u _ { n }$ at time step $t$ , and $N$ is the total number of unlabeled data. When the unlabeled dataset is balanced (i.e., the number of unlabeled data belonging to different classes are equal or close), larger $\sigma _ { t } ( c )$ indicates a better estimated learning effect. By applying the following normalization to $\sigma _ { t } ( c )$ to make its range between 0 to 1, it can then be used to scale the fixed threshold $\tau$ :
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\beta _ { t } ( c ) = \frac { \sigma _ { t } ( c ) } { \operatorname* { m a x } _ { c } \sigma _ { t } } ,
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\begin{array} { r } { \mathcal { T } _ { t } ( c ) = \beta _ { t } ( c ) \cdot \tau . } \end{array}
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
One characteristic of such a normalization approach is that the best-learned class has its $\beta _ { t } ( c )$ equal to 1, causing its flexible threshold equal to $\tau$ . This is desirable. For classes that are hard to learn, the thresholds are lowered down, encouraging more training samples in these classes to be learned. This also improves the data utilization ratio. As learning proceeds, the threshold of a well-learned class is raised higher to selectively pick up higher-quality samples. Eventually, when all classes have reached reliable accuracies, the thresholds will all approach $\tau$ . Note that the thresholds do not always grow, it may also decrease if the unlabeled data is classified into a different class in later iterations. This new threshold is used for calculating the unsupervised loss in FlexMatch, which can be formulated as:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\mathcal { L } _ { u , t } = \frac { 1 } { \mu B } \sum _ { b = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( q _ { b } ) > \mathcal { T } _ { t } ( \arg \operatorname* { m a x } ( q _ { b } ) ) ) H ( \hat { q } _ { b } , p _ { m } ( y | \Omega ( u _ { b } ) ) ) ,
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
where $q _ { b } = p _ { m } ( y | \omega ( u _ { b } ) )$ . The flexible thresholds are updated at each iteration. Finally, we can formulate the loss in FlexMatch as the weighted combination (by $\lambda$ ) of supervised and unsupervised loss:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\begin{array} { r } { \mathcal { L } _ { t } = \mathcal { L } _ { s } + \lambda \mathcal { L } _ { u , t } , } \end{array}
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
where $\mathcal { L } _ { s }$ is the supervised loss on labeled data:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\mathcal { L } _ { s } = \frac { 1 } { B } \sum _ { b = 1 } ^ { B } H \big ( y _ { b } , p _ { m } ( y | \omega ( x _ { b } ) ) \big ) .
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
Note that the cost of introducing CPL is almost free. Practically, every time the prediction confidence of an unlabeled data $u _ { n }$ is above the fixed threshold $\tau$ , the data, and its predicted class are marked and will be used for calculating $\beta _ { t } ( c )$ at the next time step. Such marking actions are bonus actions each time the consistency loss is computed. Therefore, FlexMatch does not introduce additional forward propagation processes for evaluating the model’s learning status, nor new parameters.
|
| 115 |
+
|
| 116 |
+
# 3.2 Threshold warm-up
|
| 117 |
+
|
| 118 |
+
We noticed in our experiments that at the early stage of the training, the model may blindly predict most unlabeled samples into a certain class depending on the parameter initialization(i.e., more likely to have confirmation bias). Hence, the estimated learning status may not be reliable at this stage. Therefore, we introduce a warm-up process by rewriting the denominator in Eq. (6) as:
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
\beta _ { t } ( c ) = \frac { \sigma _ { t } ( c ) } { \operatorname* { m a x } \left\{ \operatorname* { m a x } _ { c } \sigma _ { t } , N - \sum _ { c } \sigma _ { t } \right\} } ,
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
1: Input: $\mathcal X = \{ ( x _ { m } , y _ { m } ) : m \in ( 1 , \ldots , M ) \} , \mathcal { U } = \{ u _ { n } : n \in ( 1 , \ldots , N ) \}$ {M labeled data and
|
| 125 |
+
N unlabeled data.}
|
| 126 |
+
2: $\hat { u } _ { n } = - 1 : n \in ( 1 , \dots , N )$ {Initialize predictions of all unlabeled data as $^ { - 1 }$ indicating unused.}
|
| 127 |
+
3: while not reach the maximum iteration do
|
| 128 |
+
4: for $c = 1$ to $C$ do
|
| 129 |
+
5: $\begin{array} { r } { \sigma ( c ) = \sum _ { n = 1 } ^ { N } \mathbb { 1 } ( \hat { u } _ { n } = c ) } \end{array}$ {Compute estimated learning effect.}
|
| 130 |
+
6: if max $\begin{array} { r } { \sigma ( c ) < \sum _ { n = 1 } ^ { N } \mathbb { 1 } ( \hat { u } _ { n } = - 1 ) } \end{array}$ then
|
| 131 |
+
7: Calculate $\beta ( c )$ using Eq. (11) {Threshold warms up when unused data dominate.}
|
| 132 |
+
8: else
|
| 133 |
+
9: Calculate $\beta ( c )$ using Eq. (6) {Compute normalized estimated learning effect.}
|
| 134 |
+
10: end if
|
| 135 |
+
11: Calculate $\tau ( c )$ using Eq. (7) {Determine the flexible threshold for class $c$ .}
|
| 136 |
+
12: end for
|
| 137 |
+
13: for $b = 1$ to $\mu B$ do
|
| 138 |
+
14: if $p _ { m } ( y | \omega ( u _ { b } ) ) > \tau$ then
|
| 139 |
+
15: $\hat { u } _ { b } = \arg \operatorname* { m a x } q _ { b }$ {Update the prediction of unlabeled data $u _ { b }$ .}
|
| 140 |
+
16: end if
|
| 141 |
+
17: end for
|
| 142 |
+
18: Compute the loss via Eq. (8), (10) and (9).
|
| 143 |
+
19: end while
|
| 144 |
+
20: Return: Model parameters.
|
| 145 |
+
|
| 146 |
+
where the term $\begin{array} { r } { N - \sum _ { c = 1 } ^ { C } \sigma _ { t } ( c ) } \end{array}$ can be regarded as the number of unlabeled data that have not been used. This ensures that at the beginning of the training, all estimated learning effects gradually rise from 0 until the number of unused unlabeled data is no longer predominant. The duration of such a period depends on the unlabeled data amount (ref. $N$ in Eq. (11)) and the learning difficulty (ref. the growing speed of $\sigma _ { t } ( c )$ in Eq. (11)) of the dataset. In practice, such a warm-up process is very easy to implement as we can add an extra class to denote the unused unlabeled data. Thus calculating the denominator of Eq. (11) is simply converted to finding the maximum among $c + 1$ classes.
|
| 147 |
+
|
| 148 |
+
# 3.3 Non-linear mapping function
|
| 149 |
+
|
| 150 |
+
The flexible threshold in Eq. (7) is determined by the normalized estimated learning effects via a linear mapping. However, it may not be the most suitable mapping in the real training process, where the increase or decrease of $\beta _ { t } ( c )$ may make big jumps in the early phase where the predictions of the model are still unstable; and only make small fluctuations after the class is well-learned in the mid and late training stage. Therefore, it is preferable if the flexible thresholds can be more sensitive when $\beta _ { t } ( c )$ is large and vice versa.
|
| 151 |
+
|
| 152 |
+
We propose a non-linear mapping function to enable the thresholds to have a non-linear increasing curve when $\beta _ { t } ( c )$ ranges uniformly from 0 to 1, as formulated below:
|
| 153 |
+
|
| 154 |
+
$$
|
| 155 |
+
\mathscr { T } _ { t } ( c ) = \mathcal { M } ( \beta _ { t } ( c ) ) \cdot \tau ,
|
| 156 |
+
$$
|
| 157 |
+
|
| 158 |
+
where $\mathcal { M } ( \cdot )$ is a non-linear mapping function. It is clear that Eq. (7) can be seen as a special case by setting $\mathcal { M }$ to the identity function. The mapping function $\mathcal { M }$ should be monotonically increasing and have a maximum no larger than $1 / \tau$ (otherwise the flexible threshold can be larger than 1 and filter out all samples). To avoid introducing additional hyper-parameters (e.g. lower limits of the flexible thresholds), we consider the mapping function to have a range from 0 to 1 so that the flexible thresholds range from 0 to $\tau$ .
|
| 159 |
+
|
| 160 |
+
A monotone increasing convex function lets the thresholds grow slowly when $\beta _ { t } ( c )$ is small, and become more sensitive as $\beta _ { t } ( c )$ gets larger. Hence, we intuitively choose a convex function with the above-mentioned properties to compare among mapping $\begin{array} { r } { \mathcal { M } ( x ) = \frac { x } { 2 - x } } \end{array}$ for our experiments. We also conduct an ablation studyh different convexity and concavity in Sec. 4.4. The full algorithm of FlexMatch is shown in Algorithm 1.
|
| 161 |
+
|
| 162 |
+
Table 1: Error rates on CIFAR-10/100, SVHN, and STL-10 datasets. The ‘Flex’ prefix denotes applying CPL to the algorithm, and ‘PL’ is an abbreviation of Pseudo-Labeling. STL-10 dataset does not have label information for unlabeled data, thus its fully-supervised result is unavailable.
|
| 163 |
+
|
| 164 |
+
<table><tr><td>Dataset</td><td colspan="3">CIFAR-10</td><td colspan="3">CIFAR-100</td><td colspan="3">STL-10</td><td colspan="2">SVHN</td></tr><tr><td>Label Amount</td><td>40</td><td>250</td><td>4000</td><td>400</td><td>2500</td><td>10000</td><td>40</td><td>250</td><td>1000</td><td>40</td><td>1000</td></tr><tr><td>PL</td><td>74.61±0.26</td><td>46.49±2.20</td><td>15.08±0.19</td><td>87.45±0.85</td><td>57.74±0.28</td><td>36.55±0.24</td><td>74.68±0.99</td><td>55.45±2.43</td><td>32.64±0.71</td><td>64.61±5.60</td><td>9.40±0.32</td></tr><tr><td>Flex-PL</td><td>73.74±1.96</td><td>46.14±1.81</td><td>14.75±0.19</td><td>85.72±0.46</td><td>56.12±0.51</td><td>35.60±0.15</td><td>73.42±2.19</td><td>52.06±2.50</td><td>32.05±0.37</td><td>63.21±3.64</td><td>12.05±0.54</td></tr><tr><td>UDA</td><td>10.62±3.75</td><td>5.16±0.06</td><td>4.29±0.07</td><td>46.39±1.59</td><td>27.73±0.21</td><td>22.49±0.23</td><td>37.42±8.44</td><td>9.72±1.15</td><td>6.64±0.17</td><td>5.12±4.27</td><td>1.89±0.01</td></tr><tr><td>Flex-UDA</td><td>5.44±0.52</td><td>5.02±0.07</td><td>4.24±0.06</td><td>45.17±1.88</td><td>27.08±0.15</td><td>21.91±0.10</td><td>29.53±2.10</td><td>9.03±0.45</td><td>6.10±0.25</td><td>3.42±1.51</td><td>2.02±0.05</td></tr><tr><td>FixMatch</td><td>7.47±0.28</td><td>4.86±0.05</td><td>4.21±0.08</td><td>46.42±0.82</td><td>28.03±0.16</td><td>22.20±0.12</td><td>35.97±4.14</td><td>9.81±1.04</td><td>6.25±0.33</td><td>3.81±1.18</td><td>1.96±0.03</td></tr><tr><td>FlexMatch</td><td>4.97±0.06</td><td>4.98±0.09</td><td>4.19±0.01</td><td>39.94±1.62</td><td>26.49±0.20</td><td>21.90±0.15</td><td>29.15 ±4.16</td><td>8.23±0.39</td><td>5.77±0.18</td><td>8.19±3.20</td><td>6.72±0.30</td></tr><tr><td>Fully-Supervised</td><td></td><td>4.62± 0.05</td><td></td><td></td><td>19.30± 0.09</td><td></td><td></td><td>:</td><td></td><td>2.13± 0.02</td><td></td></tr></table>
|
| 165 |
+
|
| 166 |
+
# 4 Experiments
|
| 167 |
+
|
| 168 |
+
We evaluate FlexMatch and other CPL-enabled algorithms on common SSL datasets: CIFAR10/100 [23], SVHN [24], STL-10 [25] and ImageNet [26], and extensively investigate the performance under various labeled data amounts. We mainly compare our method with Pseudo-Labeling [4], UDA [11] and FixMatch [14], since they all involve a pre-defined threshold. The results of other popular SSL algorithms are in the appendix. We also add a fully-supervised experiment for each dataset to better understand the results of SSL algorithms. Note that previously suggested [27] fully-supervised comparisons use only the labeled set for training, whose purpose is to manifest the improvement brought by the introduction of unlabeled data. With the development of modern SSL algorithms, however, semi-supervised approaches are achieving competitive performance with supervised ones, or even better performance due to the strength of consistency regularization. Therefore, our fully-supervised comparisons are conducted with all data labeled, and apply weak data augmentations following Eq. (10). We re-implement all baselines using our PyTorch [28] codebase: TorchSSL, which is introduced in the appendix.
|
| 169 |
+
|
| 170 |
+
For a fair comparison, we use the same hyper-parameters following FixMatch [14]. Concretely, the optimizer for all experiments is standard stochastic gradient descent (SGD) with a momentum of 0.9 [29, 30]. For all datasets, we use an initial learning rate of 0.03 with a cosine learning rate decay schedule [31] as $\eta = \eta _ { 0 } \cos ( \frac { 7 \pi k } { 1 6 K } )$ , where $\eta _ { 0 }$ is the initial learning rate, $k$ is the current training step and $K$ is the total training step that is set to $2 ^ { 2 0 }$ . We also perform an exponential moving average with the momentum of 0.999. The batch size of labeled data is 64 except for ImageNet. $\mu$ is set to be 1 for Pseudo-Label and 7 for UDA, FixMatch, and FlexMatch. $\tau$ is set to 0.8 for UDA and 0.95 for Pseudo Label, FixMatch, and FlexMatch. These setups follow the original papers. The strong augmentation function used in our experiments is RandAugment [32]. We use ResNet-50 [33] for the ImageNet experiment and Wide ResNet (WRN) [34] and its variant [35] for other datasets. Detailed hyper-parameters are listed in the appendix.
|
| 171 |
+
|
| 172 |
+
We adopt two evaluation metrics: (1) the median error rate of the last 20 checkpoints following [12, 14], and (2) the best error rate in all checkpoints. We argue that the median approach is not suitable when the convergence speeds of the algorithms show significant differences – the large number of redundant iterations may result in over-fitting for the fast-converge algorithms. Therefore, we report the best error rates for all algorithms, while the results of the median approach are also provided in the appendix, showing that our FlexMatch still achieves the best performance. We run each task three times using distinct random seeds to obtain the error bars.
|
| 173 |
+
|
| 174 |
+
# 4.1 Main results
|
| 175 |
+
|
| 176 |
+
The classification error rates on CIFAR-10/100, STL-10 and SVHN datasets are in Table 1, and the results on ImageNet are in Sec. 4.2. Note that the SVHN dataset used in our experiment also includes the extra set that contains 531,131 additional samples. Results demonstrate that FlexMatch achieves the state-of-the-art performance on most of the benchmark datasets except for SVHN where Flex-UDA (i.e., UDA with CPL) and UDA have the lowest error rate on the 40-label split and the 1000-label split, respectively. We also provide the detailed precision, recall, F1, and AUC results in the appendix. Our CPL (FlexMatch) has the following advantages:
|
| 177 |
+
|
| 178 |
+
CPL achieves better performance on tasks with extremely limited labeled data. Our FlexMatch significantly outperforms other methods when the amount of labels is extremely small. For instance, on the CIFAR-100 dataset with 400 labels (i.e., only 4 label samples per class), FlexMatch achieves an average error rate of $3 9 . 9 4 \%$ , which significantly outperforms FixMatch $( 4 6 . 4 2 \% )$ .
|
| 179 |
+
|
| 180 |
+

|
| 181 |
+
Figure 3: Convergence analysis of FixMatch and FlexMatch. (a) and (b) depict the loss and top1-accuracy on CIFAR-100 with 400 labels. Evaluations are done every 5K iterations. (c) and (d) demonstrate the class-wise accuracy within the first 200K iterations on CIFAR-10 dataset. The numbers in legend correspond to the ten classes in the dataset.
|
| 182 |
+
|
| 183 |
+
CPL improves the performance of existing SSL algorithms. Other than FixMatch, CPL can also improve the performance of other existing SSL algorithms such as Pseudo-Labeling and UDA. For instance, the error rate is reduced from $3 7 . 4 \%$ to $2 9 . 5 3 \%$ for UDA on the STL-10 40-label split after introducing CPL (refer to as Flex-UDA in Table 1). These results further prove the effectiveness of CPL in better leveraging unlabeled data. Figure 2 shows the average running time of a single iteration with or without adding our CPL, it is clear that while improving the performance of existing SSL algorithms, our CPL does not introduce additional computational burden.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
Figure 2: Average running time of one iteration on a single GeForce RTX 3090 GPU.
|
| 187 |
+
|
| 188 |
+
CPL achieves better performance on complicated tasks. The STL-10 dataset contains unlabeled data from a similar but broader distribution of images than its labeled set. The existence of new types of objects in the unlabeled dataset makes STL-10 a more challenging and realistic task. FlexMatch achieves greater performance improvement under such a challenging situation. The error rate on STL-10 with only 40 labels is $2 9 . 1 5 \%$ , which is relatively $1 8 . 9 6 \%$ better than FixMatch $( 3 5 . 9 7 \% )$ . Similar strong improvements are also observed on CIFAR-100 dataset, which has as many as one hundred classes.
|
| 189 |
+
|
| 190 |
+
We also analyze the reason why FlexMatch performs less favorably on SVHN. This is probably because SVHN is a relatively simple (i.e., to classify digits) yet unbalanced dataset. The class-wise imbalance leads to the classes with fewer samples never have their estimated learning effects close to 1 according to Eq. (6), even when they are already well-learned. Such low thresholds allow noisy pseudo-labeled samples to be trusted and learned throughout the training process, which is also reflected by the loss descent curve where the low-threshold classes have major fluctuations. FixMatch, on the other hand, fixes its threshold at 0.95 to filter out noisy samples. Such a fixed high threshold is not preferable with respect to both accuracies of hard-to-learn classes and overall convergence speed as explained earlier, but since SVHN is an easy task, the model can easily learn the task and make high-confidence predictions, setting a high-fixed threshold thus becomes less problematic and has its advantages overweighed.
|
| 191 |
+
|
| 192 |
+
# 4.2 Results on ImageNet
|
| 193 |
+
|
| 194 |
+
We also verify the effectiveness of CPL on ImageNet-1K [26] which is a much more realistic and complicated dataset. We randomly choose the same 100K labeled data (i.e., 100 labels per class), which is less than $8 \%$ of the total labels. The hyper-parameters used for ImageNet can be found in the appendix, where the two algorithms share the same hyper-parameters. We show the error rate comparison after running $2 ^ { 2 0 }$ iterations in Table 2. This result indicates that when the task is complicated, despite the class imbalance issue (the number of images within each class ranges from 732 to 1300), CPL can still bring improvements. Note that this result does not represent the best performance of each algorithm as the model cannot fully converge after $2 ^ { 2 0 }$ iterations, and due to the computational resource limitation, we did not further tune the hyper-parameters to obtain the best results on ImageNet.
|
| 195 |
+
|
| 196 |
+
Table 2: Error rate results on ImageNet after $2 ^ { 2 0 }$ iterations.
|
| 197 |
+
|
| 198 |
+
<table><tr><td>Method</td><td>Top-1</td><td>Top-5</td></tr><tr><td>FixMatch FlexMatch</td><td>43.66 42.02</td><td>21.80 19.49</td></tr></table>
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 4: Ablation study of FlexMatch.
|
| 202 |
+
|
| 203 |
+
# 4.3 Convergence speed acceleration
|
| 204 |
+
|
| 205 |
+
Another strong advantage of FlexMatch is its superior convergence speed. Figure 3(a) and 3(b) shows the comparison between FlexMatch and FixMatch with respect to the loss and top-1-accuracy on CIFAR-100 400-label split. The loss of FlexMatch decreases much faster and smoother than FixMatch, demonstrating its superior convergence speed. The major fluctuations of the loss in FixMatch may due to the pre-defined threshold that lets pass most unlabeled data belonging to certain classes, whereas with CPL a larger batch of unlabeled data containing samples from various classes enables the gradient to more directly head toward the global optimum. As a result, with only 50K iterations, FlexMatch has already surpassed the final results of FixMatch. After 800K iterations, however, we observe a further decrease in loss and accuracy. This is likely due to over-fitting, which also occurs in FixMatch after 900K iterations. Thus, we believe it is not fair to use the median results of the last few checkpoints for evaluating algorithms with different convergence speeds.
|
| 206 |
+
|
| 207 |
+
We further compare the class-wise accuracy of FixMatch and FlexMatch on CIFAR-10 in their early training stages. As shown in Figure 3(c) and 3(d), at iteration 200K, FixMatch only hits an overall accuracy of $5 6 . 3 5 \%$ as half of the classes are still learned unsatisfactorily, whereas FlexMatch has already achieved an overall accuracy of $9 4 . 2 9 \%$ which is even higher than the final accuracy reached by FixMatch after 1M iterations. It is manifest that the introduction of CPL successfully encourages the model to proactively learn those difficult classes thereby improving the overall learning effect.
|
| 208 |
+
|
| 209 |
+
# 4.4 Ablation study
|
| 210 |
+
|
| 211 |
+
We conduct experiments to evaluate three components of FlexMatch: the upper limit of thresholds $\tau$ mapping functions $\mathcal M ( x )$ , and threshold warm-up.
|
| 212 |
+
|
| 213 |
+
Threshold upper bound. We investigate 5 different $\tau$ values and 3 different mapping functions on CIFAR-10 dataset with 40 labels. As shown in Figure 4(a), the optimal choice of $\tau$ is around 0.95, either increasing or decreasing this value results in a performance decay. Note that in FlexMatch, tuning $\tau$ does not only affect the upper limit of the threshold but also the estimated learning effects because they are determined by the number of samples that fall above $\tau$ .
|
| 214 |
+
|
| 215 |
+
Mapping function. We explore three different mapping functions in Figure 4(b): (1) concave: $\mathcal { M } ( x ) = \ln ( x + 1 ) / \ln 2$ , (2) linear: $\mathcal { M } ( x ) = x$ , and (3) convex: $\mathcal { M } ( x ) = x / ( 2 - x )$ . We see that the convex function shows the best performance and the concave function shows the worst. Although tweaking the degree of convexity may probably lead to further improvement, we do not make further investigation in this paper. It is noteworthy that all these functions have their outputs grow from 0 to 1 when the inputs go from 0 to 1. One may also design a function with a different range, for instance, from 0.5 to 1. In this case, it is equivalent to setting a lower limit to the flexible threshold so that even at the beginning of the training, only samples with prediction confidence higher than this limit will contribute to the unsupervised loss. We do not include such a lower limit in FlexMatch since it will introduce a new hyper-parameter. However, we did find that setting a lower limit at 0.5 can slightly improve the performance. A possible reason is that the lower threshold prevents noisy training caused by incorrect pseudo labels at the early stage [36].
|
| 216 |
+
|
| 217 |
+
Threshold warm-up. We analyze the performance of threshold warm-up on both CIFAR-10 (40 labels) and CIFAR-100 (400 labels) datasets. As shown in Figure 4(c), threshold warm-up can bring about $0 . 2 \%$ absolute improvement on CIFAR-10 and about $1 \%$ on CIFAR-100. At the beginning of the training without the threshold warm-up, the flexible thresholds may go through heavy fluctuations because the denominator in Eq.(6) is small. In the meantime, there will always be some classes whose flexible thresholds reach or approach $\tau$ , thereby filtering out most unlabeled data in the batch. The threshold warm-up solves this issue by gradually raising the thresholds of all classes from zero – it creates a learning boom at the early training stage where most of the unlabeled data can be utilized.
|
| 218 |
+
|
| 219 |
+
Comparison with class balancing objectives. CPL has the effect of balancing across classes the number of unlabeled samples used to compute pseudo-labeling loss in each batch. Similar effect can be achieved by making the marginal class distribution close to a uniform distribution for each batch. We conduct such a comparative experiment by directly adding an additional objective to FixMatch: $\begin{array} { r } { \mathcal { L } _ { b } = \sum _ { c } q _ { c } \log ( q _ { c } / \hat { p } _ { c } ) } \end{array}$ [22], where $\hat { p } _ { c }$ is the mean predicted probability of class $c$ across all samples in the batch, and $q$ is a uniform distribution: $q _ { c } = 1 / C$ . The error rate of adding such an objective is $7 . 1 6 \%$ on the CIFAR-10 40-label split (compared with FixMatch $7 . 4 7 \% \pm 0 . 2 8$ and FlexMatch $4 . 9 7 \% \pm 0 . 0 6 )$ . While this approach requires instances of each class within each batch to be balanced to make sense, CPL does not have such a constraint. It is more flexible and involves less human intervention to adjust thresholds than adjusting model’s predictions.
|
| 220 |
+
|
| 221 |
+
# 5 Related Work
|
| 222 |
+
|
| 223 |
+
Pseudo-Labeling [4] is a pioneer SSL method that uses hard artificial labels converted from model predictions. A confidence-based strategy was used in [6] along with pseudo labeling so that the unlabeled data are used only when the predictions are sufficiently confident. Such confidence-based thresholding also presents in recently proposed UDA [11] and FixMatch [14] with the difference being that UDA used sharpened ‘soft’ pseudo labels with a temperature whereas Fixmatch adopted one-hot ‘hard’ labels. The success of UDA and FixMatch, however, relies heavily on the usage of strong data augmentations to improve the consistency regularization. ReMixMatch [13] also leveraged such strong augmentations.
|
| 224 |
+
|
| 225 |
+
The combination of curriculum learning and semi-supervised learning is popular in recent years [37– 39]. For multi-model image classification task, [37] optimized the learning process of unlabeled images by judging their reliability and discriminability. In [38], the easy image-level properties are learned first and then used to facilitate segmentation via constrained CNNs. Curriculum learning is also used to alleviate out-of-distribution problems by picking up in-distribution samples from unlabeled data according to the out-of-distribution scores [39].
|
| 226 |
+
|
| 227 |
+
Several researches have investigated on dynamic threshold in related fields such as sentiment analysis [40] and semantic segmentation [41]. In [40], the threshold was gradually reduced to make high-quality data selected into labeled data set in the early stage and large-quantity in the later stage. An extra classifier is added to automate the threshold to deal with domain inconsistency in [41]. [42] introduced curriculum learning to self-training with a steadily increasing threshold and achieved near state-of-the-art results.
|
| 228 |
+
|
| 229 |
+
# 6 Conclusion and Future Work
|
| 230 |
+
|
| 231 |
+
In this paper, we introduce Curriculum Pseudo Labeling (CPL), a curriculum learning approach of leveraging unlabeled data for SSL. CPL dramatically improves the performance and convergence speed of SSL algorithms that involve thresholds while being extremely simple and almost cost-free. FlexMatch, our improved algorithm of FixMatch, achieves state-of-the-art performance on a variety of SSL benchmarks. In future work, we would like to improve our method under the long-tail scenario where the unlabeled data belonging to each class are extremely unbalanced.
|
| 232 |
+
|
| 233 |
+
# Broader Impact
|
| 234 |
+
|
| 235 |
+
CPL fills the gap that no modern SSL algorithm considers the inherent learning difficulties of different classes during the training, and shows that by doing so, the convergence speed and final accuracy can both be improved. We hope that CPL can attract more future attention to explore the effectiveness of utilizing unlabeled data according to the model’s learning status as well as the per-class learning difficulty.
|
| 236 |
+
|
| 237 |
+
# Funding Disclosure
|
| 238 |
+
|
| 239 |
+
Funding in direct support of this work: computing resource granted by Tokyo Institute of Technology and Microsoft Research Asia. This work was partially supported by Toray Science Foundation.
|
| 240 |
+
|
| 241 |
+
# References
|
| 242 |
+
|
| 243 |
+
[1] Philip Bachman, Ouais Alsharif, and Doina Precup. Learning with pseudo-ensembles. In NeurIPS, pages 3365–3373, 2014.
|
| 244 |
+
[2] Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. ICLR, 2017.
|
| 245 |
+
[3] Mehdi Sajjadi, Mehran Javanmardi, and Tolga Tasdizen. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. In NeurIPS, pages 1171–1179, 2016.
|
| 246 |
+
[4] Dong-Hyun Lee et al. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on challenges in representation learning, ICML, volume 3, 2013.
|
| 247 |
+
[5] Geoffrey J McLachlan. Iterative reclassification procedure for constructing an asymptotically optimal rule of allocation in discriminant analysis. Journal of the American Statistical Association, 70(350):365–369, 1975.
|
| 248 |
+
[6] Chuck Rosenberg, Martial Hebert, and Henry Schneiderman. Semi-supervised self-training of object detection models. 2005.
|
| 249 |
+
[7] Henry Scudder. Probability of error of some adaptive pattern-recognition machines. IEEE Transactions on Information Theory, 11(3):363–371, 1965.
|
| 250 |
+
[8] Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V Le. Self-training with noisy student improves imagenet classification. In CVPR, pages 10687–10698, 2020.
|
| 251 |
+
[9] Antti Rasmus, Harri Valpola, Mikko Honkala, Mathias Berglund, and Tapani Raiko. Semisupervised learning with ladder networks. In NeurIPS, pages 3546–3554, 2015.
|
| 252 |
+
[10] Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NeurIPS, pages 1195– 1204, 2017.
|
| 253 |
+
[11] Qizhe Xie, Zihang Dai, Eduard Hovy, Thang Luong, and Quoc Le. Unsupervised data augmentation for consistency training. NeurIPS, 33, 2020.
|
| 254 |
+
[12] David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin Raffel. Mixmatch: A holistic approach to semi-supervised learning. NeurIPS, page 5050–5060, 2019.
|
| 255 |
+
[13] David Berthelot, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Kihyuk Sohn, Han Zhang, and Colin Raffel. Remixmatch: Semi-supervised learning with distribution matching and augmentation anchoring. In ICLR, 2019.
|
| 256 |
+
[14] Kihyuk Sohn, David Berthelot, Nicholas Carlini, Zizhao Zhang, Han Zhang, Colin A Raffel, Ekin Dogus Cubuk, Alexey Kurakin, and Chun-Liang Li. Fixmatch: Simplifying semisupervised learning with consistency and confidence. NeurIPS, 33, 2020.
|
| 257 |
+
[15] Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ICML, pages 41–48, 2009.
|
| 258 |
+
[16] Yves Grandvalet, Yoshua Bengio, et al. Semi-supervised learning by entropy minimization. In CAP, pages 281–296, 2005.
|
| 259 |
+
[17] Anastasia Pentina, Viktoriia Sharmanska, and Christoph H Lampert. Curriculum learning of multiple tasks. In CVPR, pages 5492–5500, 2015.
|
| 260 |
+
[18] Lu Jiang, Deyu Meng, Qian Zhao, Shiguang Shan, and Alexander Hauptmann. Self-paced curriculum learning. In AAAI, volume 29, 2015.
|
| 261 |
+
[19] Alex Graves, Marc G Bellemare, Jacob Menick, Remi Munos, and Koray Kavukcuoglu. Automated curriculum learning for neural networks. In ICML, pages 1311–1320. PMLR, 2017.
|
| 262 |
+
[20] Guy Hacohen and Daphna Weinshall. On the power of curriculum learning in training deep networks. In ICML, pages 2535–2544. PMLR, 2019.
|
| 263 |
+
[21] Daphna Weinshall, Gad Cohen, and Dan Amir. Curriculum learning by transfer learning: Theory and experiments with deep networks. In ICML, pages 5238–5246. PMLR, 2018.
|
| 264 |
+
[22] Eric Arazo, Diego Ortego, Paul Albert, Noel E O’Connor, and Kevin McGuinness. Pseudolabeling and confirmation bias in deep semi-supervised learning. In IJCNN, pages 1–8, 2020.
|
| 265 |
+
[23] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 266 |
+
[24] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011.
|
| 267 |
+
[25] Adam Coates, Andrew $\mathrm { N g }$ , and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In AISTATS, pages 215–223, 2011.
|
| 268 |
+
[26] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pages 248–255. Ieee, 2009.
|
| 269 |
+
[27] Avital Oliver, Augustus Odena, Colin Raffel, Ekin D Cubuk, and Ian J Goodfellow. Realistic evaluation of deep semi-supervised learning algorithms. In NeurIPS, pages 3239–3250, 2018.
|
| 270 |
+
[28] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. NeurIPS, 32:8026–8037, 2019.
|
| 271 |
+
[29] Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In ICML, pages 1139–1147. PMLR, 2013.
|
| 272 |
+
[30] Boris T Polyak. Some methods of speeding up the convergence of iteration methods. Ussr computational mathematics and mathematical physics, 4(5):1–17, 1964.
|
| 273 |
+
[31] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. ICLR, 2016.
|
| 274 |
+
[32] Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 702–703, 2020.
|
| 275 |
+
[33] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
|
| 276 |
+
[34] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In BMVC, 2016.
|
| 277 |
+
[35] Tianyi Zhou, Shengjie Wang, and Jeff Bilmes. Time-consistent self-supervision for semisupervised learning. In ICML, pages 11523–11533. PMLR, 2020.
|
| 278 |
+
[36] Mamshad Nayeem Rizve, Kevin Duarte, Yogesh S Rawat, and Mubarak Shah. In defense of pseudo-labeling: An uncertainty-aware pseudo-label selection framework for semi-supervised learning. arXiv preprint arXiv:2101.06329, 2021.
|
| 279 |
+
[37] Chen Gong, Dacheng Tao, Stephen J Maybank, Wei Liu, Guoliang Kang, and Jie Yang. Multimodal curriculum learning for semi-supervised image classification. IEEE Transactions on Image Processing, 25(7):3249–3260, 2016.
|
| 280 |
+
[38] Hoel Kervadec, Jose Dolz, Éric Granger, and Ismail Ben Ayed. Curriculum semi-supervised segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 568–576. Springer, 2019.
|
| 281 |
+
[39] Qing Yu, Daiki Ikami, Go Irie, and Kiyoharu Aizawa. Multi-task curriculum framework for open-set semi-supervised learning. In ECCV, pages 438–454. Springer, 2020.
|
| 282 |
+
[40] Yue Han, Yuhong Liu, and Zhigang Jin. Sentiment analysis via semi-supervised learning: a model based on dynamic threshold and multi-classifiers. Neural Computing and Applications, 32(9):5117–5129, 2020.
|
| 283 |
+
[41] Zhedong Zheng and Yi Yang. Rectifying pseudo label learning via uncertainty estimation for domain adaptive semantic segmentation. IJCV, 129(4):1106–1120, 2021.
|
| 284 |
+
[42] Paola Cascante-Bonilla, Fuwen Tan, Yanjun Qi, and Vicente Ordonez. Curriculum labeling: Revisiting pseudo-labeling for semi-supervised learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 6912–6920, 2021.
|
md/train/5UZ-AcwFDKJ/5UZ-AcwFDKJ.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Replay-Guided Adversarial Environment Design
|
| 2 |
+
|
| 3 |
+
Minqi Jiang∗ UCL, FAIR
|
| 4 |
+
|
| 5 |
+
Michael Dennis∗ UC Berkeley
|
| 6 |
+
|
| 7 |
+
Jack Parker-Holder University of Oxford
|
| 8 |
+
|
| 9 |
+
Jakob Foerster FAIR
|
| 10 |
+
|
| 11 |
+
Edward Grefenstette UCL, FAIR
|
| 12 |
+
|
| 13 |
+
Tim Rocktäschel UCL, FAIR
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
Deep reinforcement learning (RL) agents may successfully generalize to new settings if trained on an appropriately diverse set of environment and task configurations. Unsupervised Environment Design (UED) is a promising selfsupervised RL paradigm, wherein the free parameters of an underspecified environment are automatically adapted during training to the agent’s capabilities, leading to the emergence of diverse training environments. Here, we cast Prioritized Level Replay (PLR), an empirically successful but theoretically unmotivated method that selectively samples randomly-generated training levels, as UED. We argue that by curating completely random levels, PLR, too, can generate novel and complex levels for effective training. This insight reveals a natural class of UED methods we call Dual Curriculum Design (DCD). Crucially, DCD includes both PLR and a popular UED algorithm, PAIRED, as special cases and inherits similar theoretical guarantees. This connection allows us to develop novel theory for PLR, providing a version with a robustness guarantee at Nash equilibria. Furthermore, our theory suggests a highly counterintuitive improvement to PLR: by stopping the agent from updating its policy on uncurated levels (training on less data), we can improve the convergence to Nash equilibria. Indeed, our experiments confirm that our new method, $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ , obtains better results on a suite of out-of-distribution, zero-shot transfer tasks, in addition to demonstrating that $\mathrm { P L R ^ { \perp } }$ improves the performance of PAIRED, from which it inherited its theoretical framework.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
While deep reinforcement learning (RL) approaches have led to many successful applications in challenging domains like Atari [21], Go [35], Chess [36], Dota [4], and StarCraft [40] in recent years, deep RL agents still prove to be brittle, often failing to transfer to environments only slightly different from those encountered during training [44, 9]. To ensure learning of robust and well-generalizing policies, agents must train on sufficiently diverse and informative variations of environments (e.g. see Section 3.1 of [8]). However, it is not always feasible to specify an appropriate training distribution or a generator thereof. Agents may therefore benefit greatly from methods that automatically adapt the distribution over environment variations throughout training [10, 17]. Throughout this paper we will call a particular environment instance or configuration (e.g. an arrangement of blocks, race tracks, or generally any of the environment’s constituent entities) a level.
|
| 22 |
+
|
| 23 |
+
Two recent works [10, 17] have sought to empirically demonstrate this need for a more targeted agentadaptive mechanism for selecting levels on which to train RL agents, so to ensure efficient learning and generalization to unseen levels—as well as to provide methods implementing such mechanisms. The first method, Protagonist Antagonist Induced Regret Environment Design (PAIRED) [10], introduces a self-supervised RL paradigm called Unsupervised Environment Design (UED). Here, an environment generator (a teacher) is co-evolved with a student policy that trains on levels actively proposed by the teacher, leading to a form of adaptive curriculum learning. The aim of this coevolution is for the teacher to gradually learn to generate environments that exemplify properties of those that might be encountered at deployment time, and for the student to simultaneously learn a good policy that enables zero-shot transfer to such environments. PAIRED’s specific adversarial approach to environment design ensures a useful robustness characterization of the final student policy in the form of a minimax regret guarantee [31]—assuming that its underlying teacher-student multi-agent system arrives at a Nash equilibrium [NE, 24]. In contrast, the second method, Prioritized Level Replay (PLR) [17], embodies an alternative form of dynamic curriculum learning that does not assume control of level generation, but instead, the ability to selectively replay existing levels. PLR tracks levels previously proposed by a black-box environment generator, and for each, estimates the agent’s learning potential in that level, in terms of how useful it would be to gather new experience from that level again in the future. The PLR algorithm exploits these scores to adapt a schedule for revisiting or replaying levels to maximize learning potential. PLR has been shown to produce scalable and robust results, improving both sample complexity of agent training and the generalization of the learned policy in diverse environments. However, unlike PAIRED, PLR is motivated with heuristic arguments and lacks a useful theoretical characterization of its learning behavior.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: Randomly drawn samples of CarRacing tracks produced by different methods. (a) Domain Randomization (DR) produces tracks of average complexity, with few sharp turns. (b) PAIRED often overexploits the difference in the students, leading to simple tracks that incidentally favor the antagonist. (c) REPAIRED mitigates this degeneracy, recovering track complexity. (d) $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ selects the most challenging randomly generated tracks, resulting in tracks that more closely resemble human-designed tracks, such as (e) the Nürburgring Grand Prix.
|
| 27 |
+
|
| 28 |
+
In this paper, we argue that PLR is, in and of itself, an effective form of UED: Through curating even randomly generated levels, PLR can generate novel and complex levels for learning robust policies. This insight leads to a natural class of UED methods which we call Dual Curriculum Design (DCD). In DCD, a student policy is challenged by a team of two co-evolving teachers. One teacher actively generates new, challenging levels, while the other passively curates existing levels for replaying, by prioritizing those estimated to be most suitably challenging for the student. We show that PAIRED and PLR are distinct members of the DCD class of algorithms and prove in Section 3 that all DCD algorithms enjoy similar minimax regret guarantees to that of PAIRED.
|
| 29 |
+
|
| 30 |
+
We make use of this result to provide the first theoretical characterization of PLR, which immediately suggests a simple yet highly counterintuitive adjustment to PLR: By only training on trajectories in replay levels, PLR becomes provably robust at NE. We call this resulting variant $\mathrm { P L R ^ { \perp } }$ (Section 4). From this perspective, PLR effectively performs level design in a diametrically opposite manner to PAIRED—through prioritized selection rather than active generation. A second corollary to the provable robustness of DCD algorithms shows that $\mathrm { P L R ^ { \perp } }$ can be extended to make use of the PAIRED teacher as a level generator while preserving the robustness guarantee of PAIRED, resulting in a method we call Replay-Enhanced PAIRED (REPAIRED) (Section 5). We hypothesize that in this arrangement, $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ plays a complementary role to PAIRED in robustifying student policies.
|
| 31 |
+
|
| 32 |
+
Our experiments in Section 6 investigate the learning dynamics of $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ , REPAIRED, and their replay-free counterparts on a challenging maze domain and a novel continuous control UED setting based on the popular CarRacing environment [5]. In both of these highly distinct settings, our methods provide significant improvements over PLR and PAIRED, producing agents that can perform out-of-distribution (OOD) generalization to a variety of human designed mazes and Formula 1 tracks.
|
| 33 |
+
|
| 34 |
+
In summary, we present the following contributions: (i) We establish a common framework, Dual Curriculum Design, that encompasses PLR and PAIRED. This allows us to develop new theory, which provides the first robustness guarantees for PLR at NE as well as for REPAIRED, which augments PAIRED with a PLR-based replay mechanism. (ii) Crucially, our theory suggests a highly counterintuitive improvement to PLR: the convergence to NE should be assisted by training on less data when using PLR—namely by only taking gradient updates from data that originates from the PLR buffer, using the samples from the environment distribution only for computing the prioritization of levels in the buffer. (iii) Our experiments in a maze domain and a novel car racing domain show that our methods significantly outperform their replay-free counterparts in zero-shot generalization. We open source our methods at https://github.com/facebookresearch/dcd.
|
| 35 |
+
|
| 36 |
+
# 2 Background
|
| 37 |
+
|
| 38 |
+
# 2.1 Unsupervised Environment Design
|
| 39 |
+
|
| 40 |
+
Unsupervised Environment Design (UED), as introduced by [10], is the problem of automatically designing a distribution of environments that adapts to the learning agent. UED is defined in terms of an Underspecified POMDP (UPOMDP), given by $\mathcal { M } = \langle A , O , \overset { \vartriangle } { \boldsymbol { \Theta } } , \overset { \vartriangle } { \boldsymbol { S } ^ { \mathcal { M } } } , \mathcal { T } ^ { \mathcal { M } } , \mathcal { T } ^ { \mathcal { M } } , \mathcal { R } ^ { \mathcal { M } } , \gamma \rangle$ , where $A$ is a set of actions, $O$ is a set of observations, $S$ is a set of states, $\mathcal { T } : S \times A \times \Theta \Delta ( S )$ is a transition function, $\mathcal { T } : S O$ is an observation (or inspection) function, $\mathcal { R } : S \mathbb { R }$ is a reward function, and $\gamma$ is a discount factor. This definition is identical to a POMDP with the addition of $\Theta$ to represent the free-parameters of the environment. These parameters can be distinct at every time step and incorporated into the transition function $\mathcal { T } ^ { \mathcal { M } } : S \times \mathbf { \bar { A } } \times \Theta \Delta ( S )$ . For example, $\Theta$ could represent the possible positions of obstacles in a maze. We will refer to the environment resulting from a fixed $\theta \in \Theta$ as $\mathcal { M } _ { \theta }$ , or with a slight abuse of notation, simply $\theta$ when clear from context. We ne the value of . Aligning wit $\pi$ in er $\mathcal { M } _ { \theta }$ to be logy f $\begin{array} { r } { V ^ { \theta } ( \pi ) = \mathbb { E } [ \sum _ { i = 0 } ^ { T } r _ { t } \gamma ^ { t } ] } \end{array}$ where ully-sp $r _ { t }$ are the rewards attained by ified environment as a level. $\pi$ in $\mathcal { M } _ { \theta }$
|
| 41 |
+
|
| 42 |
+
# 2.2 Protagonist Antagonist Induced Regret Environment Design
|
| 43 |
+
|
| 44 |
+
Protagonist Antagonist Induced Regret Environment Design [PAIRED, 10] presents a UED approach consisting of simultaneously training agents in a three player game: the protagonist $\pi _ { A }$ and the antagonist $\pi _ { B }$ are trained in environments generated by the teacher $\tilde { \theta }$ . The objective of this game is defined by $U ( \pi _ { A } , \pi _ { B } , \tilde { \theta } ) = \mathbb { E } _ { \theta \sim \tilde { \theta } } [ \mathrm { R E G R E T } ^ { \theta } ( \pi _ { A } , \pi _ { B } ) ]$ , where regret is defined by $\mathrm { R E G R E T } ^ { \theta } ( \pi _ { A } , \pi _ { B } ) = V ^ { \theta } ( \pi _ { B } ) - V ^ { \theta } ( \pi _ { A } )$ . The protagonist and antagonist are both trained to maximize their discounted environment returns while the teacher is trained to maximize $U$ . Note that by maximizing regret, the teacher is disincentivized from generating unsolvable levels, which will have a maximum regret of 0. As shorthand, we will sometimes refer to the protagonist and antagonist jointly as the student agents. The counterclockwise loop beginning at the student agents in Figure 2 summarizes this approach, with the students being both the protagonist and antagonist.
|
| 45 |
+
|
| 46 |
+
As both student agents grow more adept at solving different levels, the teacher continues to adapt its level designs to exploit the weaknesses of the protagonist in relation to the antagonist. As this dynamic unfolds, PAIRED produces an emergent curriculum of progressively more complex levels along the boundary of the protagonist’s capabilities. PAIRED is a creative method in the sense that the teacher may potentially generate an endless sequence of novel levels. However, as the teacher only adapts through gradient updates, it is inherently slow to adapt to changes in the student policies.
|
| 47 |
+
|
| 48 |
+
# 2.3 Prioritized Level Replay
|
| 49 |
+
|
| 50 |
+
Prioritized Level Replay [PLR, 17] is an active-learning strategy shown to improve a policy’s sample efficiency and generalization to unseen levels when training and evaluating on levels from a common UPOMDP, typically implemented as a seeded simulator. PLR maintains a level buffer $\pmb { \Lambda }$ of the top $K$ visited levels with highest learning potential as estimated by the time-averaged L1 value loss of the learning agent over the last episode on each level. At the start of each training episode, with some predefined replay probability $p$ , PLR uses a bandit to sample the level from $\pmb { \Lambda }$ to maximize the estimated learning potential; otherwise, with probability $1 - p$ , PLR samples a new level from the simulator. In contrast to the generative but slow-adapting PAIRED, PLR does not create new levels, but instead, acts as a fast-adapting curation mechanism for selecting the next training level among previously encountered levels. Also unlike PAIRED, PLR does not provide a robustness guarantee. By extending the theoretical foundation of PAIRED to PLR, we will show how PLR can be modified to provide a robustness guarantee at NE, as well as how PAIRED can exploit PLR’s complementary curation to quickly switch among generated levels to maximize the student’s regret.
|
| 51 |
+
|
| 52 |
+
# 3 The Robustness of Dual Curriculum Design
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
Figure 2: Overview of Dual Curriculum Design (DCD). The student learns in the presence of two co-adapting teachers that aim to maximize the student’s regret: The generator teacher designs new levels to challenge the agent, and the curator teacher prioritizes a set of levels already created, selectively sampling them for replay.
|
| 56 |
+
|
| 57 |
+
The previous approaches of PAIRED and PLR reveal a natural duality: Approaches that gradually learn to generate levels like PAIRED, and methods which cannot generate levels, but instead, quickly curate existing ones, like PLR. This duality suggests combining slow level generators with fast level curators. We call this novel class of UED algorithms Dual Curriculum Design (DCD). For instance, PLR can be seen as curator with a prioritized sampling mechanism with a random generator, while PAIRED, as a regret-maximizing generator without a curator. DCD can further consider Domain Randomization (DR) as a degenerate case of a random level generator without a curator.
|
| 58 |
+
|
| 59 |
+
To theoretically analyze this space of methods, we model DCD as a three player game among a student agent and two teachers called the dual curriculum game. However, to formalize this game, we must first formalize the single-teacher setting: Suppose the UPOMDP is clear from context. Then, given a utility function for a single teacher, $U _ { t } ( \pi , \theta )$ , we can naturally define the base game between the student $s$ and teacher $t$ as $G = \langle S = S _ { s } \times S _ { t } , U = U _ { s } \times U _ { t } \rangle$ , where $S _ { s } = \Pi$ is the strategy set of the student, $S _ { t } = \Theta$ is the strategy set of the teacher, and $U _ { s } ( \pi , \theta ) = V ^ { \theta } ( \pi )$ is the utility function of the student. In Sections 4 and 5, we will study settings corresponding to different choices of utility functions for the teacher agents, namely the maximum-regret objective $U _ { t } ^ { R } ( \pi , \theta )$ and the uniform objective $U _ { t } ^ { U } ( \pi , \theta )$ . These two objectives are defined as follows (for any constant $C$ ):
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\begin{array} { c } { U _ { t } ^ { R } ( \pi , \theta ) = \underset { \pi ^ { * } \in \Pi } { \operatorname { a r g m a x } } \{ V ^ { \theta } ( \pi ^ { * } ) - V ^ { \theta } ( \pi ) \} } \\ { U _ { t } ^ { U } ( \pi , \theta ) = C } \end{array}
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
In the dual curriculum game $\overline { G }$ , the first teacher plays the game with probability $p$ , and the second, with probability $( 1 - p )$ —or more formally, $\overline { { G } } = \langle \overline { { S } } = S _ { s } \times S _ { t } \times S _ { t } , U = \overline { { U } } _ { s } \times \overline { { U } } _ { t } ^ { 1 } \times \overline { { U } } _ { t } ^ { 2 } \rangle$ , where the utility functions for the student and two teachers respectively, $\overline { { U } } _ { s } , \overline { { U } } _ { t } ^ { 1 } , \overline { { U } } _ { t } ^ { 2 }$ , are defined as follows:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\begin{array} { c } { { \overline { { { U } } } _ { t } ^ { 1 } ( \pi , \theta ^ { 1 } , \theta ^ { 2 } ) = p U _ { t } ^ { 1 } ( \pi , \theta ^ { 1 } ) } } \\ { { \overline { { { U } } } _ { t } ^ { 2 } ( \pi , \theta ^ { 1 } , \theta ^ { 2 } ) = ( 1 - p ) U _ { t } ^ { 2 } ( \pi , \theta ^ { 2 } ) } } \\ { { \overline { { { U } } } _ { s } ( \pi , \theta ^ { 1 } , \theta ^ { 2 } ) = p U _ { s } ( \pi , \theta ^ { 1 } ) + ( 1 - p ) U _ { s } ( \pi , \theta ^ { 2 } ) } } \end{array}
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
Our main theorem is that NE in the dual curriculum game are approximate NE of both the base game for either of the original teachers and the base game with a teacher maximizing the joint-reward of $p U _ { t } ^ { 1 } + ( 1 - p ) U _ { t } ^ { 2 }$ , where the quality of the approximations depends on the mixing probability $p$ .
|
| 72 |
+
|
| 73 |
+
Theorem 1. Let $B$ be the maximum difference between $\boldsymbol { U } _ { t } ^ { 1 }$ and ${ U } _ { t } ^ { 2 }$ , and let $( \pi , \theta ^ { 1 } , \theta ^ { 2 } )$ be a NE for $\overline { { G } }$ . Then $( \pi , p \theta ^ { 1 } + ( 1 - p ) \theta ^ { 2 } )$ is an approximate NE for the base game with either teacher or for $a$ teacher optimizing their joint objective. More precisely, it is a $2 B p ( 1 - p )$ -approximate NE when $U _ { t } = p U _ { t } ^ { 1 } + ( 1 - p ) U _ { t } ^ { 2 }$ , a $2 B ( 1 - p )$ -approximate NE when $U _ { t } = U _ { t } ^ { 1 }$ , and a $2 B p$ -approximate NE when $U _ { t } = U _ { t } ^ { 2 }$ .
|
| 74 |
+
|
| 75 |
+
The intuition behind this theorem is that, since the two teachers do not affect each other’s behavior, their best response to a fixed $\pi _ { s }$ is to choose a strategy $\theta$ that maximizes $\boldsymbol { U } _ { t } ^ { 1 }$ and ${ U } _ { t } ^ { 2 }$ respectively.
|
| 76 |
+
|
| 77 |
+
Moreover, the two teachers’ strategies can be viewed as a single combined strategy for the base game with the joint-objective, or with each teacher’s own objective. In fact, the teachers provide an approximate best-response to each case of the base game simply by playing their individual best responses. Thus, when we reach a NE of the dual curriculum game, the teachers arrive at approximate best responses for both the base game with the joint objective and with their own objectives, meaning they are also in an approximate NE of the base game with either teacher. The full details of this proof are outlined in Appendix A.
|
| 78 |
+
|
| 79 |
+
# 4 Robustifying PLR
|
| 80 |
+
|
| 81 |
+
In this section, we provide theoretical justification for the empirically observed effectiveness of PLR, and in the process, motivate a counterintuitive adjustment to the algorithm.
|
| 82 |
+
|
| 83 |
+
# Algorithm 1: Robust PLR (PLR⊥)
|
| 84 |
+
|
| 85 |
+
<table><tr><td colspan="2">Randomly initialize policy π()and an empty level buffer,Λ of size K. while not converged do</td></tr><tr><td colspan="2">Sample replay-decision Bernoulli, d ~ PD(d) ifd=O then</td></tr><tr><td colspan="2">Sample levelθ from level generator</td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2">Collect π's trajectory T on θ, with a stop-gradient 𝜙⊥ i.e. Suppress policy update else</td></tr><tr><td colspan="2">Use PLR to sample a replay level from the level store,θ ~Λ</td></tr><tr><td colspan="2">Collect policy trajectory T on θ and update T with rewards R(T)</td></tr><tr><td colspan="2">end</td></tr><tr><td colspan="2">Compute PLR score, S = score(T,π)</td></tr><tr><td colspan="2">Update Λ with θ using score S end</td></tr></table>
|
| 86 |
+
|
| 87 |
+
# 4.1 Achieving Robustness Guarantees with PLR
|
| 88 |
+
|
| 89 |
+
PLR provides strong empirical gains in generalization, but lacks any theoretical guarantees of robustness. One step towards achieving such a guarantee is to replace its L1 value-loss prioritizaton with a regret prioritization, using the methods we discuss in Section 4.2: While L1 value loss may be good for quickly training the value function, it can bias the long-term training behavior toward high-variance policies. However, even with this change, PLR holds weaker theoretical guarantees because the random generating teacher can bias the student away from minimax regret policies and instead, toward policies that sacrifice robustness in order to excel in unstructured levels. We formalize this intuitive argument in the following corollary of Theorem 1.
|
| 90 |
+
|
| 91 |
+
Corollary 1. Let $\overline { G }$ be the dual curriculum game in which the first teacher maximizes regret, so $\begin{array} { r l r } { U _ { t } ^ { 1 } } & { { } = } & { U _ { t } ^ { R } } \end{array}$ , and the second teacher plays randomly, so $\begin{array} { r c l } { \overline { { U } } _ { t } ^ { 2 } } & { = } & { U _ { t } ^ { U } } \end{array}$ . Let $V ^ { \theta } ( \pi )$ be bounded in $[ \bar { B } ^ { - } , B ^ { + } ]$ for all $\theta , \pi$ . Further, suppose that $( \pi , \theta ^ { 1 } , \theta ^ { 2 } )$ is a Nash equilibrium of $\overline { { G } }$ . Let $\begin{array} { r c l } { R ^ { * } } & { = } & { \operatorname* { m i n } _ { \pi _ { A } \in \Pi } \{ \operatorname* { m a x } _ { \theta , \pi _ { B } \in \Theta , \Pi } \{ \mathrm { R E G R E T } ^ { \theta } ( \pi _ { A } , \pi _ { B } ) \} \} } \end{array}$ be the optimal worst-case regret. Then $\pi$ is $2 ( B ^ { + } - B ^ { - } ) ( 1 - p )$ close to having optimal worst-case regret, or formally, $\begin{array} { r } { \operatorname* { m a x } _ { \theta , \pi _ { B } \in \Theta , \Pi } \{ { \mathrm { R E G R E T } } ^ { \theta } ( \pi _ { A } , \pi ) \} \geq R ^ { * } - 2 ( B ^ { + } - B ^ { - } ) ( 1 - p ) . } \end{array}$ . Moreover, there exists environments for all values of $p$ within a constant factor of achieving this bound.
|
| 92 |
+
|
| 93 |
+
The proof of Corollary 1 follows from a direct application of Theorem 1 to show that a NE of $\overline { { G } }$ is an approximate NE for the base game of the first teacher, and through constructing a simple example where the student’s best response in $\overline { G }$ fails to attain the minimax regret in $G$ . These arguments are described in full in Appendix A. This corollary provides some justification for why PLR improves robustness of the equilibrium policy, as it biases the resulting policy toward a minimax regret policy. However, it also points a way towards further improving PLR: If the probability $p$ of using a teachergenerated level directly was set to 0, then in equilibrium, the resulting policy converges to a minimax regret policy. Consequently, we arrive at the counterintuitive idea of avoiding gradient updates from trajectories collected from randomly sampled levels, to ensure that at NE, we find a minimax regret policy. From a robustness standpoint, it is therefore optimal to train on less data. The modified PLR algorithm $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ with this counterintuitive adjustment is summarized in Algorithm 1, in which this small change relative to the original algorithm is highlighted in blue.
|
| 94 |
+
|
| 95 |
+
# 4.2 Estimating Regret
|
| 96 |
+
|
| 97 |
+
In general, levels may differ in maximum achievable returns, making it impossible to know the true regret of a level without access to an oracle. As the L1 value loss typically employed by PLR does not generally correspond to regret, we turn to alternative scoring functions that better approximate regret. Two approaches, both effective in practice, are discussed below.
|
| 98 |
+
|
| 99 |
+
Positive Value Loss Averaging over all transitions with positive value loss amounts to estimating regret as the difference between maximum achieved return and predicted return on an episodic basis. However, this estimate is highly biased, as the value targets are tied to the agent’s current, potentially suboptimal policy. As it only considers positive value losses, this scoring function leads to optimistic sampling of levels with respect to the current policy. When using GAE [33] to estimate bootstrapped value targets, this loss takes the following form, where $\lambda$ and $\gamma$ are the GAE and MDP discount factors respectively, and $\delta _ { t }$ , the TD-error at timestep $t$ :
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\frac { 1 } { T } \sum _ { t = 0 } ^ { T } \operatorname* { m a x } \left( \sum _ { k = t } ^ { T } ( \gamma \lambda ) ^ { k - t } \delta _ { k } , 0 \right) .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Maximum Monte Carlo (MaxMC) We can mitigate some of the bias of the positive value loss by replacing the value target with the highest return achieved on the given level so far during training. By using this maximal return, the regret estimates no longer depend on the agent’s current policy. This estimator takes the simple form of $\begin{array} { r } { ( 1 / T ) \sum _ { t = 0 } ^ { T } R _ { \mathrm { m a x } } - \bar { V ( s _ { t } ) } } \end{array}$ . In our dense-reward experiments, we compute this score as the difference between the maximum achieved return and $V ( s _ { 0 } )$ .
|
| 106 |
+
|
| 107 |
+
# 5 Replay-Enhanced PAIRED (REPAIRED)
|
| 108 |
+
|
| 109 |
+
We can replace the random generator teacher used by $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ with the PAIRED teacher. This extension entails a second student agent, the antagonist, also equipped with its own PLR level buffer. In each episode, with probability $p$ , the students evaluate their performances (but do not train) on a newly generated level and, with probability $1 - p$ , train on a level sampled from each student’s own regret-prioritizing PLR buffer. Training only on the highest regret levels should mitigate inefficiencies in the PAIRED teacher’s optimization procedure. We refer to this extension as Replay-Enhanced PAIRED (REPAIRED). An overview of REPAIRED is provided by black arrows in Figure 2, with the students being the protagonist and antagonist, while the full pseudocode is outlined in Appendix B.
|
| 110 |
+
|
| 111 |
+
Since $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ and PAIRED both promote regret in equilibrium, it would be reasonable to believe that the combination of the two does the same. A straightforward corollary of Theorem 1, which we describe in Appendix 1, shows that, in a theoretically ideal setting, combining these two algorithms as is done in REPAIRED indeed finds minimax regret strategies in equilibrium.
|
| 112 |
+
|
| 113 |
+
Corollary 2. Let $\overline { { G } }$ be the dual curriculum game in which both teachers maximize regret, so ${ \cal U } _ { t } ^ { 1 } \ : = \ : { \bar { { \cal U } } } _ { t } ^ { 2 } \ : = \ : { \cal U } _ { t } ^ { R }$ . Further, suppose that $( \bar { \pi } , \theta ^ { 1 } , \theta ^ { 2 } )$ is a Nash equilibrium of $\overline { { G } }$ . Then, $\pi \in$ $\begin{array} { r } { \operatorname * { a r g m i n } _ { \pi _ { A } \in \Pi } \lbrace \operatorname* { m a x } _ { \theta , \pi _ { B } \in \Theta , \Pi } \lbrace { \mathrm { R E G R E T } } ^ { \theta } ( \pi _ { A } , \pi _ { B } ) \rbrace \rbrace } \end{array}$ .
|
| 114 |
+
|
| 115 |
+
This result gives us some amount of assurance that, if our method arrives at NE, then the protagonist has converged to a minimax regret strategy, which has the benefits outlined in [10]: Since a minimax regret policy solves all solvable environments, whenever this is possible and sufficiently well-defined, we should expect policies resulting from the equilibrium behavior of REPAIRED to be robust and versatile across all environments in the domain.
|
| 116 |
+
|
| 117 |
+
# 6 Experiments
|
| 118 |
+
|
| 119 |
+
Our experiments firstly aim to (1) assess the empirical performance of the theoretically motivated $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ , and secondly, seek to better understand the effect of replay on unsupervised environment design, specifically (2) its impact on the zero-shot generalization performance of the induced student policies, and (3) the complexity of the levels designed by the teacher. To do so, we compare PLR and REPAIRED against their replay-free counterparts, DR and PAIRED, in the two highly distinct settings of discrete control with sparse rewards and continuous control with dense rewards. We provide environment descriptions alongside model and hyperparameter choices in Appendix D.
|
| 120 |
+
|
| 121 |
+
# 6.1 Partially-Observable Navigation
|
| 122 |
+
|
| 123 |
+
Each navigation level is a partially-observable maze requiring student agents to take discrete actions to reach a goal and receive a sparse reward. Our agents use PPO [34] with an LSTM-based recurrent policy to handle partial observability. Before each episode, the teacher designs the level in this order: beginning with an empty maze, it places one obstructing block per time step up to a predefined block budget, and finally places the agent followed by the goal.
|
| 124 |
+
|
| 125 |
+

|
| 126 |
+
Figure 3: Zero-shot transfer performance in challenging test environments after 250M training steps. The plots show median and interquartile range of solved rates over 10 runs. An asterisk $( ^ { \ast } )$ next to the maze name indicates the maze is procedurally-generated, and thus each attempt corresponds to a random configuration of the maze.
|
| 127 |
+
|
| 128 |
+
Zero-Shot Generalization We train policies with each method for 250M steps and evaluate zeroshot generalization on several challenging OOD environments, in addition to levels from the full distribution of two procedurally-generated environments, PerfectMaze and LargeCorridor. We also compare against DR and minimax baselines. Our results in Figure 3 and 4 show that $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ and REPAIRED both achieve greater sample-efficiency and zero-shot generalization than their replay-free counterparts. The improved test performance achieved by $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ over both DR and PLR when trained for an equivalent number of gradient updates, aggregated over all test mazes, is statistically significant $( p < 0 . 0 5 )$ , as is the improved test performance of REPAIRED over PAIRED. Well before 250 million steps, both PLR and $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ significantly outperform PAIRED after 3 billion training steps, as reported in [10]. Further, both PLR variants lead to policies exhibiting greater zero-shot transfer than the PAIRED variants. Notably, the $\mathrm { P L R ^ { \perp } }$ agent learns to solve mazes via an approximate right-hand rule. Table 2 in Appendix C.1 reports performance across all test mazes. The success of designing regret-maximizing levels via random search (curation) over learning a generator with RL suggests that for some UPOMDPs, the regret landscape, as a function of the free parameters $\theta$ , has a low effective dimensionality [3]. Foregoing gradient-based learning in favor of random search may then lead to faster adaptation to the changing regret landscape, as the policy evolves throughout training.
|
| 129 |
+
|
| 130 |
+
Emergent Complexity As the student agents improve, the teachers must generate more challenging levels to maintain regret. We measure the resultant emergent complexity by tracking the number of blocks in each level and the shortest path length to the goal (where unsolvable levels are assigned a length of 0). These results, summarized in Figure 4, show that PAIRED slowly adapts the complexity over training while REPAIRED initially quickly grows complexity, before being overtaken by PAIRED. This more rapid onset of complexity may be due to REPAIRED’s fast replay mechanism, and the long-term slowdown relative to PAIRED may be explained by its less frequent gradient updates. Our results over an extended training period in Appendix C confirm that both PAIRED and REPAIRED slowly increase complexity over time, eventually matching that attained in just a fraction of the number of gradient steps by PLR and $\mathrm { P L R ^ { \perp } }$ . This result shows that random search is surprisingly efficient at continually discovering levels of increasing complexity, given an appropriate curation mechanism such as PLR. Figure 5 shows that, similar to methods with a regret-maximizing teacher, PLR finds levels exhibiting complex structure.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 5: Examples of emergent structures generated by each method.
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 4: Zero-shot transfer performance during training for PAIRED and REPAIRED variants. The plots show mean and standard error across 10 runs. The dotted lines mark the mean performance of PAIRED after 3B training steps, as reported in [10], while dashed lines indicate median returns.
|
| 137 |
+
|
| 138 |
+
# 6.2 Pixel-Based Car Racing with Continuous Control
|
| 139 |
+
|
| 140 |
+
To test the versatility and scalability of our methods, we turn to an extended version of the CarRacing environment from OpenAI Gym [5]. This environment entails continuous control with dense rewards, a 3-dimensional action space, and partial, pixel observations, with the goal of driving a full lap around a track. To enable UED of any closed-loop track, we reparameterize CarRacing to generate tracks as Bézier curves [22] with arbitrary control points. The teacher generates levels by choosing a sequence of up to 12 control points, which uniquely defines a Bézier track within specific, predefined curvature constraints. After 5M steps of training, we test the zero-shot transfer performance of policies trained by each method on 20 levels replicating official human-designed Formula One (F1) tracks (see Figure 19 in the Appendix for a visualization of the tracks). Note that these tracks are significantly OOD, as they cannot be defined with just 12 control points. In Figure 6 we show the progression of zero-shot transfer performance for the original CarRacing environment, as well as three F1 tracks of varying difficulty, while also including the final performance on the full F1 benchmark. For the final performance, we also evaluated the state-of-the-art CarRacing agent from [38] on our new F1 benchmark.
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Figure 6: Zero-shot transfer performance. Plots show mean and standard error over 10 runs.
|
| 144 |
+
|
| 145 |
+
Unlike in the sparse, discrete navigation setting, we find DR leads to moderately successful policies for zero-shot transfer in CarRacing. Dense rewards simplify the learning problem and random Bezier tracks occasionally contain the challenges seen in F1 tracks, such as hairpin turns and observations showing parallel tracks due to high local curvature. Still, we see that policies trained by selectively sampling tracks to maximize regret significantly outperform those trained by uniformly sampling from randomly generated tracks, in terms of zero-shot transfer to the OOD F1 tracks. Remarkably, with a replay rate of 0.5, $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ sees statistically significant $( p < 0 . 0 0 1 )$ gains over PLR in zero-shot performance over the full F1 benchmark, despite directly training on only half the rollout data using half as many gradient updates. Once again, we see that random search with curation via PLR produces a rich selection of levels and an effective curriculum.
|
| 146 |
+
|
| 147 |
+
We also observe that PAIRED struggles to train a robust protagonist in CarRacing. Specifically, PAIRED overexploits the relative strengths of the antagonist over the protagonist, finding curricula that steer the protagonist towards policies that ultimately perform poorly even on simple tracks, leading to a gradual reduction in level complexity. We present training curves revealing this dynamic in Appendix C. As shown in Figure 6, REPAIRED mitigates this degeneracy substantially, though not completely, inducing a policy that significantly outperforms PAIRED $( p < 0 . 0 0 1 )$ in mean performance on the full F1 benchmark, but underperforms DR. Notably, $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ exceeds the performance of the state-of-the-art AttentionAgent [38], despite not using a self-attention policy and training on less than $0 . 2 5 \%$ of the number of environment steps in comparison. These gains come purely from the induced curriculum. Figure 17 in Appendix C further reveals that $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ produces CarRacing policies that tend to achieve higher minimum returns on average compared to the baseline methods, providing further evidence of the benefits of the minimax regret property coupled with a fast replay-based mechanism for efficiently finding high-regret levels.
|
| 148 |
+
|
| 149 |
+
# 7 Related Work
|
| 150 |
+
|
| 151 |
+
In inducing parallel curricula, DCD follows a rich lineage of curriculum learning methods [2, 32, 28, 23]. Many previous curriculum learning algorithms resemble the curator in DCD, sharing similar underlying selective-sampling mechanisms as $\mathrm { P L R ^ { \perp } }$ . Most similar is TSCL [19], which prioritizes levels based on return rather than value loss, and has been shown to overfit to training levels in some settings [17]. In our setting, replayed levels can be viewed as past strategies from a level-generating teacher. This links our replay-based methods to fictitious self-play [FSP, 13], and more closely, Prioritized FSP [40], which selectively samples opponents based on historic win ratios.
|
| 152 |
+
|
| 153 |
+
Recent approaches that make use of a generating adversary include Asymmetric Self-Play [37, 26], wherein one agent proposes tasks for another in the form of environment trajectories, and AMIGo [6], wherein the teacher is rewarded for proposing reachable goals. While our methods do not presuppose a goal-based setting, others have made progress here using generative modeling [12, 29], latent skill learning [14], and exploiting model disagreement [45]. These methods are less generally applicable than $\mathrm { P L R ^ { \perp } }$ , and unlike our DCD methods, they do not provide well-principled robustness guarantees.
|
| 154 |
+
|
| 155 |
+
Other recent algorithms can be understood as forms of UED and like DCD, framed in the lens of decision theory. POET [41, 42], a coevolutionary approach [27], uses a population of minimax (rather than minimax regret) adversaries to construct terrain for a BipedalWalker agent. In contrast to our methods, POET requires training a large population of both agents and environments and consequently, a sizable compute overhead. APT-Gen [11] also procedurally generates tasks, but requires access to target tasks, whereas our methods seek to improve zero-shot transfer.
|
| 156 |
+
|
| 157 |
+
The DCD framework also encompasses adaptive domain randomization methods [DR, 20, 15], which have seen success in assisting sim2real transfer for robotics [39, 16, 1, 25]. DR itself is subsumed by procedural content generation [30], for which UED and DCD may be seen as providing a formal, decision-theoretic framework, enabling development of provably optimal algorithms.
|
| 158 |
+
|
| 159 |
+
# 8 Discussion
|
| 160 |
+
|
| 161 |
+
We established a novel connection between PLR and minimax regret UED approaches like PAIRED, by developing the theory of Dual Curriculum Design (DCD). In this setting, a student policy is challenged by a team of two co-adapting, regret-maximizing teachers: one, a generator that creates new levels, and the other, a curator that selectively samples previously generated levels for replay. This view unifies PLR and PAIRED, which are both instances of DCD. Our theoretical results on DCD then enabled us to prove that PLR attains a minimax regret policy at NE, thereby providing the first theoretical characterization of the robustness of PLR. Notably our theory leads to the counterintuitive result that PLR can be made provably robust by training on less data, specifically, by only using the trajectories on levels sampled for replay. In addition, we developed Replay-Enhanced PAIRED (REPAIRED), which extends the selective replay-based updates of $\mathrm { P L R ^ { \perp } }$ to PAIRED, and proved it shares the same robustness guarantee at NE. Empirically, in two highly distinct environments, we found that $\mathrm { P L R ^ { \perp } }$ significantly improves zero-shot generalization over PLR, and REPAIRED, over PAIRED. As our methods solely modify the order of levels visited during training, they can, in principle, be combined with many other RL methods to yield potentially orthogonal improvements in sample-efficiency and generalization.
|
| 162 |
+
|
| 163 |
+
While these DCD-based improvements to PLR and PAIRED empirically lead to more robust policies, it is important to emphasize that our theoretical results only prove a minimax regret guarantee at NE for these methods; however, they provide no explicit guarantee of convergence to such NE. Further, it is worth highlighting that replay-based methods like $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ are completely dependent on the quality of levels proposed by the generator. Our results show that simply curating high regret levels discovered via random search is enough to outperform the RL-based PAIRED teacher in the domains studied. We expect that advancing methods for defining or adapting the generator’s proposal distribution holds great potential to improve the efficacy of our methods, especially in more complex, higher-dimensional domains, where random search may prove ineffective for finding useful training levels. Importantly, our methods assume an appropriate choice of what constitutes the UPOMDP’s free parameters. Our methods cannot be expected to produce robust policies for zero-shot transfer if the set of environments defined by the free parameters does not sufficiently align with the transfer domain of interest. Designing the environment parameterization for successful zero-shot transfer to a specific target domain can be highly non-trivial, posing an important problem for future research.
|
| 164 |
+
|
| 165 |
+
Looking beyond environment design, we notice that long-running UED processes in expansive UPDOMPs closely resemble continual learning in open-ended domains. The congruency of these settings suggests our contributions around DCD may extend to more general continual learning problems in which agents must learn to master a diverse sequence of tasks with predefined (or inferred) episode boundaries—if tasks are assumed to be designed by a regret-maximizing teacher. Thus, DCD-based methods like $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ may yield more general policies for continual learning. We anticipate many exciting crossovers between these areas of research in the years to come.
|
| 166 |
+
|
| 167 |
+
Given the rapid progress in applying RL to ever more complex domains, we can confidently expect a continued rise in real-world deployments of RL systems in the coming years. Unlike in simulation, in the real world, the environment tends to exhibit much more variability, which may not be explicitly coded into the associated simulator used for training. Deployed RL agents are thus liable to make many mistakes due to unexpected environment variations. Our methods for improving UED lead to more robust RL agents across a potentially wide range of changes to the environment. Thus, our work may prove to be a useful tool in attaining safer, more reliable RL agents, helping to enable the application of RL to more real-world problems.
|
| 168 |
+
|
| 169 |
+
By increasing the applicability of RL to real-world settings, our work may exacerbate the more general risks of deploying machine learning: increased unemployment; overreliance on biased models that potentially reinforce common misconceptions and societal inequalities; and the advancement of automated weapons. Particular to our methods, as discussed in Section 8, aligning the choice of free parameters for the UPOMDP to the target domain of interest is important for successful transfer. While this choice of free parameters then acts as a potential point of failure, the UPOMDP abstraction underlying UED reveals this problem generally impacts all RL methods aiming to train robust policies; a UPOMDP simply makes explicit the otherwise implicit space of environment configurations defined by a standard POMDP. By forcing us to consider where our training environment departs from reality, UED methods encourage designing RL systems in a way that is more aware of the underlying assumptions about the environment, thereby leading to more principled, robust systems.
|
| 170 |
+
|
| 171 |
+
# Acknowledgments and Disclosure of Funding
|
| 172 |
+
|
| 173 |
+
We would like to thank Natasha Jaques, Patrick Labatut, and Heinrich Küttler for fruitful discussions that helped inform this work. Further, we are grateful to our anonymous reviewers for their valuable feedback. MJ is supported by the FAIR PhD program. This work was funded by Facebook.
|
| 174 |
+
|
| 175 |
+
References
|
| 176 |
+
[1] O. M. Andrychowicz, B. Baker, M. Chociej, R. Józefowicz, B. McGrew, J. Pachocki, A. Petron, M. Plappert, G. Powell, A. Ray, J. Schneider, S. Sidor, J. Tobin, P. Welinder, L. Weng, and W. Zaremba. Learning dexterous in-hand manipulation. The International Journal of Robotics Research, 39(1):3–20, 2020.
|
| 177 |
+
[2] Y. Bengio, J. Louradour, R. Collobert, and J. Weston. Curriculum learning. In Proceedings of the 26th Annual International Conference on Machine Learning, ICML ’09, page 41–48, New York, NY, USA, 2009. Association for Computing Machinery.
|
| 178 |
+
[3] J. Bergstra and Y. Bengio. Random search for hyper-parameter optimization. Journal of Machine Learning Research, 13:281–305, 2012.
|
| 179 |
+
[4] C. Berner, G. Brockman, B. Chan, V. Cheung, P. D˛ebiak, C. Dennison, D. Farhi, Q. Fischer, S. Hashme, C. Hesse, et al. Dota 2 with large scale deep reinforcement learning. arXiv preprint arXiv:1912.06680, 2019.
|
| 180 |
+
[5] G. Brockman, V. Cheung, L. Pettersson, J. Schneider, J. Schulman, J. Tang, and W. Zaremba. Openai gym. CoRR, abs/1606.01540, 2016.
|
| 181 |
+
[6] A. Campero, R. Raileanu, H. Kuttler, J. B. Tenenbaum, T. Rocktäschel, and E. Grefenstette. Learning with AMIGo: Adversarially motivated intrinsic goals. In International Conference on Learning Representations, 2021.
|
| 182 |
+
[7] M. Chevalier-Boisvert, L. Willems, and S. Pal. Minimalistic gridworld environment for openai gym. https://github.com/maximecb/gym-minigrid, 2018.
|
| 183 |
+
[8] K. Cobbe, C. Hesse, J. Hilton, and J. Schulman. Leveraging procedural generation to benchmark reinforcement learning. In Proceedings of the 37th International Conference on Machine Learning, pages 2048–2056, 2020.
|
| 184 |
+
[9] K. Cobbe, O. Klimov, C. Hesse, T. Kim, and J. Schulman. Quantifying generalization in reinforcement learning. In K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, Proceedings of Machine Learning Research. PMLR, 2019.
|
| 185 |
+
[10] 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. In Advances in Neural Information Processing Systems, volume 33, 2020.
|
| 186 |
+
[11] K. Fang, Y. Zhu, S. Savarese, and F.-F. Li. Adaptive procedural task generation for hardexploration problems. In International Conference on Learning Representations, 2021.
|
| 187 |
+
[12] C. Florensa, D. Held, X. Geng, and P. Abbeel. Automatic goal generation for reinforcement learning agents. In J. Dy and A. Krause, editors, Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 1515–1528. PMLR, 10 2018.
|
| 188 |
+
[13] J. Heinrich, M. Lanctot, and D. Silver. Fictitious self-play in extensive-form games. In Proceedings of the 32nd International Conference on Machine Learning, pages 805–813, 2015.
|
| 189 |
+
[14] A. Jabri, K. Hsu, A. Gupta, B. Eysenbach, S. Levine, and C. Finn. Unsupervised curricula for visual meta-reinforcement learning. In Advances in Neural Information Processing Systems, volume 32, 2019.
|
| 190 |
+
[15] N. Jakobi. Evolutionary robotics and the radical envelope-of-noise hypothesis. Adaptive Behavior, 6(2):325–368, 1997.
|
| 191 |
+
[16] S. James, A. J. Davison, and E. Johns. Transferring end-to-end visuomotor control from simulation to real world for a multi-stage task. In 1st Conference on Robot Learning, 2017.
|
| 192 |
+
[17] M. Jiang, E. Grefenstette, and T. Rocktäschel. Prioritized level replay. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pages 4940–4950. PMLR, 2021.
|
| 193 |
+
[18] X. Ma. Car racing with pytorch. https://github.com/xtma/pytorch_car_caring, 2019.
|
| 194 |
+
[19] T. Matiisen, A. Oliver, T. Cohen, and J. Schulman. Teacher-student curriculum learning. IEEE Transactions on Neural Networks and Learning Systems, PP, 07 2017.
|
| 195 |
+
[20] B. Mehta, M. Diaz, F. Golemo, C. J. Pal, and L. Paull. Active domain randomization. In L. P. Kaelbling, D. Kragic, and K. Sugiura, editors, 3rd Annual Conference on Robot Learning, CoRL 2019, Osaka, Japan, October 30 - November 1, 2019, Proceedings, volume 100 of Proceedings of Machine Learning Research, pages 1162–1176. PMLR, 2019.
|
| 196 |
+
[21] V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
|
| 197 |
+
[22] M. E. Mortenson. Mathematics for Computer Graphics Applications. Industrial Press Inc., 1999.
|
| 198 |
+
[23] S. Narvekar, B. Peng, M. Leonetti, J. Sinapov, M. E. Taylor, and P. Stone. Curriculum learning for reinforcement learning domains: A framework and survey. Journal of Machine Learning Research, 21:181:1–181:50, 2020.
|
| 199 |
+
[24] J. F. Nash et al. Equilibrium points in n-person games. Proceedings of the National Academy of Sciences, 36(1):48–49, 1950.
|
| 200 |
+
[25] OpenAI, I. Akkaya, M. Andrychowicz, M. Chociej, M. Litwin, B. McGrew, A. Petron, A. Paino, M. Plappert, G. Powell, R. Ribas, J. Schneider, N. Tezak, J. Tworek, P. Welinder, L. Weng, Q. Yuan, W. Zaremba, and L. Zhang. Solving rubik’s cube with a robot hand. CoRR, abs/1910.07113, 2019.
|
| 201 |
+
[26] O. OpenAI, M. Plappert, R. Sampedro, T. Xu, I. Akkaya, V. Kosaraju, P. Welinder, R. D’Sa, A. Petron, H. P. de Oliveira Pinto, A. Paino, H. Noh, L. Weng, Q. Yuan, C. Chu, and W. Zaremba. Asymmetric self-play for automatic goal discovery in robotic manipulation, 2021.
|
| 202 |
+
[27] E. Popovici, A. Bucci, R. P. Wiegand, and E. D. De Jong. Coevolutionary Principles, pages 987–1033. Springer Berlin Heidelberg, 2012.
|
| 203 |
+
[28] R. Portelas, C. Colas, L. Weng, K. Hofmann, and P.-Y. Oudeyer. Automatic curriculum learning for deep rl: A short survey. In C. Bessiere, editor, Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI-20, pages 4819–4825. International Joint Conferences on Artificial Intelligence Organization, 7 2020. Survey track.
|
| 204 |
+
[29] S. Racaniere, A. Lampinen, A. Santoro, D. Reichert, V. Firoiu, and T. Lillicrap. Automated curriculum generation through setter-solver interactions. In International Conference on Learning Representations, 2020.
|
| 205 |
+
[30] S. Risi and J. Togelius. Increasing generality in machine learning through procedural content generation. Nature Machine Intelligence, 2(8):428–436, 8 2020.
|
| 206 |
+
[31] L. J. Savage. The theory of statistical decision. Journal of the American Statistical association, 46(253):55–67, 1951.
|
| 207 |
+
[32] J. Schmidhuber. Powerplay: Training an increasingly general problem solver by continually searching for the simplest still unsolvable problem. Frontiers in Psychology, 4:313, 06 2013.
|
| 208 |
+
[33] J. Schulman, P. Moritz, S. Levine, M. I. Jordan, and P. Abbeel. High-dimensional continuous control using generalized advantage estimation. In Y. Bengio and Y. LeCun, editors, 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016.
|
| 209 |
+
[34] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017.
|
| 210 |
+
[35] D. Silver, A. Huang, C. J. Maddison, A. Guez, L. Sifre, G. Van Den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
|
| 211 |
+
[36] D. Silver, T. Hubert, J. Schrittwieser, I. Antonoglou, M. Lai, A. Guez, M. Lanctot, L. Sifre, D. Kumaran, T. Graepel, et al. A general reinforcement learning algorithm that masters chess, shogi, and go through self-play. Science, 362(6419):1140–1144, 2018.
|
| 212 |
+
[37] S. Sukhbaatar, Z. Lin, I. Kostrikov, G. Synnaeve, A. Szlam, and R. Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net, 2018.
|
| 213 |
+
[38] Y. Tang, D. Nguyen, and D. Ha. Neuroevolution of self-interpretable agents. In Proceedings of the Genetic and Evolutionary Computation Conference, 2020.
|
| 214 |
+
[39] J. Tobin, R. Fong, A. Ray, J. Schneider, W. Zaremba, and P. Abbeel. Domain randomization for transferring deep neural networks from simulation to the real world. In 2017 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 23–30, 2017.
|
| 215 |
+
[40] O. Vinyals, I. Babuschkin, W. M. Czarnecki, M. Mathieu, A. Dudzik, J. Chung, D. H. Choi, R. Powell, T. Ewalds, P. Georgiev, et al. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
|
| 216 |
+
[41] R. Wang, J. Lehman, J. Clune, and K. O. Stanley. Paired open-ended trailblazer (POET): endlessly generating increasingly complex and diverse learning environments and their solutions. CoRR, abs/1901.01753, 2019.
|
| 217 |
+
[42] R. Wang, J. Lehman, A. Rawal, J. Zhi, Y. Li, J. Clune, and K. Stanley. Enhanced POET: Open-ended reinforcement learning through unbounded invention of learning challenges and their solutions. In Proceedings of the 37th International Conference on Machine Learning, pages 9940–9951, 2020.
|
| 218 |
+
[43] B. L. Welch. The generalization of ‘student’s’ problem when several different population variances are involved. Biometrika, 34(1-2):28–35, 1947.
|
| 219 |
+
[44] A. Zhang, N. Ballas, and J. Pineau. A dissection of overfitting and generalization in continuous reinforcement learning. arXiv preprint arXiv:1806.07937, 2018.
|
| 220 |
+
[45] Y. Zhang, P. Abbeel, and L. Pinto. Automatic curriculum learning through value disagreement. In Advances in Neural Information Processing Systems, volume 33, pages 7648–7659, 2020.
|
| 221 |
+
|
| 222 |
+
# Checklist
|
| 223 |
+
|
| 224 |
+
1. For all authors...
|
| 225 |
+
|
| 226 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 227 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 8.
|
| 228 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 229 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 230 |
+
|
| 231 |
+
2. If you are including theoretical results...
|
| 232 |
+
|
| 233 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
|
| 234 |
+
|
| 235 |
+
3. If you ran experiments...
|
| 236 |
+
|
| 237 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
|
| 238 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix D.1 and D.2.
|
| 239 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 240 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix D.1 and D.2.
|
| 241 |
+
|
| 242 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 243 |
+
|
| 244 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 245 |
+
(b) Did you mention the license of the assets? [Yes] The MIT License.
|
| 246 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
|
| 247 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 248 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 249 |
+
|
| 250 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 251 |
+
|
| 252 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 253 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 254 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/AHOs7Sm5H7R/AHOs7Sm5H7R.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/B1ElR4cgg/B1ElR4cgg.md
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ADVERSARIALLY LEARNED INFERENCE
|
| 2 |
+
|
| 3 |
+
Vincent Dumoulin1, Ishmael Belghazi1, Ben Poole2 Olivier Mastropietro1, Alex Lamb1, Martin Arjovsky3 Aaron Courville1†
|
| 4 |
+
|
| 5 |
+
1 MILA, Université de Montréal, firstname.lastname@umontreal.ca.
|
| 6 |
+
2 Neural Dynamics and Computation Lab, Stanford, poole@cs.stanford.edu.
|
| 7 |
+
3 New York University, martinarjovsky@gmail.com.
|
| 8 |
+
†CIFAR Fellow.
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
We introduce the adversarially learned inference (ALI) model, which jointly learns a generation network and an inference network using an adversarial process. The generation network maps samples from stochastic latent variables to the data space while the inference network maps training examples in data space to the space of latent variables. An adversarial game is cast between these two networks and a discriminative network is trained to distinguish between joint latent/data-space samples from the generative network and joint samples from the inference network. We illustrate the ability of the model to learn mutually coherent inference and generation networks through the inspections of model samples and reconstructions and confirm the usefulness of the learned representations by obtaining a performance competitive with state-of-the-art on the semi-supervised SVHN and CIFAR10 tasks.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Deep directed generative model has emerged as a powerful framework for modeling complex highdimensional datasets. These models permit fast ancestral sampling, but are often challenging to learn due to the complexities of inference. Recently, three classes of algorithms have emerged as effective for learning deep directed generative models: 1) techniques based on the Variational Autoencoder (VAE) that aim to improve the quality and efficiency of inference by learning an inference machine (Kingma & Welling, 2013; Rezende et al., 2014), 2) techniques based on Generative Adversarial Networks (GANs) that bypass inference altogether (Goodfellow et al., 2014) and 3) autoregressive approaches (van den Oord et al., 2016b;c;a) that forego latent representations and instead model the relationship between input variables directly. While all techniques are provably consistent given infinite capacity and data, in practice they learn very different kinds of generative models on typical datasets.
|
| 17 |
+
|
| 18 |
+
VAE-based techniques learn an approximate inference mechanism that allows reuse for various auxiliary tasks, such as semi-supervised learning or inpainting. They do however suffer from a wellrecognized issue of the maximum likelihood training paradigm when combined with a conditional independence assumption on the output given the latent variables: they tend to distribute probability mass diffusely over the data space (Theis et al., 2015). The direct consequence of this is that image samples from VAE-trained models tend to be blurry (Goodfellow et al., 2014; Larsen et al., 2015). Autoregressive models produce outstanding samples but do so at the cost of slow sampling speed and foregoing the learning of an abstract representation of the data. GAN-based approaches represent a good compromise: they learn a generative model that produces higher-quality samples than the best VAE techniques (Radford et al., 2015; Larsen et al., 2015) without sacrificing sampling speed and also make use of a latent representation in the generation process. However, GANs lack an efficient inference mechanism, which prevents them from reasoning about data at an abstract level. For instance, GANs don’t allow the sort of neural photo manipulations showcased in (Brock et al., 2016). Recently, efforts have aimed to bridge the gap between VAEs and GANs, to learn generative models with higher-quality samples while learning an efficient inference network (Larsen et al.,
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: The adversarially learned inference (ALI) game.
|
| 22 |
+
|
| 23 |
+
2015; Lamb et al., 2016; Dosovitskiy & Brox, 2016). While this is certainly a promising research direction, VAE-GAN hybrids tend to manifest a compromise of the strengths and weaknesses of both approaches.
|
| 24 |
+
|
| 25 |
+
In this paper, we propose a novel approach to integrate efficient inference within the GAN framework. Our approach, called Adversarially Learned Inference (ALI), casts the learning of both an inference machine (or encoder) and a deep directed generative model (or decoder) in an GAN-like adversarial framework. A discriminator is trained to discriminate joint samples of the data and the corresponding latent variable from the encoder (or approximate posterior) from joint samples from the decoder while in opposition, the encoder and the decoder are trained together to fool the discriminator. Not only are we asking the discriminator to distinguish synthetic samples from real data, but we are requiring it to distinguish between two joint distributions over the data space and the latent variables.
|
| 26 |
+
|
| 27 |
+
With experiments on the Street View House Numbers (SVHN) dataset (Netzer et al., 2011), the CIFAR-10 object recognition dataset (Krizhevsky & Hinton, 2009), the CelebA face dataset (Liu et al., 2015) and a downsampled version of the ImageNet dataset (Russakovsky et al., 2015), we show qualitatively that we maintain the high sample fidelity associated with the GAN framework, while gaining the ability to perform efficient inference. We show that the learned representation is useful for auxiliary tasks by achieving results competitive with the state-of-the-art on the semi-supervised SVHN and CIFAR10 tasks.
|
| 28 |
+
|
| 29 |
+
# 2 ADVERSARIALLY LEARNED INFERENCE
|
| 30 |
+
|
| 31 |
+
Consider the two following probability distributions over $_ { \textbf { \em x } }$ and $_ z$ :
|
| 32 |
+
|
| 33 |
+
• the encoder joint distribution $q ( \pmb { x } , z ) = q ( \pmb { x } ) q ( \pmb { z } \mid \pmb { x } )$ , • the decoder joint distribution $p ( \pmb { x } , z ) = p ( z ) p ( \pmb { x } \mid z )$ .
|
| 34 |
+
|
| 35 |
+
These two distributions have marginals that are known to us: the encoder marginal $q ( { \pmb x } )$ is the empirical data distribution and the decoder marginal $p ( z )$ is usually defined to be a simple, factorized distribution, such as the standard Normal distribution $p ( z ) = \mathcal { N } ( 0 , I )$ . As such, the generative process between $q ( { \pmb x } , z )$ and $p ( { \pmb x } , z )$ is reversed.
|
| 36 |
+
|
| 37 |
+
ALI’s objective is to match the two joint distributions. If this is achieved, then we are ensured that all marginals match and all conditional distributions also match. In particular, we are assured that the conditional $q ( \pmb { z } \mid \pmb { x } )$ matches the posterior $p ( \pmb { z } \mid \pmb { x } )$ .
|
| 38 |
+
|
| 39 |
+
In order to match the joint distributions, an adversarial game is played. Joint pairs $( { \pmb x } , z )$ are drawn either from $q ( { \pmb x } , z )$ or $p ( { \pmb x } , z )$ , and a discriminator network learns to discriminate between the two, while the encoder and decoder networks are trained to fool the discriminator.
|
| 40 |
+
|
| 41 |
+
The value function describing the game is given by:
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
\begin{array} { l } { \displaystyle \underset { G } { \mathrm { m i n } } \displaystyle \operatorname* { m a x } V ( D , G ) = \mathbb { E } _ { q ( x ) } [ \log ( D ( \pmb { x } , G _ { z } ( \pmb { x } ) ) ) ] + \mathbb { E } _ { p ( z ) } [ \log ( 1 - D ( G _ { x } ( z ) , z ) ) ] } \\ { \displaystyle \qquad = \iint q ( \pmb { x } ) q ( z \mid \pmb { x } ) \log ( D ( \pmb { x } , z ) ) d \pmb { x } d z } \\ { \displaystyle \qquad + \iint p ( z ) p ( \pmb { x } \mid z ) \log ( 1 - D ( \pmb { x } , z ) ) d \pmb { x } d z . } \end{array}
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
# Algorithm 1 The ALI training procedure.
|
| 48 |
+
|
| 49 |
+
<table><tr><td colspan="2">0g,0d ← initialize network parameters</td><td rowspan="2"></td></tr><tr><td>repeat x(1)</td><td>..,x(M) ~q(x)</td></tr><tr><td>z(1),...,z(M) ~ p(z)</td><td></td><td rowspan="2">>Draw M samples from the dataset and the prior</td></tr><tr><td></td><td>(i)~q(z丨x=x()), i=1,...,M</td></tr><tr><td></td><td>x()~p(x|z= z()), j=1,...,M</td><td rowspan="2">> Sample from the conditionals</td></tr><tr><td>(i)</td><td>)←D(x(i),(𝑖)),i=1,...,M</td></tr><tr><td>pq j)</td><td>)←D(x(),z()),j=1,...,M</td><td rowspan="2"> Compute discriminator predictions</td></tr><tr><td>pp</td><td></td></tr><tr><td></td><td></td><td rowspan="2">Compute discriminator loss Compute generator loss</td></tr><tr><td colspan="2">10g(1-)-∑1g) Od←0d-V0Ld</td></tr></table>
|
| 50 |
+
|
| 51 |
+
An attractive property of adversarial approaches is that they do not require that the conditional densities can be computed; they only require that they can be sampled from in a way that allows gradient backpropagation. In the case of ALI, this means that gradients should propagate from the discriminator network to the encoder and decoder networks.
|
| 52 |
+
|
| 53 |
+
This can be done using the the reparametrization trick (Kingma, 2013; Bengio et al., 2013b;a). Instead of sampling directly from the desired distribution, the random variable is computed as a deterministic transformation of some noise such that its distribution is the desired distribution. For instance, if $q ( z \mid x ) = \mathcal { N } ( \mu ( x ) , \sigma ^ { 2 } ( x ) I )$ , one can draw samples by computing
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
z = \mu ( x ) + \sigma ( x ) \odot \epsilon , \quad \epsilon \sim \mathcal { N } ( 0 , I ) .
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
More generally, one can employ a change of variable of the form
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
v = f ( u , \epsilon )
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where $\epsilon$ is some random source of noise.
|
| 66 |
+
|
| 67 |
+
The discriminator is trained to distinguish between samples from the encoder $( { \pmb x } , \hat { z } ) \sim q ( { \pmb x } , z )$ and samples from the decoder $( { \tilde { \mathbf { x } } } , z ) \sim p { \bar { ( } } { \mathbf { \mathit { x } } } , z )$ . The generator is trained to fool the discriminator, i.e., to generate $x , z$ pairs from $q ( { \pmb x } , z )$ or $p ( { \pmb x } , z )$ that are indistinguishable one from another. See Figure 1 for a diagram of the adversarial game and Algorithm 1 for an algorithmic description of the procedure.
|
| 68 |
+
|
| 69 |
+
In such a setting, and under the assumption of an optimal discriminator, the generator minimizes the Jensen-Shannon divergence (Lin, 1991) between $q ( { \pmb x } , z )$ and $p ( { \pmb x } , z )$ . This can be shown using the same proof sketch as in the original GAN paper (Goodfellow et al., 2014).
|
| 70 |
+
|
| 71 |
+
# 2.1 RELATION TO GAN
|
| 72 |
+
|
| 73 |
+
ALI bears close resemblance to GAN, but it differs from it in the two following ways:
|
| 74 |
+
|
| 75 |
+
• The generator has two components: the encoder, $G _ { z } ( \pmb { x } )$ , which maps data samples $_ { \textbf { \em x } }$ to $_ { z }$ -space, and the decoder $G _ { x } ( z )$ , which maps samples from the prior $p ( z )$ (a source of noise) to the input space. • The discriminator is trained to distinguish between joint pairs $( { \pmb x } , \hat { { \pmb z } } = G _ { x } ( { \pmb x } ) )$ and $( { \tilde { \pmb x } } =$ $G _ { x } ( z ) , z )$ , as opposed to marginal samples $\mathbf { \boldsymbol { x } } \sim \mathbf { \boldsymbol { q } } ( \mathbf { \boldsymbol { x } } )$ and $\tilde { \boldsymbol { x } } \sim p ( \boldsymbol { x } )$ .
|
| 76 |
+
|
| 77 |
+
# 2.2 ALTERNATIVE APPROACHES TO FEEDFORWARD INFERENCE IN GANS
|
| 78 |
+
|
| 79 |
+
The ALI training procedure is not the only way one could learn a feedforward inference network in a GAN setting.
|
| 80 |
+
|
| 81 |
+
In recent work, Chen et al. (2016) introduce a model called InfoGAN which minimizes the mutual information between a subset $^ c$ of the latent code and $_ { \textbf { \em x } }$ through the use of an auxiliary distribution
|
| 82 |
+
|
| 83 |
+
$Q ( \pmb { c } \mid \pmb { x } )$ . However, this does not correspond to full inference on $_ z$ , as only the value for $^ c$ is inferred. Additionally, InfoGAN requires that $Q ( \mathbf { c } \mid \mathbf { x } )$ is a tractable approximate posterior that can be sampled from and evaluated. ALI only requires that inference networks can be sampled from, allowing it to represent arbitrarily complex posterior distributions.
|
| 84 |
+
|
| 85 |
+
One could learn the inverse mapping from GAN samples: this corresponds to learning an encoder to reconstruct $_ z$ , i.e. finding an encoder such that $\begin{array} { r } { \mathbb { E } _ { z \sim p ( z ) } [ \| z - G _ { z } ( G _ { x } ( z ) ) \| _ { 2 } ^ { 2 } ] \approx 0 } \end{array}$ . We are not aware of any work that reports results for this approach. This resembles the InfoGAN learning procedure but with a fixed generative model and a factorial Gaussian posterior with a fixed diagonal variance.
|
| 86 |
+
|
| 87 |
+
Alternatively, one could decompose training into two phases. In the first phase, a GAN is trained normally. In the second phase, the GAN’s decoder is frozen and an encoder is trained following the ALI procedure (i.e., a discriminator taking both $_ { \textbf { \em x } }$ and $_ { z }$ as input is introduced). We call this post-hoc learned inference. In this setting, the encoder and the decoder cannot interact together during training and the encoder must work with whatever the decoder has learned during GAN training. Post-hoc learned inference may be suboptimal if this interaction is beneficial to modeling the data distribution.
|
| 88 |
+
|
| 89 |
+
# 2.3 GENERATOR VALUE FUNCTION
|
| 90 |
+
|
| 91 |
+
As with GANs, when ALI’s discriminator gets too far ahead, its generator may have a hard time minimizing the value function in Equation 1. If the discriminator’s output is sigmoidal, then the gradient of the value function with respect to the discriminator’s output vanishes to zero as the output saturates.
|
| 92 |
+
|
| 93 |
+
As a workaround, the generator is trained to maximize
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
V ^ { \prime } ( D , G ) = \mathbb { E } _ { q ( \pmb { x } ) } [ \mathrm { l o g } ( 1 - D ( \pmb { x } , G _ { z } ( \pmb { x } ) ) ) ] + \mathbb { E } _ { p ( z ) } [ \mathrm { l o g } ( D ( G _ { \pmb { x } } ( z ) , z ) ) ]
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
which has the same fixed points but whose gradient is stronger when the discriminator’s output saturates.
|
| 100 |
+
|
| 101 |
+
The adversarial game does not require an analytical expression for the joint distributions. This means we can introduce variable changes without having to know the explicit distribution over the new variable. For instance, sampling from $p ( z )$ could be done by sampling $\epsilon \sim \mathcal { N } ( 0 , I )$ and passing it through an arbitrary differentiable function $z = f ( \epsilon )$ .
|
| 102 |
+
|
| 103 |
+
However, gradient propagation into the encoder and decoder networks relies on the reparametrization trick, which means that ALI is not directly applicable to either applications with discrete data or to models with discrete latent variables.
|
| 104 |
+
|
| 105 |
+
# 2.4 DISCRIMINATOR OPTIMALITY
|
| 106 |
+
|
| 107 |
+
Proposition 1. Given a fixed generator $G$ , the optimal discriminator is given by
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
D ^ { * } ( x , z ) = \frac { q ( x , z ) } { q ( x , z ) + p ( x , z ) } .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
Proof. For a fixed generator $G$ , the complete data value function is
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
V ( D , G ) = \mathbb { E } _ { x , z \sim q ( x , z ) } [ \log ( D ( x , z ) ) ] + \mathbb { E } _ { x , z \sim p ( x , z ) } [ \log ( 1 - D ( x , z ) ) ] .
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
The result follows by the concavity of the log and the simplified Euler-Lagrange equation first order conditions on $( x , z ) \to D ( x , z )$ . □
|
| 120 |
+
|
| 121 |
+
# 2.5 RELATIONSHIP WITH THE JENSEN-SHANNON DIVERGENCE
|
| 122 |
+
|
| 123 |
+
Proposition 2. Under an optimal discriminator $D ^ { * }$ , the generator minimizes the Jensen-Shanon divergence which attains its minimum if and only if $q ( \pmb { x } , z ) = p ( \pmb { x } , z )$ .
|
| 124 |
+
|
| 125 |
+
Proof. The proof is a straightforward extension of the proof in Goodfellow et al. (2014).
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 2: Samples and reconstructions on the SVHN dataset. For the reconstructions, odd columns are original samples from the validation set and even columns are corresponding reconstructions (e.g., second column contains reconstructions of the first column’s validation set samples).
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 3: Samples and reconstructions on the CelebA dataset. For the reconstructions, odd columns are original samples from the validation set and even columns are corresponding reconstructions.
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 4: Samples and reconstructions on the CIFAR10 dataset. For the reconstructions, odd columns are original samples from the validation set and even columns are corresponding reconstructions.
|
| 135 |
+
|
| 136 |
+
# 2.6 INVERTIBILITY
|
| 137 |
+
|
| 138 |
+
Proposition 3. Assuming optimal discriminator $D$ and generator $G$ . If the encoder $G _ { x }$ is deterministic, then $G _ { x } = G _ { z } ^ { - 1 }$ and $\bar { G } _ { z } = G _ { x } ^ { - 1 }$ almost everywhere.
|
| 139 |
+
|
| 140 |
+
Sketch of proof. Consider the event $R _ { \epsilon } = \{ { \pmb x } : \| { \pmb x } - ( G _ { \pmb x } \circ G _ { z } ) ( { \pmb x } ) ) \| > \epsilon \}$ for some positive $\epsilon$ This set can be seen as a section of the $( { \pmb x } , z )$ space over the elements $_ z$ such that $z = G _ { z } ( x )$ . The generator being optimal, the probabilities of $R _ { \epsilon }$ under $p ( { \pmb x } , z )$ and $q ( { \pmb x } , z )$ are equal. Now $p ( \pmb { x } \mid \tilde { \mathbf { \alpha } } ) = \delta _ { x - G _ { x } ( z ) }$ , where $\delta$ is the Dirac delta distribution. This is enough to show that there are no $x$ satisfying the event $R _ { \epsilon }$ and thus $G _ { x } = G _ { z } ^ { - 1 }$ almost everywhere. By symmetry, the same argument can be applied to show that $G _ { z } = G _ { x } ^ { - 1 }$ .
|
| 141 |
+
|
| 142 |
+
The complete proof is given in (Donahue et al., 2016), in which the authors independently examine the same model structure under the name Bidirectional GAN (BiGAN). □
|
| 143 |
+
|
| 144 |
+
# 3 RELATED WORK
|
| 145 |
+
|
| 146 |
+
Other recent papers explore hybrid approaches to generative modeling. One such approach is to relax the probabilistic interpretation of the VAE model by replacing either the KL-divergence term or the reconstruction term with variants that have better properties. The adversarial autoencoder model (Makhzani et al., 2015) replaces the KL-divergence term with a discriminator that is trained to distinguish between approximate posterior and prior samples, which provides a more flexible approach to matching the marginal $q ( z )$ and the prior. Other papers explore replacing the reconstruction term with either GANs or auxiliary networks. Larsen et al. (2015) collapse the decoder of a VAE and the generator of a GAN into one network in order to supplement the reconstruction loss with a learned similarity metric. Lamb et al. (2016) use the hidden layers of a pre-trained classifier as auxiliary reconstruction losses to help the VAE focus on higher-level details when reconstructing. Dosovitskiy & Brox (2016) combine both ideas into a unified loss function.
|
| 147 |
+
|
| 148 |
+
ALI’s approach is also reminiscent of the adversarial autoencoder model, which employs a GAN to distinguish between samples from the approximate posterior distribution $q ( \boldsymbol { z } \mid \boldsymbol { x } )$ and prior samples. However, unlike adversarial autoencoders, no explicit reconstruction loss is being optimized in ALI, and the discriminator receives joint pairs of samples $( { \pmb x } , z )$ rather than marginal $_ { z }$ samples.
|
| 149 |
+
|
| 150 |
+
Independent work by Donahue et al. (2016) proposes the same model under the name Bidirectional GAN (BiGAN), in which the authors emphasize the learned features’ usefulness for auxiliary supervised and semi-supervised tasks. The main difference in terms of experimental setting is that they use a deterministic $q ( \pmb { z } \mid \pmb { x } )$ network, whereas we use a stochastic network. In our experience, this does not make a big difference when $_ { \textbf { \em x } }$ is a deterministic function of $_ z$ as the stochastic inference networks tend to become determinstic as training progresses. When using stochastic mappings from $_ z$ to $_ { \textbf { \em x } }$ , the additional flexiblity of stochastic posteriors is critical.
|
| 151 |
+
|
| 152 |
+
# 4 EXPERIMENTAL RESULTS
|
| 153 |
+
|
| 154 |
+
We applied ALI to four different datasets, namely CIFAR10 (Krizhevsky & Hinton, 2009), SVHN (Netzer et al., 2011), CelebA (Liu et al., 2015) and a center-cropped, $6 4 \times 6 4$ version of the ImageNet dataset (Russakovsky et al., 2015).1
|
| 155 |
+
|
| 156 |
+
Transposed convolutions are used in $G _ { x } ( z )$ . This operation corresponds to the transpose of the matrix representation of a convolution, i.e., the gradient of the convolution with respect to its inputs. For more details about transposed convolutions and related operations, see Dumoulin & Visin (2016); Shi et al. (2016); Odena et al. (2016).
|
| 157 |
+
|
| 158 |
+
# 4.1 SAMPLES AND RECONSTRUCTIONS
|
| 159 |
+
|
| 160 |
+
For each dataset, samples are presented (Figures 2a, 3a 4a and 5a). They exhibit the same image fidelity as samples from other adversarially-trained models.
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 5: Samples and reconstructions on the Tiny ImageNet dataset. For the reconstructions, odd columns are original samples from the validation set and even columns are corresponding reconstructions.
|
| 164 |
+
|
| 165 |
+
We also qualitatively evaluate the fit between the conditional distribution $q ( \boldsymbol { z } \mid \boldsymbol { x } )$ and the posterior distribution $p ( \boldsymbol { z } \mid \boldsymbol { x } )$ by sampling ${ \hat { z } } \sim q ( z \mid x )$ and $\hat { \pmb x } \sim p ( \pmb x \mid z = \hat { z } )$ (Figures 2b, 3b, 4b and 5b). This corresponds to reconstructing the input in a VAE setting. Note that the ALI training objective does not involve an explicit reconstruction loss.
|
| 166 |
+
|
| 167 |
+
We observe that reconstructions are not always faithful reproductions of the inputs. They retain the same crispness and quality characteristic to adversarially-trained models, but oftentimes make mistakes in capturing exact object placement, color, style and (in extreme cases) object identity. The extent to which reconstructions deviate from the inputs varies between datasets: on CIFAR10, which arguably constitutes a more complex input distribution, the model exhibits less faithful reconstructions. This leads us to believe that poor reconstructions are a sign of underfitting.
|
| 168 |
+
|
| 169 |
+
This failure mode represents an interesting departure from the bluriness characteristic to the typical VAE setup. We conjecture that in the underfitting regime, the latent variable representation learned by ALI is potentially more invariant to less interesting factors of variation in the input and do not devote model capacity to capturing these factors.
|
| 170 |
+
|
| 171 |
+
# 4.2 LATENT SPACE INTERPOLATIONS
|
| 172 |
+
|
| 173 |
+
As a sanity check for overfitting, we look at latent space interpolations between validation set examples (Figure 6). We sample pairs of validation set examples $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ and project them into $\mathbf { z } _ { 1 }$ and $\mathbf { z } _ { 2 }$ by sampling from the encoder. We then linearly interpolate between $\mathbf { z } _ { 1 }$ and $\mathbf { z } _ { 2 }$ and pass the intermediary points through the decoder to plot the input-space interpolations.
|
| 174 |
+
|
| 175 |
+
We observe smooth transitions between pairs of examples, and intermediary images remain believable. This is an indicator that ALI is not concentrating its probability mass exclusively around training examples, but rather has learned latent features that generalize well.
|
| 176 |
+
|
| 177 |
+
# 4.3 SEMI-SUPERVISED LEARNING
|
| 178 |
+
|
| 179 |
+
We investigate the usefulness of the latent representation learned by ALI through semi-supervised benchmarks on SVHN and CIFAR10.
|
| 180 |
+
|
| 181 |
+
We first compare with GAN on SVHN by following the procedure outlined in Radford et al. (2015). We train an L2-SVM on the learned representations of a model trained on SVHN. The last three hidden layers of the encoder as well as its output are concatenated to form a 8960-dimensional feature vector. A 10,000 example held-out validation set is taken from the training set and is used for model selection. The SVM is trained on 1000 examples taken at random from the remainder of the training set. The test error rate is measured for 100 different SVMs trained on different random 1000-example training sets, and the average error rate is measured along with its standard deviation.
|
| 182 |
+
|
| 183 |
+

|
| 184 |
+
Figure 6: Latent space interpolations on the CelebA validation set. Left and right columns correspond to the original pairs $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ , and the columns in between correspond to the decoding of latent representations interpolated linearly from $\mathbf { z } _ { 1 }$ to $\mathbf { z } _ { 2 }$ . Unlike other adversarial approaches like DCGAN (Radford et al., 2015), ALI allows one to interpolate between actual data points.
|
| 185 |
+
|
| 186 |
+
Using ALI’s inference network as opposed to the discriminator to extract features, we achieve a misclassification rate that is roughly $3 . 0 0 \pm 0 . 5 0 \%$ lower than reported in Radford et al. (2015) (Table 1), which suggests that ALI’s inference mechanism is beneficial to the semi-supervised learning task.
|
| 187 |
+
|
| 188 |
+
We then investigate ALI’s performance when label information is taken into account during training. We adapt the discriminative model proposed in Salimans et al. (2016). The discriminator takes $x$ and $z$ as input and outputs a distribution over $K + 1$ classes, where $K$ is the number of categories. When label information is available for $q ( x , z )$ samples, the discriminator is expected to predict the label. When no label information is available, the discriminator is expected to predict $K + 1$ for $p ( x , z )$ samples and $k \in \{ 1 , \ldots , K \}$ for $q ( x , z )$ samples.
|
| 189 |
+
|
| 190 |
+
Interestingly, Salimans et al. (2016) found that they required an alternative training strategy for the generator where it tries to match first-order statistics in the discriminator’s intermediate activations with respect to the data distribution (they refer to this as feature matching). We found that ALI did not require feature matching to obtain comparable results. We achieve results competitive with the state-of-the-art, as shown in Tables 1 and 2. Table 2 shows that ALI offers a modest improvement over Salimans et al. (2016), more specifically for 1000 and 2000 labeled examples.
|
| 191 |
+
|
| 192 |
+
Table 1: SVHN test set missclassification rate
|
| 193 |
+
|
| 194 |
+
<table><tr><td>Model</td><td>Misclassification rate</td></tr><tr><td>VAE (M1 + M2) (Kingma et al.,2014)</td><td>36.02</td></tr><tr><td>SWWAE with dropout (Zhao et al.,2015)</td><td>23.56</td></tr><tr><td>DCGAN + L2-SVM (Radford et al.,2015)</td><td>22.18</td></tr><tr><td>SDGM (Maalge et al., 2016)</td><td>16.61</td></tr><tr><td>GAN (feature matching) (Salimans et al., 2016)</td><td>8.11 ± 1.3</td></tr><tr><td>ALI(ours,L2-SVM)</td><td>19.14 ± 0.50</td></tr><tr><td>ALI (ours, no feature matching)</td><td>7.42 ± 0.65</td></tr></table>
|
| 195 |
+
|
| 196 |
+
Table 2: CIFAR10 test set missclassification rate for semi-supervised learning using different numbers of trained labeled examples. For ALI, error bars correspond to 3 times the standard deviation.
|
| 197 |
+
|
| 198 |
+
<table><tr><td>Number of labeled examples Model</td><td>1000</td><td>2000 Misclassification rate</td><td>4000</td><td>8000</td></tr><tr><td>Ladder network (Rasmus et al.,2015)</td><td></td><td>20.40</td><td></td><td></td></tr><tr><td>CatGAN (Springenberg,2015)</td><td></td><td></td><td>19.58</td><td></td></tr><tr><td>GAN (feature matching) (Salimans et al.,2016)</td><td>21.83± 2.01</td><td>19.61± 2.09</td><td>18.63 ±2.32</td><td>17.72 ± 1.82</td></tr><tr><td>ALI(ours,no feature matching)</td><td>19.98 ±0.89</td><td>19.09 ±0.44</td><td>17.99 ± 1.62</td><td>17.05 ± 1.49</td></tr></table>
|
| 199 |
+
|
| 200 |
+
We are still investigating the differences between ALI and GAN with respect to feature matching, but we conjecture that the latent representation learned by ALI is better untangled with respect to the classification task and that it generalizes better.
|
| 201 |
+
|
| 202 |
+
# 4.4 CONDITIONAL GENERATION
|
| 203 |
+
|
| 204 |
+
We extend ALI to match a conditional distribution. Let $\textbf { { y } }$ represent a fully observed conditioning variable. In this setting, the value function reads
|
| 205 |
+
|
| 206 |
+
$$
|
| 207 |
+
\underset { \bar { \mathbf { \Theta } } } { \mathrm { n i n } } \underset { m } { \mathrm { m a x } } V ( D , G ) = \mathbb { E } _ { q ( x ) p ( y ) } [ \log ( D ( \boldsymbol { x } , G _ { z } ( \boldsymbol { x } , y ) , y ) ) ] + \mathbb { E } _ { p ( z ) p ( y ) } [ \log ( 1 - D ( G _ { x } ( z , y ) , z , y ) ) ]
|
| 208 |
+
$$
|
| 209 |
+
|
| 210 |
+
We apply the conditional version of ALI to CelebA using the dataset’s 40 binary attributes. The attributes are linearly embedded in the encoder, decoder and discriminator. We observe how a single element of the latent space $z$ changes with respect to variations in the attributes vector $y$ . Conditional samples are shown in Figure 7.
|
| 211 |
+
|
| 212 |
+

|
| 213 |
+
Figure 7: Conditional generation sequence. We sample a single fixed latent code $z$ . Each row has a subset of attributes that are held constant across columns. The attributes are male, attractive, young for row I; male, attractive, older for row II; female, attractive, young for row III; female, attractive, older for Row IV. Attributes are then varied uniformly over rows across all columns in the following sequence: (b) black hair; (c) brown hair; (d) blond hair; (e) black hair, wavy hair; (f) blond hair, bangs; (g) blond hair, receding hairline; (h) blond hair, balding; (i) black hair, smiling; (j) black hair, smiling, mouth slightly open; (k) black hair, smiling, mouth slightly open, eyeglasses; (l) black hair, smiling, mouth slightly open, eyeglasses, wearing hat.
|
| 214 |
+
|
| 215 |
+
# 4.5 IMPORTANCE OF LEARNING INFERENCE JOINTLY WITH GENERATION
|
| 216 |
+
|
| 217 |
+
To highlight the role of the inference network during learning, we performed an experiment on a toy dataset for which $q ( { \pmb x } )$ is a 2D gaussian mixture with 25 mixture components laid out on a grid. The covariance matrices and centroids have been chosen such that the distribution exhibits lots of modes separated by large low-probability regions, which makes it a decently hard task despite the 2D nature of the dataset.
|
| 218 |
+
|
| 219 |
+
We trained ALI and GAN on $1 0 0 , 0 0 0 q ( { \pmb x } )$ samples. The decoder and discriminator architectures are identical between ALI and GAN (except for the input of the discriminator, which receives the concatenation of $\mathbf { x }$ and $\mathbf { z }$ in the ALI case). Each model was trained 10 times using Adam (Kingma & Ba, 2014) with random learning rate and $\beta _ { 1 }$ values, and the weights were initialized by drawing from a gaussian distribution with a random standard deviation.
|
| 220 |
+
|
| 221 |
+
We measured the extent to which the trained models covered all 25 modes by drawing 10,000 samples from their $p ( { \pmb x } )$ distribution and assigning each sample to a $q ( { \pmb x } )$ mixture component according to the mixture responsibilities. We defined a dropped mode as one that wasn’t assigned to any sample. Using this definition, we found that ALI models covered $1 3 . 4 \pm 5 . 8$ modes on average (min: 8, max: 25) while GAN models covered $1 0 . 4 \pm 9 . 2$ modes on average (min: 1, max: 22).
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
Figure 8: Comparison of (a) ALI, (b) GAN with an encoder learned to reconstruct latent samples (c) GAN with an encoder learned through ALI, (d) variational autoencoder (VAE) on a 2D toy dataset. The ALI model in (a) does a much better job of covering the latent space (second row) and producing good samples than the two GAN models (b, c) augmented with an inference mechanism.
|
| 225 |
+
|
| 226 |
+
We then selected the best-covering ALI and GAN models, and the GAN model was augmented with an encoder using the learned inverse mapping and post-hoc learned inference procedures outlined in subsection 2.2. The encoders learned for GAN inference have the same architecture as ALI’s encoder. We also trained a VAE with the same encoder-decoder architecture as ALI to outline the qualitative differences between ALI and VAE models.
|
| 227 |
+
|
| 228 |
+
We then compared each model’s inference capabilities by reconstructing 10,000 held-out samples from $q ( { \pmb x } )$ . Figure 8 summarizes the experiment. We observe the following:
|
| 229 |
+
|
| 230 |
+
• The ALI encoder models a marginal distribution $q ( z )$ that matches $p ( z )$ fairly well (row 2, column a). The learned representation does a decent job at clustering and organizing the different mixture components.
|
| 231 |
+
The GAN generator (row 5, columns b-c) has more trouble reaching all the modes than the ALI generator (row 5, column a), even over 10 runs of hyperparameter search.
|
| 232 |
+
Learning an inverse mapping from GAN samples does not work very well: the encoder has trouble covering the prior marginally and the way it clusters mixture components is not very well organized (row 2, column b). As discussed in subsection 2.2, reconstructions suffer from the generator dropping modes.
|
| 233 |
+
• Learning inference post-hoc doesn’t work as well as training the encoder and the decoder jointly. As had been hinted at in subsection 2.2, it appears that adversarial training benefits
|
| 234 |
+
|
| 235 |
+
from learning inference at training time in terms of mode coverage. This also negatively impacts how the latent space is organized (row 2, column c). However, it appears to be better at matching $q ( z )$ and $p ( z )$ than when inference is learned through inverse mapping from GAN samples.
|
| 236 |
+
|
| 237 |
+
• Due to the nature of the loss function being optimized, the VAE model covers all modes easily (row 5, column d) and excels at reconstructing data samples (row 3, column d). However, they have a much more pronounced tendency to smear out their probability density (row 5, column d) and leave “holes” in $\mathbf { q } ( \mathbf { z } )$ (row 2, column d). Note however that recent approaches such as Inverse Autoregressive Flow (Kingma et al., 2016) may be used to improve on this, at the cost of a more complex mathematical framework.
|
| 238 |
+
|
| 239 |
+
In summary, this experiment provides evidence that adversarial training benefits from learning an inference mechanism jointly with the decoder. Furthermore, it shows that our proposed approach for learning inference in an adversarial setting is superior to the other approaches investigated.
|
| 240 |
+
|
| 241 |
+
# 5 CONCLUSION
|
| 242 |
+
|
| 243 |
+
We introduced the adversarially learned inference (ALI) model, which jointly learns a generation network and an inference network using an adversarial process. The model learns mutually coherent inference and generation networks, as exhibited by its reconstructions. The induced latent variable mapping is shown to be useful, achieving results competitive with the state-of-the-art on the semisupervised SVHN and CIFAR10 tasks.
|
| 244 |
+
|
| 245 |
+
# ACKNOWLEDGMENTS
|
| 246 |
+
|
| 247 |
+
The authors would like to acknowledge the support of the following agencies for research funding and computing support: NSERC, Calcul Québec, Compute Canada. We would also like to thank the developers of Theano (Bergstra et al., 2010; Bastien et al., 2012; Theano Development Team, 2016), Blocks and Fuel (van Merriënboer et al., 2015), which were used extensively for the paper. Finally, we would like to thank Yoshua Bengio, David Warde-Farley, Yaroslav Ganin and Laurent Dinh for their valuable feedback.
|
| 248 |
+
|
| 249 |
+
# REFERENCES
|
| 250 |
+
|
| 251 |
+
Frédéric Bastien, Pascal Lamblin, Razvan Pascanu, James Bergstra, Ian Goodfellow, Arnaud Bergeron, Nicolas Bouchard, David Warde-Farley, and Yoshua Bengio. Theano: new features and speed improvements. arXiv preprint arXiv:1211.5590, 2012.
|
| 252 |
+
|
| 253 |
+
Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013a.
|
| 254 |
+
|
| 255 |
+
Yoshua Bengio, Eric Thibodeau-Laufer, Guillaume Alain, and Jason Yosinski. Deep generative stochastic networks trainable by backprop. arXiv preprint arXiv:1306.1091, 2013b.
|
| 256 |
+
|
| 257 |
+
James Bergstra, Olivier Breuleux, Frédéric Bastien, Pascal Lamblin, Razvan Pascanu, Guillaume Desjardins, Joseph Turian, David Warde-Farley, and Yoshua Bengio. Theano: a cpu and gpu math expression compiler. In Proceedings of the Python for scientific computing conference $( S c i P y )$ , volume 4, pp. 3. Austin, TX, 2010.
|
| 258 |
+
|
| 259 |
+
Andrew Brock, Theodore Lim, JM Ritchie, and Nick Weston. Neural photo editing with introspective adversarial networks. arXiv preprint arXiv:1609.07093, 2016.
|
| 260 |
+
|
| 261 |
+
Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2172–2180, 2016.
|
| 262 |
+
|
| 263 |
+
Jeff Donahue, Philipp Krähenbühl, and Trevor Darrell. Adversarial feature learning. arXiv preprint arXiv:1605.09782, 2016.
|
| 264 |
+
|
| 265 |
+
Alexey Dosovitskiy and Thomas Brox. Generating images with perceptual similarity metrics based on deep networks. arXiv preprint arXiv:1602.02644, 2016.
|
| 266 |
+
|
| 267 |
+
Vincent Dumoulin and Francesco Visin. A guide to convolution arithmetic for deep learning. arXiv preprint arXiv:1603.07285, 2016.
|
| 268 |
+
|
| 269 |
+
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
|
| 270 |
+
|
| 271 |
+
Ian J Goodfellow, David Warde-Farley, Mehdi Mirza, Aaron Courville, and Yoshua Bengio. Maxout networks. arXiv preprint arXiv:1302.4389, 2013.
|
| 272 |
+
|
| 273 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 274 |
+
|
| 275 |
+
Diederik P Kingma. Fast gradient-based inference with continuous latent variable models in auxiliary form. arXiv preprint arXiv:1306.0733, 2013.
|
| 276 |
+
|
| 277 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 278 |
+
|
| 279 |
+
Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems, pp. 3581–3589, 2014.
|
| 280 |
+
|
| 281 |
+
Diederik P Kingma, Tim Salimans, and Max Welling. Improving variational inference with inverse autoregressive flow. arXiv preprint arXiv:1606.04934, 2016.
|
| 282 |
+
|
| 283 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images, 2009.
|
| 284 |
+
|
| 285 |
+
Alex Lamb, Vincent Dumoulin, and Aaron Courville. Discriminative regularization for generative models. arXiv preprint arXiv:1602.03220, 2016.
|
| 286 |
+
|
| 287 |
+
Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv preprint arXiv:1512.09300, 2015.
|
| 288 |
+
|
| 289 |
+
Jianhua Lin. Divergence measures based on the shannon entropy. Information Theory, IEEE Transactions on, 37(1):145–151, 1991.
|
| 290 |
+
|
| 291 |
+
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
|
| 292 |
+
|
| 293 |
+
Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
|
| 294 |
+
|
| 295 |
+
Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, and Ian Goodfellow. Adversarial autoencoders. arXiv preprint arXiv:1511.05644, 2015.
|
| 296 |
+
|
| 297 |
+
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, volume 2011, pp. 4. Granada, Spain, 2011.
|
| 298 |
+
|
| 299 |
+
Augustus Odena, Vincent Dumoulin, and Chris Olah. Deconvolution and checkerboard artifacts. http://distill.pub/2016/deconv-checkerboard/, 2016.
|
| 300 |
+
|
| 301 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
|
| 302 |
+
|
| 303 |
+
Antti Rasmus, Harri Valpola, Mikko Honkala, Mathias Berglund, and Tapani Raiko. Semi-supervised learning with ladder network. In Advances in Neural Information Processing Systems, 2015, 2015.
|
| 304 |
+
|
| 305 |
+
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
|
| 306 |
+
|
| 307 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
|
| 308 |
+
|
| 309 |
+
Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. arXiv preprint arXiv:1606.03498, 2016.
|
| 310 |
+
|
| 311 |
+
Wenzhe Shi, Jose Caballero, Lucas Theis, Ferenc Huszar, Andrew Aitken, Christian Ledig, and Zehan Wang. Is the deconvolution layer the same as a convolutional layer? arXiv preprint arXiv:1609.07009, 2016.
|
| 312 |
+
|
| 313 |
+
Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv preprint arXiv:1511.06390, 2015.
|
| 314 |
+
|
| 315 |
+
Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. arXiv preprint arXiv:1605.02688, 2016.
|
| 316 |
+
|
| 317 |
+
Lucas Theis, Aron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. arXiv preprint arXiv:1511.01844, 2015.
|
| 318 |
+
|
| 319 |
+
Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew W. Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016a.
|
| 320 |
+
|
| 321 |
+
Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016b.
|
| 322 |
+
|
| 323 |
+
Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, and Koray Kavukcuoglu. Conditional image generation with pixelcnn decoders. arXiv preprint arXiv:1606.05328, 2016c.
|
| 324 |
+
|
| 325 |
+
Bart van Merriënboer, Dzmitry Bahdanau, Vincent Dumoulin, Dmitriy Serdyuk, David Warde-Farley, Jan Chorowski, and Yoshua Bengio. Blocks and fuel: Frameworks for deep learning. arXiv preprint arXiv:1506.00619, 2015.
|
| 326 |
+
|
| 327 |
+
Junbo Zhao, Michael Mathieu, Ross Goroshin, and Yann Lecun. Stacked what-where auto-encoders. arXiv preprint arXiv:1506.02351, 2015.
|
| 328 |
+
|
| 329 |
+
A HYPERPARAMETERS
|
| 330 |
+
Table 3: CIFAR10 model hyperparameters (unsupervised). Maxout layers (Goodfellow et al., 2013) are used in the discriminator.
|
| 331 |
+
|
| 332 |
+
<table><tr><td>Operation</td><td>Kernel</td><td>Strides</td><td> Feature maps</td><td>BN?</td><td>Dropout</td><td>Nonlinearity</td></tr><tr><td>Gz(x)-3 × 32 × 32 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>5×5</td><td>1×1</td><td>32</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>512</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>128</td><td>×</td><td>0.0</td><td>Linear</td></tr><tr><td>Gx(z)-64 ×1 × 1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>1×1</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>2×2</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>1×1</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>2×2</td><td>32</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>5×5</td><td>1×1</td><td>32</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>32</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>3</td><td>×</td><td>0.0</td><td>Sigmoid</td></tr><tr><td>D(x)-3 × 32 × 32 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>5×5</td><td>1×1</td><td>32</td><td>×</td><td>0.2</td><td>Maxout</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>64</td><td>×</td><td>0.5</td><td>Maxout</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>128</td><td>×</td><td>0.5</td><td>Maxout</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>256</td><td>×</td><td>0.5</td><td>Maxout</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>512</td><td>×</td><td>0.5</td><td>Maxout</td></tr><tr><td>D(z)-64 ×1 ×1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>×</td><td>0.2</td><td>Maxout</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>×</td><td>0.5</td><td>Maxout</td></tr><tr><td>D(x,z) - 1024 × 1 × 1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td> Concatenate D(x) and D(z) along the channel axis</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>1024</td><td>×</td><td>0.5</td><td>Maxout</td></tr><tr><td>Convolution Convolution</td><td>1×1</td><td>1×1</td><td>1024</td><td>×</td><td>0.5</td><td>Maxout</td></tr><tr><td></td><td>1×1</td><td>1×1</td><td>1</td><td>×</td><td>0.5</td><td>Sigmoid</td></tr><tr><td></td><td>Optimizer Adam(α = 10-4, β1 = 0.5,β2 = 10-3)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Batch size 100</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Epochs 6475</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Leaky ReLU slope, maxout pieces 0.1, 2</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Weight, bias initialization Isotropic gaussian (μ = 0,o = 0.O1),Constant(O)</td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 333 |
+
|
| 334 |
+
Table 4: SVHN model hyperparameters (unsupervised).
|
| 335 |
+
|
| 336 |
+
<table><tr><td>Operation</td><td>Kernel</td><td>Strides</td><td> Feature maps</td><td>BN?</td><td>Dropout</td><td>Nonlinearity</td></tr><tr><td>Gz(x)-3 × 32 × 32 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>5×5</td><td>1×1</td><td>32</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>512</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>×</td><td>0.0</td><td>Linear</td></tr><tr><td>Gx(z)-256 ×1 ×1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>1×1</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>2×2</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>1×1</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>2×2</td><td>32</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>5×5</td><td>1×1</td><td>32</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>32</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>3</td><td>×</td><td>0.0</td><td>Sigmoid</td></tr><tr><td>D(x)-3 × 32 × 32 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>5×5</td><td>1×1</td><td>32</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>64</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>128</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>256</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>512</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>D(z)-256 ×1 × 1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>D(x,z)-1024 × 1 × 1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="7"> Concatenate D(x) and D(z) along the channel axis</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>1024</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>1024</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td></td><td>1</td><td>×</td><td>0.2</td><td>Sigmoid</td></tr><tr><td></td><td></td><td>1×1</td><td></td><td></td><td></td><td></td></tr><tr><td>Optimizer</td><td colspan="7">Adam(α = 10-4,β1 = 0.5,β2 = 10-3)</td></tr><tr><td>Batch size</td><td>100</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Epochs 100</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Leaky ReLU slope</td><td>0.01</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td colspan="7">Weight, bias initialization Isotropic gaussian (μ = O,o = O.O1),Constant(O)</td></tr></table>
|
| 337 |
+
|
| 338 |
+
Table 5: CelebA model hyperparameters (unsupervised).
|
| 339 |
+
|
| 340 |
+
<table><tr><td>Operation</td><td>Kernel</td><td>Strides</td><td> Feature maps</td><td>BN?</td><td>Dropout</td><td>Nonlinearity</td></tr><tr><td>Gz(x)-3 × 64× 64 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>2×2</td><td>1×1</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>7×7</td><td>2×2</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>5×5</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>7×7</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>512</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>×</td><td>0.0</td><td>Linear</td></tr><tr><td>Gx(z)- 512 ×1 × 1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>1×1</td><td>512</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>7×7</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>5×5</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>7×7</td><td>2×2</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>2×2</td><td>1×1</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>3</td><td>×</td><td>0.0</td><td>Sigmoid</td></tr><tr><td>D(x)-3 × 64 × 64 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>2×2</td><td>1×1</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>7×7</td><td>2×2</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>5×5</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>7×7</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>512</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>D(z) -512 ×1 × 1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>1024</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>1024</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>D(𝑥,z) - 1024 × 1 × 1 input</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Concatenate D(x) and D(z) along the channel axis</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>2048</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>2048</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>1</td><td>×</td><td>0.2</td><td>Sigmoid</td></tr><tr><td>Optimizer</td><td>r Adam(α = 10-4,β1= 0.5)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Batch size</td><td>100</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Epochs</td><td>123</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Leaky ReLU slope</td><td>0.02</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Weight, bias initialization Isotropic gaussian (μ = O,σ = O.O1), Constant(O)</td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 341 |
+
|
| 342 |
+
Table 6: Tiny ImageNet model hyperparameters (unsupervised).
|
| 343 |
+
|
| 344 |
+
<table><tr><td></td><td>Operation</td><td>Kernel Strides</td><td> Feature maps</td><td>BN?</td><td>Dropout</td><td>Nonlinearity</td></tr><tr><td colspan="7">Gz(x)-3 × 64 × 64 input</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>2048</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>2048</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>512</td><td>×</td><td>0.0</td><td>Linear</td></tr><tr><td colspan="7">Gx(z)- 256 × 1 × 1 input</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>2048</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>1×1</td><td>256</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>2×2</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>1×1</td><td>128</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>2×2</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>1×1</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Transposed convolution</td><td>4×4</td><td>2×2</td><td>64</td><td>√</td><td>0.0</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>3</td><td>×</td><td>0.0</td><td>Sigmoid</td></tr><tr><td colspan="7">D(x)-3 × 64 × 64 input</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>64</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>64</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>128</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>128</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>2×2</td><td>256</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>4×4</td><td>1×1</td><td>256</td><td>√</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td colspan="7">D(z)-256 ×1 ×1 input</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>2048</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>2048</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td colspan="7">D(x,z)-2304 × 1 × 1 input</td></tr><tr><td colspan="7"> Concatenate D(x) and D(z) along the channel axis</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>4096</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>4096</td><td>×</td><td>0.2</td><td>Leaky ReLU</td></tr><tr><td>Convolution</td><td>1×1</td><td>1×1</td><td>1</td><td>×</td><td>0.2</td><td>Sigmoid</td></tr><tr><td colspan="7">Optimizer Adam (α = 10-4, β1 = 0.5,β2 = 10-3)</td></tr><tr><td>Batch size 128</td><td colspan="7"></td></tr><tr><td></td><td colspan="7"></td></tr><tr><td>Epochs 125</td><td colspan="7"></td></tr><tr><td>Leaky ReLU slope 0.01</td><td colspan="7">Weight, bias initialization Isotropic gaussian (μ = O,o = O.Ol),Constant(O)</td></tr><tr><td></td><td colspan="7"></td></tr></table>
|
| 345 |
+
|
| 346 |
+
# B A GENERATIVE STORY FOR ALI
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 9: A Circle of Infinite Painters’ view of the ALI game.
|
| 350 |
+
|
| 351 |
+
The Circle of Infinite Painters is a very prolific artistic group. Very little is known about the Circle, but what we do know is that it is composed of two very brilliant artists. It has produced new paintings almost daily for more than twenty years, each one more beautiful than the others. Not only are the paintings exquisite, but their title and description is by itself a literary masterpiece.
|
| 352 |
+
|
| 353 |
+
However, some scholars believe that things might not be as they appear: certain discrepancies in the Circle’s body of work hints at the Circle being composed of more than one artistic duo. This is what Joseph Discriminator, art critique and world expert on the Circle, believes. He’s recently been working intensively on the subject. Without knowing it, he’s right: the Circle is not one, but two artistic duos.
|
| 354 |
+
|
| 355 |
+
Xavier and Zach Prior form the creative component of the group. Xavier is a painter and can, in one hour and starting from nothing, produce a painting that would make any great painter jealous. Impossible however for him to explain what he’s done: he works by intuition alone. Zach is an author and his literary talent equals Xavier’s artistic talent. His verb is such that the scenes he describes could just as well be real.
|
| 356 |
+
|
| 357 |
+
By themselves, the Prior brothers cannot collaborate: Xavier can’t paint anything from a description and Zach is bored to death with the idea of describing anything that does not come out of his head. This is why the Prior brothers depend on the Conditional sisters so much.
|
| 358 |
+
|
| 359 |
+
Zelda Conditional has an innate descriptive talent: she can examine a painting and describe it so well that the original would seem like an imitation. Xena Conditional has a technical mastery of painting that allows her to recreate everything that’s described to her in the most minute details. However, their creativity is inversely proportional to their talent: by themselves, they cannot produce anything of interest.
|
| 360 |
+
|
| 361 |
+
As such, the four members of the Circle work in pairs. What Xavier paints, Zelda describes, and what Zach describes, Xena paints. They all work together to fulfill the same vision of a unified Circle of Infinite Painters, a whole greater than the sum of its parts.
|
| 362 |
+
|
| 363 |
+
This is why Joseph Discriminator’s observations bother them so much. Secretly, the Circle put Mr. Discriminator under surveillance. Whatever new observation he’s made, they know right away and work on attenuating the differences to maintain the illusion of a Circle of Infinite Painters made of a single artistic duo.
|
| 364 |
+
|
| 365 |
+
Will the Circle reach this ideal, or will it be unmasked by Mr. Discriminator?
|
md/train/B1l6qiR5F7/B1l6qiR5F7.md
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ORDERED NEURONS: INTEGRATING TREE STRUCTURES INTO RECURRENT NEURAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Yikang Shen∗
|
| 4 |
+
Mila/Universite de Montr´ eal and Microsoft Research´
|
| 5 |
+
Montreal, Canada´
|
| 6 |
+
|
| 7 |
+
Shawn Tan∗ Mila/Universite de Montr´ eal´ Montreal, Canada´
|
| 8 |
+
|
| 9 |
+
Alessandro Sordoni Microsoft Research Montreal, Canada´
|
| 10 |
+
|
| 11 |
+
Aaron Courville
|
| 12 |
+
Mila/Universite de Montr´ eal´
|
| 13 |
+
Montreal, Canada´
|
| 14 |
+
|
| 15 |
+
# ABSTRACT
|
| 16 |
+
|
| 17 |
+
Natural language is hierarchically structured: smaller units (e.g., phrases) are nested within larger units (e.g., clauses). When a larger constituent ends, all of the smaller constituents that are nested within it must also be closed. While the standard LSTM architecture allows different neurons to track information at different time scales, it does not have an explicit bias towards modeling a hierarchy of constituents. This paper proposes to add such an inductive bias by ordering the neurons; a vector of master input and forget gates ensures that when a given neuron is updated, all the neurons that follow it in the ordering are also updated. Our novel recurrent architecture, ordered neurons LSTM (ON-LSTM), achieves good performance on four different tasks: language modeling, unsupervised parsing, targeted syntactic evaluation, and logical inference1.
|
| 18 |
+
|
| 19 |
+
# 1 INTRODUCTION
|
| 20 |
+
|
| 21 |
+
Natural language has a sequential overt form as spoken and written, but the underlying structure of language is not strictly sequential. This structure is usually tree-like. Linguists agree on a set of rules, or syntax, that determine this structure (Chomsky, 1956; 1965; Sandra & Taft, 2014) and dictate how single words compose to form meaningful larger units, also called “constituents” (Koopman et al., 2013). The human brain can also implicitly acquire the latent structure of language (Dehaene et al., 2015): during language acquisition, children are not given annotated parse trees. This observation brings more interest in latent structure induction with artificial neural network approaches, which are inspired by information processing and communication patterns in biological nervous systems. From a practical point of view, integrating a tree structure into a neural network language model may be important for multiple reasons:
|
| 22 |
+
|
| 23 |
+
(i) to obtain a hierarchical representation with increasing levels of abstraction, a key feature of deep neural networks (Bengio et al., 2009; LeCun et al., 2015; Schmidhuber, 2015);
|
| 24 |
+
(ii) to model the compositional effects of language (Koopman et al., 2013; Socher et al., 2013) and help with the long-term dependency problem (Bengio et al., 2009; Tai et al., 2015) by providing shortcuts for gradient backpropagation (Chung et al., 2016);
|
| 25 |
+
(iii) to improve generalization via a better inductive bias and at the same time potentially reducing the need of a large amount of training data.
|
| 26 |
+
|
| 27 |
+
The study of deep neural network techniques that can infer and use tree structures to form better representations of natural language sentences has received a great deal of attention in recent years (Bowman et al., 2016; Yogatama et al., 2016; Shen et al., 2017; Jacob et al., 2018; Choi et al., 2018; Williams et al., 2018; Shi et al., 2018).
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
Interest expense in the 1988 third quarter was 75.3 million Interest expense in the 1988 third quarter was 75.3 million
|
| 31 |
+
Figure 1: Binary parse tree inferred by our model (left) and its corresponding ground-truth (right).
|
| 32 |
+
|
| 33 |
+
Given a sentence, one straightforward way of predicting the corresponding latent tree structure is through a supervised syntactic parser. Trees produced by these parsers have been used to guide the composition of word semantics into sentence semantics (Socher et al., 2013; Bowman et al., 2015), or even to help next word prediction given previous words (Wu et al., 2017). However, supervised parsers are limiting for several reasons: i) few languages have comprehensive annotated data for supervised parser training; ii) in some domains, syntax rules tend to be broken (e.g. in tweets); and iii) languages change over time with use, so syntax rules may evolve.
|
| 34 |
+
|
| 35 |
+
On the other hand, grammar induction, defined as the task of learning the syntactic structure from raw corpora without access to expert-labeled data, remains an open problem. Many such recent attempts suffer from inducing a trivial structure (e.g., a left-branching or right-branching tree (Williams et al., 2018)), or encounter difficulties in training caused by learning branching policies with Reinforcement Learning (RL) (Yogatama et al., 2016). Furthermore, some methods are relatively complex to implement and train, like the PRPN model proposed in Shen et al. (2017).
|
| 36 |
+
|
| 37 |
+
Recurrent neural networks (RNNs) have proven highly effective at the task of language modeling (Merity et al., 2017; Melis et al., 2017). RNNs explicitly impose a chain structure on the data. This assumption may seem at odds with the latent non-sequential structure of language and may pose several difficulties for the processing of natural language data with deep learning methods, giving rise to problems such as capturing long-term dependencies (Bengio et al., 2009), achieving good generalization (Bowman et al., 2015), handling negation (Socher et al., 2013), etc. Meanwhile, some evidence exists that LSTMs with sufficient capacity potentially implement syntactic processing mechanisms by encoding the tree structure implicitly, as shown by Gulordava et al. (2018); Kuncoro et al. (2018) and very recently by Lakretz et al. (2019). We believe that the following question remains: Can better models of language be obtained by architectures equipped with an inductive bias towards learning such latent tree structures?
|
| 38 |
+
|
| 39 |
+
In this work, we introduce ordered neurons, a new inductive bias for recurrent neural networks. This inductive bias promotes differentiation of the life cycle of information stored inside each neuron: high-ranking neurons will store long-term information which is kept for a large number of steps, while low-ranking neurons will store short-term information that can be rapidly forgotten. To avoid a strict division between high-ranking and low-ranking neurons, we propose a new activation function, the cumulative softmax, or cumax(), to actively allocate neurons to store long/short-term information. We use the cumax() function to produce a vector of master input and forget gates ensuring that when a given neuron is updated (erased), all of the neurons that follow it in the ordering are also updated (erased). Based on the cumax() and the LSTM architecture, we have designed a new model, ON-LSTM, that is biased towards performing tree-like composition operations. Our model achieves good performance on four tasks: language modeling, unsupervised constituency parsing, targeted syntactic evaluation (Marvin & Linzen, 2018) and logical inference (Bowman et al., 2015). The result on unsupervised constituency parsing suggests that the proposed inductive bias aligns with the syntax principles proposed by human experts better than previously proposed models. The experiments also show that ON-LSTM performs better than standard LSTM models in tasks requiring capturing long-term dependencies and achieves better generalization to longer sequences.
|
| 40 |
+
|
| 41 |
+
# 2 RELATED WORK
|
| 42 |
+
|
| 43 |
+
There has been prior work leveraging tree structures for natural language tasks in the literature. Socher et al. (2010); Alvarez-Melis & Jaakkola (2016); Zhou et al. (2017); Zhang et al. (2015) use supervised learning on expert-labeled treebanks for predicting parse trees. Socher et al. (2013) and Tai et al. (2015) explicitly model the tree-structure using parsing information from an external parser. Later, Bowman et al. (2016) exploited guidance from a supervised parser (Klein & Manning, 2003) in order to train a stack-augmented neural network.
|
| 44 |
+
|
| 45 |
+
Theoretically, RNNs and LSTMs can model data produced by context-free grammars and contextsensitive grammars (Gers & Schmidhuber, 2001). However, recent results suggest that introducing structure information into LSTMs is beneficial. Kuncoro et al. (2018) showed that RNNGs (Dyer et al., 2016), which have an explicit bias to model the syntactic structures, outperform LSTMs on the subject-verb agreement task (Linzen et al., 2016). In our paper, we run a more extensive suite of grammatical tests recently provided by Marvin & Linzen (2018). Bowman et al. (2014; 2015) also demonstrate that tree-structured models are more effective for downstream tasks whose data was generated by recursive programs. Interestingly, Shi et al. (2018) suggests that while the prescribed grammar tree may not be ideal, some sort of hierarchical structure, perhaps task dependent, might help. However, the problem of efficiently inferring such structures from observed data remains an open question.
|
| 46 |
+
|
| 47 |
+
The task of learning the underlying grammar from data is known as grammar induction (Chen, 1995; Cohen et al., 2011). Early work incorporated syntactic structure in the context of language modeling (Roark, 2001; Charniak, 2001; Chelba & Jelinek, 2000). More recently, there have been attempts at incorporating some structure for downstream tasks using neural models (Grefenstette et al., 2015; Sun et al., 2017; Joulin & Mikolov, 2015). Generally, these works augment a main recurrent model with a stack and focus on solving algorithmic tasks. Yogatama et al. (2018) focus on language modeling and syntactic evaluation tasks (Linzen et al., 2016) but they do not show the extent to which the structure learnt by the model align with gold-standard parse trees. Shen et al. (2017) introduced the Parsing-Reading-Predict Networks (PRPN) model, which attempts to perform parsing by solving a language modeling task. The model uses self-attention to compose previous states, where the range of attention is controlled by a learnt “syntactic distance”. The authors show that this value corresponds to the depth of the parse tree. However, the added complexity in using the PRPN model makes it unwieldy in practice.
|
| 48 |
+
|
| 49 |
+
Another possible solution is to develop models with varying time-scales of recurrence as a way of capturing this hierarchy. El Hihi & Bengio (1996); Schmidhuber (1991); Lin et al. (1998) describe models that capture hierarchies at pre-determined time-scales. More recently, Koutnik et al. (2014) proposed Clockwork RNN, which segments the hidden state of a RNN by updating at different time-scales. These approaches typically make a strong assumption about the regularity of the hierarchy involved in modelling the data. Chung et al. (2016) proposed a method that, unlike the Clockwork RNN, would learn a multi-scale hierarchical recurrence. However, the model still has a pre-determined depth to the hierarchy, depending on the number of layers. Our work is more closely related to Rippel et al. (2014), which propose to induce a hierarchy in the representation units by applying “nested” dropout masks: units are not dropped independently at random but whenever a unit is dropped, all the units that follow in the ordering are also dropped. Our work can be seen as a soft relaxation of the dropout by means of the proposed cumax() activation. Moreover, we propose to condition the update masks on the particular input and apply our overall model to sequential data. Therefore, our model can adapt the structure to the observed data, while both Clockwork RNN and nested dropout impose a predefined hierarchy to hidden representations.
|
| 50 |
+
|
| 51 |
+
# 3 ORDERED NEURONS
|
| 52 |
+
|
| 53 |
+
Given a sequence of tokens $S = ( x _ { 1 } , \dots , x _ { T } )$ and its corresponding constituency tree (Figure 2(a)), our goal is to infer the unobserved tree structure while processing the observed sequence, i.e. while computing the hidden state $h _ { t }$ for each time step $t$ . At each time step, $h _ { t }$ would ideally contain a information about all the nodes on the path between the current leaf node $x _ { t }$ and the root S. In Figure 2(c), we illustrate how $h _ { t }$ would contain information about all the constituents that include the current token $x _ { t }$ even if those are only partially observed. This intuition suggests that each node in the tree can be represented by a set of neurons in the hidden states. However, while the dimensionality of the hidden state is fixed in advance, the length of the path connecting the leaf to the root of the tree may be different across different time steps and sentences. Therefore, a desiderata for the model is to dynamically reallocate the dimensions of the hidden state to each node.
|
| 54 |
+
|
| 55 |
+
Given these requirements, we introduce ordered neurons, an inductive bias that forces neurons to represent information at different time-scales. In our model, high-ranking neurons contain long-term or global information that will last anywhere from several time steps to the entire sentence, representing nodes near the root of the tree. Low-ranking neurons encode short-term or local information that only last one or a few time steps, representing smaller constituents, as shown in Figure 2(b). The differentiation between high-ranking and low-ranking neurons is learnt in a completely data-driven fashion by controlling the update frequency of single neurons: to erase (or update) high-ranking neurons, the model should first erase (or update) all lower-ranking neurons. In other words, some neurons always update more (or less) frequently than the others, and that order is pre-determined as part of the model architecture.
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
Figure 2: Correspondences between a constituency parse tree and the hidden states of the proposed ON-LSTM. A sequence of tokens $S = ( x _ { 1 } , x _ { 2 } , x _ { 3 } )$ and its corresponding constituency tree are illustrated in (a). We provide a block view of the tree structure in (b), where both S and VP nodes span more than one time step. The representation for high-ranking nodes should be relatively consistent across multiple time steps. (c) Visualization of the update frequency of groups of hidden state neurons. At each time step, given the input word, dark grey blocks are completely updated while light grey blocks are partially updated. The three groups of neurons have different update frequencies. Topmost groups update less frequently while lower groups are more frequently updated.
|
| 59 |
+
|
| 60 |
+
# 4 ON-LSTM
|
| 61 |
+
|
| 62 |
+
In this section, we present a new RNN unit, ON-LSTM (“ordered neurons LSTM”). The new model uses an architecture similar to the standard LSTM, reported below:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\begin{array} { r l } & { f _ { t } = \sigma ( W _ { f } x _ { t } + U _ { f } h _ { t - 1 } + b _ { f } ) } \\ & { i _ { t } = \sigma ( W _ { i } x _ { t } + U _ { i } h _ { t - 1 } + b _ { i } ) } \\ & { o _ { t } = \sigma ( W _ { o } x _ { t } + U _ { o } h _ { t - 1 } + b _ { o } ) } \\ & { \hat { c } _ { t } = \operatorname { t a n h } ( W _ { c } x _ { t } + U _ { c } h _ { t - 1 } + b _ { c } ) } \\ & { h _ { t } = o _ { t } \circ \operatorname { t a n h } ( c _ { t } ) } \end{array}
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
The difference with the LSTM is that we replace the update function for the cell state $c _ { t }$ with a new function that will be explained in the following sections. The forget gates $f _ { t }$ and input gates $i _ { t }$ are used to control the erasing and writing operation on cell states $c _ { t }$ , as before. Since the gates in the LSTM act independently on each neuron, it may be difficult in general to discern a hierarchy of information between the neurons. To this end, we propose to make the gate for each neuron dependent on the others by enforcing the order in which neurons should be updated.
|
| 69 |
+
|
| 70 |
+
# 4.1 ACTIVATION FUNCTION: cumax()
|
| 71 |
+
|
| 72 |
+
To enforce an order to the update frequency, we introduce a new activation function:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\hat { g } = \mathrm { c u m a x } ( \ldots ) = \mathrm { c u m s u m } ( \mathrm { s o f t m a x } ( \ldots ) ) ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
where cumsum denotes the cumulative sum. We will show that the vector $\hat { g }$ can be seen as the expectation of a binary gate $g = ( 0 , . . . , 0 , 1 , . . . , 1 )$ . This binary gate splits the cell state into two segments: the 0-segment and the 1-segment. Thus, the model can apply different update rules on the two segments to differentiate long/short-term information. Denote by $d$ a categorical random
|
| 79 |
+
|
| 80 |
+
variable representing the index for the first 1 in $g$ :
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
p ( d ) = \operatorname { s o f t m a x } ( . . . )
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
The variable $d$ represents the split point between the two segments. We can compute the probability of the $k$ -th value in $g$ being 1 by evaluating the probability of the disjunction of any of the values before the $k$ -th being the split point, that is $\mathbf { \bar { \Sigma } } d \leq \bar { k } = ( d = 0 ) \lor ( d = \bar { 1 } ) \lor \cdots \lor ( d = k ) .$ . Since the categories are mutually exclusive, we can do this by computing the cumulative distribution function:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
p ( g _ { k } = 1 ) = p ( d \leq k ) = \sum _ { i \leq k } p ( d = i )
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
Ideally, $g$ should take the form of a discrete variable. Unfortunately, computing gradients when a discrete variable is included in the computation graph is not trivial (Schulman et al., 2015), so in practice we use a continuous relaxation by computing the quantity $p ( d \leq k )$ , obtained by taking a cumulative sum of the softmax. As $g _ { k }$ is binary, this is equivalent to computing $\mathbb { E } [ g _ { k } ]$ . Hence, $\hat { \boldsymbol g } = \mathbb { E } [ \boldsymbol { g } ]$ .
|
| 93 |
+
|
| 94 |
+
# 4.2 STRUCTURED GATING MECHANISM
|
| 95 |
+
|
| 96 |
+
Based on the cumax() function, we introduce a master forget gate $\tilde { f } _ { t }$ and a master input gate $\tilde { i } _ { t }$
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\begin{array} { r l } & { \tilde { f } _ { t } = \operatorname { c u m a x } ( W _ { \tilde { f } } x _ { t } + U _ { \tilde { f } } h _ { t - 1 } + b _ { \tilde { f } } ) } \\ & { \tilde { i } _ { t } = 1 - \operatorname { c u m a x } ( W _ { \tilde { i } } x _ { t } + U _ { \tilde { i } } h _ { t - 1 } + b _ { \tilde { i } } ) } \end{array}
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
Following the properties of the cumax() activation, the values in the master forget gate are monotonically increasing from 0 to 1, and those in the master input gate are monotonically decreasing from 1 to 0. These gates serve as high-level control for the update operations of cell states. Using the master gates, we define a new update rule:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\begin{array} { r l } & { \omega _ { t } = \tilde { f } _ { t } \circ \tilde { i } _ { t } } \\ & { \hat { f } _ { t } = f _ { t } \circ \omega _ { t } + ( \tilde { f } _ { t } - \omega _ { t } ) = \tilde { f } _ { t } \circ ( f _ { t } \circ \tilde { i } _ { t } + 1 - \tilde { i } _ { t } ) } \\ & { \hat { i } _ { t } = i _ { t } \circ \omega _ { t } + ( \tilde { i } _ { t } - \omega _ { t } ) = \tilde { i } _ { t } \circ ( i _ { t } \circ \tilde { f } _ { t } + 1 - \tilde { f } _ { t } ) } \\ & { c _ { t } = \hat { f } _ { t } \circ c _ { t - 1 } + \hat { i } _ { t } \circ \hat { c } _ { t } } \end{array}
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
In order to explain the intuition behind the new update rule, we assume that the master gates are binary:
|
| 109 |
+
|
| 110 |
+
• The master forget gate $\tilde { f } _ { t }$ controls the erasing behavior of the model. Suppose $\tilde { f } _ { t } ~ =$ $( 0 , \ldots , 0 , 1 , \ldots , 1 )$ and the split point is $d _ { t } ^ { f }$ . Given the Eq. (12) and (14), the information stored in the first $d _ { t } ^ { f }$ neurons of the previous cell state $c _ { t - 1 }$ will be completely erased. In a parse tree (e.g. Figure 2(a)), this operation is akin to closing previous constituents. A large number of zeroed neurons, i.e. a large $d _ { t } ^ { f }$ , represents the end of a high-level constituent in the parse tree, as most of the information in the state will be discarded. Conversely, a small $d _ { t } ^ { f }$ represents the end of a low-level constituent as high-level information is kept for further processing. • The master input gate $\tilde { i } _ { t }$ is meant to control the writing mechanism of the model. Assume that $\tilde { i } _ { t } = ( 1 , \cdot \cdot \cdot , \bar { 1 } , 0 , \cdot \cdot \cdot , 0 )$ and the split point is $d _ { t } ^ { i }$ . Given Eq. (13) and (14), a large $d _ { t } ^ { i }$ means that the current input $x _ { t }$ contains long-term information that needs to be preserved for several time steps. Conversely, a small $d _ { t } ^ { \bar { i } }$ means that the current input $x _ { t }$ just provides local information that could be erased by $\tilde { f } _ { t }$ in the next few time steps. The product of the two master gates $\omega _ { t }$ represents the overlap of $\tilde { f } _ { t }$ and $\tilde { i } _ { t }$ . Whenever an overlap exists $( \exists k , \omega _ { t k } > 0 )$ , the corresponding segment of neurons encodes the incomplete constituents that contain some previous words and the current input word $x _ { t }$ . Since these constituents are incomplete, we want to update the information inside the respective blocks. The segment is further controlled by the $f _ { t }$ and $i _ { t }$ in the standard LSTM model to enable more fine-grained operations within blocks. For example, in Figure 2, the word $x _ { 3 }$ is nested into the constituents S and VP. At this time step, the overlap gray blocks would represent these constituents, such that $\tilde { f } _ { t }$ and $\tilde { i } _ { t }$ can decide whether to reset or update each individual neurons in these blocks.
|
| 111 |
+
|
| 112 |
+
Table 1: Single model perplexity on validation and test sets for the Penn Treebank language modeling task. Models labelled tied use weight tying on the embedding and softmax weights (Inan et al., 2016; Press & Wolf, 2017). Models labelled \* focus on improving the softmax component of RNN language model. Their contribution is orthogonal to ours.
|
| 113 |
+
|
| 114 |
+
<table><tr><td>Model</td><td>Parameters</td><td>Validation</td><td>Test</td></tr><tr><td>Zaremba et al. (2014) - LSTM (large)</td><td>66M</td><td>82.2</td><td>78.4</td></tr><tr><td>Gal & Ghahramani (2016) - Variational LSTM (large, MC)</td><td>66M</td><td>1</td><td>73.4</td></tr><tr><td>Kim et al. (2016) - CharCNN</td><td>19M</td><td>一</td><td>78.9</td></tr><tr><td>Merity etal.(2016)- Pointer Sentinel-LSTM</td><td>21M</td><td>72.4</td><td>70.9</td></tr><tr><td>Grave et al.(2016) - LSTM</td><td>1</td><td>1</td><td>82.3</td></tr><tr><td>Grave et al.(2016) -LSTM+ continuous cache pointer</td><td>一</td><td>一</td><td>72.1</td></tr><tr><td>Inan et al.(2016) - Variational LSTM(tied) +augmented loss</td><td>51M</td><td>71.1</td><td>68.5</td></tr><tr><td>Zilly et al. (2016) - Variational RHN (tied)</td><td>23M</td><td>67.9</td><td>65.4</td></tr><tr><td>Zoph & Le (2016)- NAS Cell (tied)</td><td>54M</td><td>1</td><td>62.4</td></tr><tr><td>Shen et al.(2017) - PRPN-LM</td><td></td><td></td><td>62.0</td></tr><tr><td>Melis et al. (2017) - 4-layer skip connection LSTM (tied)</td><td>24M</td><td>60.9</td><td>58.3</td></tr><tr><td>Merity et al. (2017)-AWD-LSTM- 3-layer LSTM (tied)</td><td>24M</td><td>60.0</td><td>57.3</td></tr><tr><td>ON-LSTM- 3-layer (tied)</td><td>25M</td><td>58.29±0.10</td><td>56.17 ±0.12</td></tr><tr><td>Yang et al. (2017) - AWD-LSTM-MoS *</td><td>22M</td><td>56.5</td><td>54.4</td></tr></table>
|
| 115 |
+
|
| 116 |
+
As the master gates only focus on coarse-grained control, modeling them with the same dimensions as the hidden states is computationally expensive and unnecessary. In practice, we set $\tilde { f } _ { t }$ and $\tilde { i } _ { t }$ to be $\begin{array} { r } { D _ { m } = \frac { D } { C } } \end{array}$ dimensional vectors, where $D$ is the dimension of hidden state, and $C$ is a chunk size factor. We repeat each dimension times, before the element-wise multiplication with $f _ { t }$ and $i _ { t }$ . The downsizing significantly reduces the number of extra parameters that we need to add to the LSTM. Therefore, every neuron within each $C$ -sized chunk shares the same master gates.
|
| 117 |
+
|
| 118 |
+
# 5 EXPERIMENTS
|
| 119 |
+
|
| 120 |
+
We evaluate the proposed model on four tasks: language modeling, unsupervised constituency parsing, targeted syntactic evaluation (Marvin & Linzen, 2018), and logical inference (Bowman et al., 2015).
|
| 121 |
+
|
| 122 |
+
# 5.1 LANGUAGE MODELING
|
| 123 |
+
|
| 124 |
+
Word-level language modeling is a macroscopic evaluation of the model’s ability to deal with various linguistic phenomena (e.g. co-occurence, syntactic structure, verb-subject agreement, etc). We evaluate our model by measuring perplexity on the Penn TreeBank (PTB) (Marcus et al., 1993; Mikolov, 2012) task.
|
| 125 |
+
|
| 126 |
+
For fair comparison, we closely follow the model hyper-parameters, regularization and optimization techniques introduced in AWD-LSTM (Merity et al., 2017). Our model uses a three-layer ONLSTM model with 1150 units in the hidden layer and an embedding of size 400. For master gates, the downsize factor $C = 1 0$ . The total number of parameters was slightly increased from 24 millions to 25 millions with additional matrices for computing master gates. We manually searched some of the dropout values for ON-LSTM based on the validation performance. The values used for dropout on the word vectors, the output between LSTM layers, the output of the final LSTM layer, and embedding dropout where (0.5, 0.3, 0.45, 0.1) respectively. A weight-dropout of 0.45 was applied to the recurrent weight matrices.
|
| 127 |
+
|
| 128 |
+
As shown in Table 1, our model performs better than the standard LSTM while sharing the same number of layers, embedding dimensions, and hidden states units. Recall that the master gates only control how information is stored in different neurons. It is interesting to note that we can improve the performance of a strong LSTM model without adding skip connections or a significant increase in the number of parameters.
|
| 129 |
+
|
| 130 |
+
# 5.2 UNSUPERVISED CONSTITUENCY PARSING
|
| 131 |
+
|
| 132 |
+
The unsupervised constituency parsing task compares the latent stree structure induced by the model with those annotated by human experts. Following the experiment settings proposed in Htut et al. (2018), we take our best model for the language modeling task, and test it on WSJ10 dataset and WSJ test set. WSJ10 has 7422 sentences, filtered from the WSJ dataset with the constraint of 10 words or less, after the removal of punctuation and null elements (Klein & Manning, 2002). The WSJ test set contains 2416 sentences with various lengths. It is worth noting that the WSJ10 test set contains sentences from the training, validation, and test set of the PTB dataset, while WSJ test uses the same set of sentences as the PTB test set.
|
| 133 |
+
|
| 134 |
+
To infer the tree structure of a sentence from a pre-trained model, we initialize the hidden states with the zero vector, then feed the sentence into the model as done in the language modeling task. At each time step, we compute an estimate of $d _ { t } ^ { f }$ :
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
\hat { d } _ { t } ^ { f } = \mathbb { E } \left[ d _ { t } ^ { f } \right] = \sum _ { k = 1 } ^ { D _ { m } } k p _ { f } ( d _ { t } = k ) = \sum _ { k = 1 } ^ { D _ { m } } \sum _ { i = 1 } ^ { k } p _ { f } ( d _ { t } = k ) = D _ { m } - \sum _ { k = 1 } ^ { D _ { m } } \tilde { f } _ { t k }
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+
where $p _ { f }$ is the probability distribution over split points associated to the master forget gate and $D _ { m }$ is the size of the hidden state. Given $\hat { d } _ { t } ^ { f }$ , we can use the top-down greedy parsing algorithm proposed in Shen et al. (2017) for unsupervised constituency parsing. We first sort the $\{ \hat { d } _ { t } ^ { f } \}$ in decreasing order. For the first $\hat { d } _ { i } ^ { f }$ in the sorted sequence, we split the sentence into constituents $( ( x _ { < i } ) , ( \bar { x _ { i } } , ( x _ { > i } ) ) )$ . Then, we recursively repeat this operation for constituents $( x _ { < i } )$ and $( x _ { > i } )$ , until each constituent contains only one word.
|
| 141 |
+
|
| 142 |
+
The performance is shown in Table 2. The second layer of ON-LSTM achieves state-of-the-art unsupervised constituency parsing results on the WSJ test set, while the first and third layers do not perform as well. One possible interpretation is that the first and last layers may be too focused on capturing local information useful for the language modeling task as they are directly exposed to input tokens and output predictions respectively, thus may not be encouraged to learn the more abstract tree structure. Since the WSJ test set contains sentences of various lengths which are unobserved during training, we find that ON-LSTM provides better generalization and robustness toward longer sentences than previous models. We also see that ON-LSTM model can provide strong results for phrase detection, including ADJP (adjective phrases), PP (prepositional phrases), and NP (noun phrases). This feature could benefit many downstream tasks, like question answering, named entity recognition, co-reference resolution, etc.
|
| 143 |
+
|
| 144 |
+
# 5.3 TARGETED SYNTACTIC EVALUATION
|
| 145 |
+
|
| 146 |
+
Targeted syntactic evaluation tasks have been proposed in Marvin & Linzen (2018). It is a collection of tasks that evaluate language models along three different structure-sensitive linguistic phenomena: subject-verb agreement, reflexive anaphora and negative polarity items. Given a large number of minimally different pairs of English sentences, each consisting of a grammatical and an ungrammatical sentence, a language model should assign a higher probability to a grammatical sentence than an ungrammatical one.
|
| 147 |
+
|
| 148 |
+
Using the released codebase2 and the same settings proposed in Marvin & Linzen (2018), we train both our ON-LSTM model and a baseline LSTM language model on a 90 million word subset of Wikipedia. Both language models have two layers of 650 units, a batch size of 128, a dropout rate of 0.2, a learning rate of 20.0, and were trained for 40 epochs. The input embeddings have 200 dimensions and the output embeddings have 650 dimesions.
|
| 149 |
+
|
| 150 |
+
Table 3 shows that the ON-LSTM performs better on the long-term dependency cases, while the baseline LSTM fares better on the short-term ones. This is possibly due to the relatively small num
|
| 151 |
+
|
| 152 |
+
<table><tr><td rowspan="3">Model</td><td rowspan="3">Training Data</td><td rowspan="3">Training Object</td><td rowspan="3">Vocab Size</td><td colspan="4">Parsing F1</td><td colspan="6"> Depth Accuracy on WSJ by Tag</td></tr><tr><td colspan="2">WSJ10</td><td colspan="2">WSJ</td><td rowspan="2">WSJ max</td><td rowspan="2"></td><td rowspan="2">ADJP</td><td rowspan="2">NP</td><td rowspan="2">PP</td><td rowspan="2">INTJ</td></tr><tr><td>μ(σ)</td><td>max</td><td>μ(σ)</td><td></td></tr><tr><td>PRPN-UP</td><td>AlINLI Train</td><td>LM</td><td>76k</td><td>66.3 (0.8)</td><td>68.5</td><td>38.3 (0.5)</td><td>39.8</td><td>5.8</td><td>28.7</td><td></td><td>65.5 32.7</td><td></td><td>0.0</td></tr><tr><td>PRPN-LM</td><td>AlINLI Train</td><td>LM</td><td>76k</td><td>52.4 (4.9)</td><td>58.1</td><td>35.0 (5.4)</td><td>42.8</td><td>6.1</td><td></td><td>37.8</td><td>59.7</td><td>61.5</td><td>100.0</td></tr><tr><td>PRPN-UP</td><td>WSJ Train</td><td>LM</td><td>15.8k</td><td>62.2 (3.9)</td><td>70.3</td><td>26.0 (2.3)</td><td>32.8</td><td>5.8</td><td></td><td>24.8</td><td>54.4</td><td>17.8</td><td>0.0</td></tr><tr><td>PRPN-LM</td><td>WSJ Train</td><td>LM</td><td>10k</td><td>70.5 (0.4)</td><td>71.3</td><td>37.4 (0.3)</td><td>38.1</td><td>5.9</td><td></td><td>26.2</td><td>63.9</td><td>24.4</td><td>0.0</td></tr><tr><td>ON-LSTM1st-layer</td><td>WSJ Train</td><td>LM</td><td>10k</td><td>35.2 (4.1)</td><td>42.8</td><td>20.0 (2.8)</td><td>24.0</td><td>5.6</td><td></td><td>38.1</td><td>23.8</td><td>18.3</td><td>100.0</td></tr><tr><td>ON-LSTM 2nd-layer</td><td>WSJ Train</td><td>LM</td><td>10k</td><td>65.1 (1.7)</td><td>66.8</td><td>47.7 (1.5)</td><td>49.4</td><td>5.6</td><td></td><td>46.2</td><td>61.4 55.4</td><td></td><td>0.0</td></tr><tr><td>ON-LSTM3rd-layer</td><td>WSJ Train</td><td>LM</td><td>10k</td><td>54.0 (3.9)</td><td>57.6</td><td>36.6 (3.3)</td><td>40.4</td><td>5.3</td><td></td><td>44.8</td><td>57.5 47.2</td><td></td><td>0.0</td></tr><tr><td>300D ST-Gumbel</td><td>AlINLI Train</td><td>NLI</td><td>1</td><td></td><td></td><td>19.0 (1.0)</td><td>20.1</td><td>1</td><td></td><td>15.6</td><td>18.8</td><td>9.9</td><td>59.4</td></tr><tr><td>w/o Leaf GRU</td><td>AlINLI Train</td><td>NLI</td><td></td><td></td><td></td><td>22.8 (1.6)</td><td>25.0</td><td></td><td></td><td>18.9</td><td>24.1</td><td>14.2</td><td>51.8</td></tr><tr><td>300D RL-SPINN</td><td>AlINLI Train</td><td>NLI</td><td></td><td></td><td></td><td>13.2 (0.0)</td><td>13.2</td><td></td><td></td><td>1.7</td><td>10.8</td><td>4.6</td><td>50.6</td></tr><tr><td>w/o Leaf GRU</td><td>AlINLI Train NLI</td><td></td><td></td><td></td><td></td><td>13.1 (0.1)</td><td>13.2</td><td>1</td><td></td><td>1.6</td><td>10.9</td><td>4.6</td><td>50.0</td></tr><tr><td>CCM</td><td>WSJ10 Full</td><td></td><td></td><td></td><td>71.9</td><td></td><td></td><td>1</td><td></td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>DMV+CCM</td><td>WSJ10 Full</td><td></td><td></td><td></td><td>77.6</td><td></td><td></td><td></td><td></td><td>二</td><td></td><td>1</td><td>1</td></tr><tr><td>UML-DOP</td><td>WSJ10 Full</td><td></td><td></td><td></td><td>82.9</td><td></td><td></td><td></td><td></td><td>1</td><td>一</td><td>一</td><td>1</td></tr><tr><td>Random Trees</td><td></td><td></td><td></td><td>31.7 (0.3)</td><td>32.2</td><td>18.4 (0.1)</td><td>18.6</td><td>5.3</td><td></td><td>17.4</td><td>22.3</td><td>16.0</td><td>40.4</td></tr><tr><td>Balanced Trees</td><td></td><td></td><td></td><td>43.4 (0.0)</td><td></td><td>43.4 24.5 (0.0)</td><td>24.5</td><td>4.6</td><td></td><td>22.1</td><td>20.2</td><td>9.3</td><td>55.9</td></tr><tr><td>Left Branching</td><td></td><td></td><td></td><td>19.6 (0.0)</td><td>19.6</td><td>9.0 (0.0)</td><td>9.0</td><td>12.4</td><td></td><td>1</td><td>一</td><td></td><td>1</td></tr><tr><td>Right Branching</td><td></td><td></td><td></td><td>56.6 (0.0)</td><td>56.6</td><td>39.8 (0.0)</td><td>39.8</td><td>12.4</td><td></td><td>二</td><td></td><td></td><td>1</td></tr></table>
|
| 153 |
+
|
| 154 |
+
Table 2: Unlabeled parsing F1 results evaluated on the full WSJ10 and WSJ test set. Our language model has three layers, each of them provides a sequence of $\hat { d } _ { t } ^ { f }$ . We provide the parsing performance for all layers. Results with RL-SPINN and ST-Gumbel are evaluated on the full WSJ (Williams et al., 2017). PRPN models are evaluated on the WSJ test set (Htut et al., 2018). We run the model with 5 different random seeds to calculate the average F1. The Accuracy columns represent the fraction of ground truth constituents of a given type that correspond to constituents in the model parses. We use the model with the best F1 score to report ADJP, NP, PP, and INTJ. WSJ10 baselines are from Klein & Manning (2002, CCM), Klein & Manning (2005, $\mathrm { D M V + C C M }$ , and Bod (2006, UML-DOP). As the WSJ10 baselines are trained using POS tags, they are not strictly comparable with the latent tree learning results. Italics mark results that are worse than the random baseline.
|
| 155 |
+
|
| 156 |
+
ber of units in the hidden states, which is insufficient to take into account both long and short-term information. We also notice that the results for NPI test cases have unusually high variance across different hyper-parameters. This result maybe due to the non-syntactic cues discussed in Marvin & Linzen (2018). Despite this, ON-LSTM actually achieves better perplexity on the validation set.
|
| 157 |
+
|
| 158 |
+
# 5.4 LOGICAL INFERENCE
|
| 159 |
+
|
| 160 |
+
We also analyze the model’s performance on the logical inference task described in Bowman et al. (2015). This task is based on a language that has a vocabulary of six words and three logical operations, or, and, not. There are seven mutually exclusive logical relations that describe the relationship between two sentences: two types of entailment, equivalence, exhaustive and non-exhaustive contradiction, and two types of semantic independence. Similar to the natural language inference task, this logical inference task requires the model to predict the correct label given a pair of sentences. The train/test split is as described in the original codebase3, and $10 \%$ of training set is set aside as the validation set.
|
| 161 |
+
|
| 162 |
+
We evaluate the ON-LSTM and the standard LSTM on this dataset. Given a pair of sentences $( s _ { 1 } , s _ { 2 } )$ , we feed both sentences into an RNN encoder, taking the last hidden state $( h _ { 1 } , h _ { 2 } )$ as the sentence embedding. The concatenation of $( h _ { 1 } , h _ { 2 } , h _ { 1 } \circ h _ { 2 }$ , $\mathrm { a b s } ( h _ { 1 } - h _ { 2 } ) )$ is used as input to a multi-layer classifier, which gives a probability distribution over seven labels. In our experiment, the RNN models were parameterised with 400 units in one hidden layer, and the input embedding size was 128. A dropout of 0.2 was applied between different layers. Both models are trained on sequences with 6 or less logical operations and tested on sequences with at most 12 operations.
|
| 163 |
+
|
| 164 |
+
Figure 3 shows the performance of ON-LSTM and standard LSTM on the logical inference task. While both models achieve nearly $100 \%$ accuracy on short sequences $\left( \le ~ 3 \right)$ , ON-LSTM attains better performance on sequences longer then 3. The performance gap continues to increase on longer sequences $( \geq 7 )$ that were not present during training. Hence, the ON-LSTM model shows better generalization while facing structured data with various lengths and comparing to the standard LSTM. A tree-structured model can achieve strong performance on this dataset (Bowman et al., 2015), since it is provided with the ground truth structure as input. The recursive application of the same composition function is well suited for this task. We also include the result of RRNet (Jacob et al., 2018), which can induce the latent tree structure from downstream tasks. Note that the results may not be comparable, because the hyper-parameters for training were not provided.
|
| 165 |
+
|
| 166 |
+
<table><tr><td>ON-LSTM LSTM</td></tr><tr><td>Short-Term Dependency</td></tr><tr><td>SUBJECT-VERB AGREEMENT:</td></tr><tr><td>Simple 0.99 1.00 0.98</td></tr><tr><td>In a sentential complement 0.95 0.92</td></tr><tr><td>Short VP coordination 0.89</td></tr><tr><td>In an object relative clause 0.84</td></tr><tr><td>In an object relative (no that) 0.78 0.81</td></tr><tr><td>REFLEXIVE ANAPHORA:</td></tr><tr><td>Simple 0.89 0.82</td></tr><tr><td>In a sentential complement 0.86 0.80</td></tr><tr><td>NEGATIVE POLARITY ITEMS:</td></tr><tr><td>Simple (grammatical vs.intrusive) 0.18 1.00</td></tr><tr><td>Simple (intrusive vs.ungrammatical) 0.50 0.01</td></tr><tr><td>Simple (grammatical vs.ungrammatical) 0.07 0.63</td></tr><tr><td>Long-Term Dependency</td></tr><tr><td>SUBJECT-VERB AGREEMENT: 0.74</td></tr><tr><td>Long VP coordination 0.74 0.67 0.68</td></tr><tr><td>Across a prepositional phrase Across a subject relative clause 0.66 0.60</td></tr><tr><td>Across an object relative clause 0.57 0.52</td></tr><tr><td>Across an object relative (no that) 0.54 0.51</td></tr><tr><td>REFLEXIVE ANAPHORA:</td></tr><tr><td>Across a relative clause 0.57 0.58</td></tr><tr><td>NEGATIVE POLARITY ITEMS:</td></tr><tr><td>0.59 0.95</td></tr><tr><td>Across a relative clause (grammatical vs.intrusive) 0.00</td></tr><tr><td>Across a relative clause (intrusive vs.ungrammatical) 0.20</td></tr><tr><td>Across a relative clause (grammatical vs.ungrammatical) 0.11 0.04</td></tr></table>
|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
Table 3: Overall accuracy for the ON-LSTM and LSTM on each test case. “Long-term dependency” means that an unrelated phrase (or a clause) exist between the targeted pair of words, while “shortterm dependency” means there is no such distraction.
|
| 170 |
+
Figure 3: Test accuracy of the models, trained on short sequences $( \leq 6 )$ in logic data. The horizontal axis indicates the length of the sequence, and the vertical axis indicates the accuracy of models performance on the corresponding test set.
|
| 171 |
+
|
| 172 |
+
# 6 CONCLUSION
|
| 173 |
+
|
| 174 |
+
In this paper, we propose ordered neurons, a novel inductive bias for recurrent neural networks. Based on this idea, we propose a novel recurrent unit, the ON-LSTM, which includes a new gating mechanism and a new activation function cumax(·). This brings recurrent neural networks closer to performing tree-like composition operations, by separately allocating hidden state neurons with long and short-term information. The model performance on unsupervised constituency parsing shows that the ON-LSTM induces the latent structure of natural language in a way that is coherent with human expert annotation. The inductive bias also enables ON-LSTM to achieve good performance on language modeling, long-term dependency, and logical inference tasks.
|
| 175 |
+
|
| 176 |
+
# REFERENCES
|
| 177 |
+
|
| 178 |
+
David Alvarez-Melis and Tommi S Jaakkola. Tree-structured decoding with doubly-recurrent neural networks. 2016.
|
| 179 |
+
Yoshua Bengio et al. Learning deep architectures for ai. Foundations and trends $\textsuperscript { \textregistered }$ in Machine Learning, 2(1):1–127, 2009.
|
| 180 |
+
Rens Bod. An all-subtrees approach to unsupervised parsing. In Proceedings of the 21st International Conference on Computational Linguistics and the 44th annual meeting of the Association for Computational Linguistics, pp. 865–872. Association for Computational Linguistics, 2006.
|
| 181 |
+
Samuel R Bowman, Christopher Potts, and Christopher D Manning. Recursive neural networks can learn logical semantics. arXiv preprint arXiv:1406.1827, 2014.
|
| 182 |
+
Samuel R Bowman, Christopher D Manning, and Christopher Potts. Tree-structured composition in neural networks without tree-structured architectures. arXiv preprint arXiv:1506.04834, 2015.
|
| 183 |
+
Samuel R Bowman, Jon Gauthier, Abhinav Rastogi, Raghav Gupta, Christopher D Manning, and Christopher Potts. A fast unified model for parsing and sentence understanding. arXiv preprint arXiv:1603.06021, 2016.
|
| 184 |
+
Eugene Charniak. Immediate-head parsing for language models. In Proceedings of the 39th Annual Meeting on Association for Computational Linguistics, pp. 124–131. Association for Computational Linguistics, 2001.
|
| 185 |
+
Ciprian Chelba and Frederick Jelinek. Structured language modeling. Computer Speech & Language, 14(4):283–332, 2000.
|
| 186 |
+
Stanley F Chen. Bayesian grammar induction for language modeling. In Proceedings of the 33rd annual meeting on Association for Computational Linguistics, pp. 228–235. Association for Computational Linguistics, 1995.
|
| 187 |
+
Jihun Choi, Kang Min Yoo, and Sang-goo Lee. Learning to compose task-specific tree structures. In Proceedings of the 2018 Association for the Advancement of Artificial Intelligence (AAAI). and the 7th International Joint Conference on Natural Language Processing (ACL-IJCNLP), 2018.
|
| 188 |
+
Noam Chomsky. Three models for the description of language. IRE Transactions on information theory, 2(3):113–124, 1956.
|
| 189 |
+
Noam Chomsky. Aspects of the Theory of Syntax. The MIT Press, Cambridge, 1965. URL http:// www.amazon.com/Aspects-Theory-Syntax-Noam-Chomsky/dp/0262530074.
|
| 190 |
+
Junyoung Chung, Sungjin Ahn, and Yoshua Bengio. Hierarchical multiscale recurrent neural networks. arXiv preprint arXiv:1609.01704, 2016.
|
| 191 |
+
Shay B Cohen, Dipanjan Das, and Noah A Smith. Unsupervised structure prediction with nonparallel multilingual guidance. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pp. 50–61. Association for Computational Linguistics, 2011.
|
| 192 |
+
|
| 193 |
+
Stanislas Dehaene, Florent Meyniel, Catherine Wacongne, Liping Wang, and Christophe Pallier. The neural representation of sequences: from transition probabilities to algebraic patterns and linguistic trees. Neuron, 88(1):2–19, 2015.
|
| 194 |
+
|
| 195 |
+
Chris Dyer, Adhiguna Kuncoro, Miguel Ballesteros, and Noah A Smith. Recurrent neural network grammars. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 199–209, 2016.
|
| 196 |
+
|
| 197 |
+
Salah El Hihi and Yoshua Bengio. Hierarchical recurrent neural networks for long-term dependen cies. In Advances in neural information processing systems, pp. 493–499, 1996.
|
| 198 |
+
|
| 199 |
+
Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In Advances in neural information processing systems, pp. 1019–1027, 2016.
|
| 200 |
+
|
| 201 |
+
Felix A Gers and E Schmidhuber. Lstm recurrent networks learn simple context-free and contextsensitive languages. IEEE Transactions on Neural Networks, 12(6):1333–1340, 2001.
|
| 202 |
+
|
| 203 |
+
Edouard Grave, Armand Joulin, and Nicolas Usunier. Improving neural language models with a continuous cache. arXiv preprint arXiv:1612.04426, 2016.
|
| 204 |
+
|
| 205 |
+
Edward Grefenstette, Karl Moritz Hermann, Mustafa Suleyman, and Phil Blunsom. Learning to transduce with unbounded memory. In Advances in Neural Information Processing Systems, pp. 1828–1836, 2015.
|
| 206 |
+
|
| 207 |
+
Kristina Gulordava, Piotr Bojanowski, Edouard Grave, Tal Linzen, and Marco Baroni. Colorless green recurrent networks dream hierarchically. In Proc. of NAACL, pp. 1195–1205, 2018.
|
| 208 |
+
|
| 209 |
+
Phu Mon Htut, Kyunghyun Cho, and Samuel R Bowman. Grammar induction with neural language models: An unusual replication. arXiv preprint arXiv:1808.10000, 2018.
|
| 210 |
+
|
| 211 |
+
Hakan Inan, Khashayar Khosravi, and Richard Socher. Tying word vectors and word classifiers: A loss framework for language modeling. arXiv preprint arXiv:1611.01462, 2016.
|
| 212 |
+
|
| 213 |
+
Athul Paul Jacob, Zhouhan Lin, Alessandro Sordoni, and Yoshua Bengio. Learning hierarchical structures on-the-fly with a recurrent-recursive model for sequences. In Proceedings of The Third Workshop on Representation Learning for NLP, pp. 154–158, 2018.
|
| 214 |
+
|
| 215 |
+
Armand Joulin and Tomas Mikolov. Inferring algorithmic patterns with stack-augmented recurrent nets. In Advances in neural information processing systems, pp. 190–198, 2015.
|
| 216 |
+
|
| 217 |
+
Yoon Kim, Yacine Jernite, David Sontag, and Alexander M Rush. Character-aware neural language models. In AAAI, pp. 2741–2749, 2016.
|
| 218 |
+
|
| 219 |
+
Dan Klein and Christopher D Manning. A generative constituent-context model for improved grammar induction. In Proceedings of the 40th Annual Meeting on Association for Computational Linguistics, pp. 128–135. Association for Computational Linguistics, 2002.
|
| 220 |
+
|
| 221 |
+
Dan Klein and Christopher D Manning. Accurate unlexicalized parsing. In Proceedings of the 41st Annual Meeting on Association for Computational Linguistics-Volume 1, pp. 423–430. Association for Computational Linguistics, 2003.
|
| 222 |
+
|
| 223 |
+
Dan Klein and Christopher D Manning. Natural language grammar induction with a generative constituent-context model. Pattern recognition, 38(9):1407–1419, 2005.
|
| 224 |
+
|
| 225 |
+
Hilda Koopman, Dominique Sportiche, and Edward Stabler. An introduction to syntactic analysis and theory, 2013.
|
| 226 |
+
|
| 227 |
+
Jan Koutnik, Klaus Greff, Faustino Gomez, and Juergen Schmidhuber. A clockwork rnn. arXiv preprint arXiv:1402.3511, 2014.
|
| 228 |
+
|
| 229 |
+
Adhiguna Kuncoro, Chris Dyer, John Hale, Dani Yogatama, Stephen Clark, and Phil Blunsom. Lstms can learn syntax-sensitive dependencies well, but modeling structure makes them better. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 1426–1436, 2018.
|
| 230 |
+
|
| 231 |
+
Yair Lakretz, German Kruszewski, Theo Desbordes, Dieuwke Hupkes, Stanislas Dehaene, and Marco Baroni. The emergence of number and syntax units in lstm language models. In Proc. of NAACL, 2019.
|
| 232 |
+
|
| 233 |
+
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
|
| 234 |
+
|
| 235 |
+
Tsungnan Lin, Bill G Horne, Peter Tino, and C Lee Giles. Learning long-term dependencies is not as difficult with narx recurrent neural networks. Technical report, 1998.
|
| 236 |
+
|
| 237 |
+
Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. Assessing the ability of lstms to learn syntaxsensitive dependencies. arXiv preprint arXiv:1611.01368, 2016.
|
| 238 |
+
|
| 239 |
+
Mitchell P Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The penn treebank. Computational linguistics, 19(2):313–330, 1993.
|
| 240 |
+
|
| 241 |
+
Rebecca Marvin and Tal Linzen. Targeted syntactic evaluation of language models. arXiv preprint arXiv:1808.09031, 2018.
|
| 242 |
+
|
| 243 |
+
Gabor Melis, Chris Dyer, and Phil Blunsom. On the state of the art of evaluation in neural language ´ models. arXiv preprint arXiv:1707.05589, 2017.
|
| 244 |
+
|
| 245 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016.
|
| 246 |
+
|
| 247 |
+
Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and Optimizing LSTM Language Models. arXiv preprint arXiv:1708.02182, 2017.
|
| 248 |
+
|
| 249 |
+
Toma´s Mikolov. Statistical language models based on neural networks. ˇ Presentation at Google, Mountain View, 2nd April, 2012.
|
| 250 |
+
|
| 251 |
+
Ofir Press and Lior Wolf. Using the output embedding to improve language models. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, volume 2, pp. 157–163, 2017.
|
| 252 |
+
|
| 253 |
+
Oren Rippel, Michael Gelbart, and Ryan Adams. Learning ordered representations with nested dropout. In International Conference on Machine Learning, pp. 1746–1754, 2014.
|
| 254 |
+
|
| 255 |
+
Brian Roark. Probabilistic top-down parsing and language modeling. Computational linguistics, 27 (2):249–276, 2001.
|
| 256 |
+
|
| 257 |
+
Dominiek Sandra and Marcus Taft. Morphological Structure, Lexical Representation and Lexical Access (RLE Linguistics C: Applied Linguistics): A Special Issue of Language and Cognitive Processes. Routledge, 2014.
|
| 258 |
+
|
| 259 |
+
Jurgen Schmidhuber. Neural sequence chunkers. 1991. ¨
|
| 260 |
+
|
| 261 |
+
Jurgen Schmidhuber. Deep learning in neural networks: An overview.¨ Neural networks, 61:85–117, 2015.
|
| 262 |
+
|
| 263 |
+
John Schulman, Nicolas Heess, Theophane Weber, and Pieter Abbeel. Gradient estimation using stochastic computation graphs. In Advances in Neural Information Processing Systems, pp. 3528– 3536, 2015.
|
| 264 |
+
|
| 265 |
+
Yikang Shen, Zhouhan Lin, Chin-Wei Huang, and Aaron Courville. Neural language modeling by jointly learning syntax and lexicon. arXiv preprint arXiv:1711.02013, 2017.
|
| 266 |
+
|
| 267 |
+
Haoyue Shi, Hao Zhou, Jiaze Chen, and Lei Li. On tree-based neural sentence modeling. arXiv preprint arXiv:1808.09644, 2018.
|
| 268 |
+
|
| 269 |
+
Richard Socher, Christopher D Manning, and Andrew Y Ng. Learning continuous phrase representations and syntactic parsing with recursive neural networks. In Proceedings of the NIPS-2010 Deep Learning and Unsupervised Feature Learning Workshop, volume 2010, pp. 1–9, 2010.
|
| 270 |
+
|
| 271 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013.
|
| 272 |
+
|
| 273 |
+
Guo-Zheng Sun, C Lee Giles, Hsing-Hen Chen, and Yee-Chun Lee. The neural network pushdown automaton: Model, stack and learning simulations. arXiv preprint arXiv:1711.05738, 2017.
|
| 274 |
+
|
| 275 |
+
Kai Sheng Tai, Richard Socher, and Christopher D Manning. Improved semantic representations from tree-structured long short-term memory networks. arXiv preprint arXiv:1503.00075, 2015.
|
| 276 |
+
|
| 277 |
+
Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426, 2017.
|
| 278 |
+
|
| 279 |
+
Adina Williams, Andrew Drozdov\*, and Samuel R Bowman. Do latent tree learning models identify meaningful structure in sentences? Transactions of the Association of Computational Linguistics, 6:253–267, 2018.
|
| 280 |
+
|
| 281 |
+
Shuangzhi Wu, Dongdong Zhang, Nan Yang, Mu Li, and Ming Zhou. Sequence-to-dependency neural machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 698–707, 2017.
|
| 282 |
+
|
| 283 |
+
Zhilin Yang, Zihang Dai, Ruslan Salakhutdinov, and William W Cohen. Breaking the softmax bottleneck: A high-rank rnn language model. arXiv preprint arXiv:1711.03953, 2017.
|
| 284 |
+
|
| 285 |
+
Dani Yogatama, Phil Blunsom, Chris Dyer, Edward Grefenstette, and Wang Ling. Learning to compose words into sentences with reinforcement learning. arXiv preprint arXiv:1611.09100, 2016.
|
| 286 |
+
|
| 287 |
+
Dani Yogatama, Yishu Miao, Gabor Melis, Wang Ling, Adhiguna Kuncoro, Chris Dyer, and Phil Blunsom. Memory architectures in recurrent neural network language models. 2018.
|
| 288 |
+
|
| 289 |
+
Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
|
| 290 |
+
|
| 291 |
+
Xingxing Zhang, Liang Lu, and Mirella Lapata. Top-down tree long short-term memory networks. arXiv preprint arXiv:1511.00060, 2015.
|
| 292 |
+
|
| 293 |
+
Ganbin Zhou, Ping Luo, Rongyu Cao, Yijun Xiao, Fen Lin, Bo Chen, and Qing He. Generative neural machine for tree structures. CoRR, 2017.
|
| 294 |
+
|
| 295 |
+
Julian Georg Zilly, Rupesh Kumar Srivastava, Jan Koutn´ık, and Jurgen Schmidhuber. Recurrent ¨ highway networks. arXiv preprint arXiv:1607.03474, 2016.
|
| 296 |
+
|
| 297 |
+
Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
|
| 298 |
+
|
| 299 |
+

|
| 300 |
+
Figure A.1: Left parses are from the 2nd layer of the ON-LSTM model, Right parses are converted from human expert annotations (removing all punctuations).
|
md/train/BJlRs34Fvr/BJlRs34Fvr.md
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SKIP CONNECTIONS MATTER: ON THE TRANSFERABILITY OF ADVERSARIAL EXAMPLES GENERATED WITH RESNETS
|
| 2 |
+
|
| 3 |
+
Dongxian $\mathbf { W _ { u } } ^ { 1 , 3 }$ Yisen $\mathbf { W a n g } ^ { 2 \dagger }$ Shu-Tao $\mathbf { X _ { i a } ^ { \bullet , 1 , 3 } }$ James Bailey4 Xingjun Ma4
|
| 4 |
+
|
| 5 |
+
1Tsinghua University
|
| 6 |
+
2Shanghai Jiao Tong University
|
| 7 |
+
3PCL Research Center of Networks and Communications, Peng Cheng Laboratory
|
| 8 |
+
4The University of Melbourne
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Skip connections are an essential component of current state-of-the-art deep neural networks (DNNs) such as ResNet, WideResNet, DenseNet, and ResNeXt. Despite their huge success in building deeper and more powerful DNNs, we identify a surprising security weakness of skip connections in this paper. Use of skip connections allows easier generation of highly transferable adversarial examples. Specifically, in ResNet-like (with skip connections) neural networks, gradients can backpropagate through either skip connections or residual modules. We find that using more gradients from the skip connections rather than the residual modules according to a decay factor, allows one to craft adversarial examples with high transferability. Our method is termed Skip Gradient Method (SGM). We conduct comprehensive transfer attacks against state-of-the-art DNNs including ResNets, DenseNets, Inceptions, Inception-ResNet, Squeeze-and-Excitation Network (SENet) and robustly trained DNNs. We show that employing SGM on the gradient flow can greatly improve the transferability of crafted attacks in almost all cases. Furthermore, SGM can be easily combined with existing black-box attack techniques, and obtain high improvements over state-of-the-art transferability methods. Our findings not only motivate new research into the architectural vulnerability of DNNs, but also open up further challenges for the design of secure DNN architectures.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
In deep neural networks (DNNs), a skip connection builds a short-cut from a shallow layer to a deep layer by connecting the input of a convolutional block (also known as the residual module) directly to its output. While different layers of a neural network learn different “levels” of features, skip connections can help preserve low-level features and avoid performance degradation when adding more layers. This has been shown to be crucial for building very deep and powerful DNNs such as ResNet (He et al., 2016a;b), WideResNet (Zagoruyko & Komodakis, 2016), DenseNet (Huang et al., 2017) and ResNeXt (Xie et al., 2017). In the meantime, despite their superior performance, DNNs have been found extremely vulnerable to adversarial examples (or attacks), which are input examples slightly perturbed with an intention to fool the network to make a wrong prediction (Szegedy et al., 2013; Goodfellow et al., 2014; Ma et al., 2018; Bai et al., 2019; Wang et al., 2019; 2020). Adversarial examples often appear imperceptible to human observers, and are transferable across different models (Liu et al., 2017). This has raised security concerns on the deployment of DNNs in security critical scenarios, such as face recognition (Sharif et al., 2016), autonomous driving (Evtimov et al., 2018), video analysis (Jiang et al., 2019) and medical diagnosis (Ma et al., 2019).
|
| 17 |
+
|
| 18 |
+
Adversarial examples can be crafted following either a white-box setting (the adversary has full access to the target model) or a black-box setting (the adversary has no information of the target model). White-box methods such as Fast Gradient Sign Method (FGSM) (Goodfellow et al., 2014), Basic Iterative Method (BIM) (Kurakin et al., 2016), Projected Gradient Decent (PGD) (Madry et al., 2018) and Carlini and Wagner (CW) (Carlini & Wagner, 2017) often suffer from low transferability in a black-box setting, thus posing only limited threats to DNN models which are usually kept secret in practice (Dong et al., 2018; Xie et al., 2019). Several techniques have been proposed to improve the transferability of black-box attacks crafted on a surrogate model, such as momentum boosting (Dong et al., 2018), diverse input (Xie et al., 2019) and translation invariance (Dong et al., 2019). Although these techniques are effective, they (as well as white-box methods) all treat the entire network (either the target model or the surrogate model) as a single component while ignore its inner architectural characteristics. The question of whether or not the DNN architecture itself can expose more transferability of adversarial attacks is an unexplored problem.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: Left: Illustration of the last 3 skip connections (green lines) and residual modules (black boxes) of a ImageNet-trained ResNet-18. Right: The success rate (in the form of “white-box/blackbox”) of adversarial attacks crafted using gradients flowing through either a skip connection (going upwards) or a residual module (going leftwards) at each junction point (circle). Three example backpropagation paths are highlighted in different colors, with the green path skipping over the last two residual modules having the best attack success rate while the red path through all 3 residual modules having the worst attack success rate. The attacks are crafted by BIM on 5000 ImageNet validation images under maximum $L _ { \infty }$ perturbation $\epsilon \ : = \ : 1 6$ (pixel values are in [0, 255]). The black-box success rate is tested against a VGG19 target model.
|
| 22 |
+
|
| 23 |
+
In this paper, we identify one such weakness about the skip connections used by many state-of-theart DNNs. We first conduct a toy experiment with the BIM attack and ResNet-18 on the ImageNet validation dataset (Deng et al., 2009) to investigate how skip connections affect the adversarial strength of attacks crafted on the network. At each of the last 3 skip connections and residual modules of ResNet-18, we illustrate the success rate of attacks crafted using gradients backpropagate through either the skip connection or the residual module in Figure 1. As can be observed, the success rate drops more drastically whenever using gradients from a residual module instead of the skip connection. This implies that gradients from the skip connections are more vulnerable (high success rate). In addition, we surprisingly find that skip connections expose more transferable information. For example, the black-box success rate was even improved from $5 2 . 5 2 \%$ to $6 2 . 1 0 \%$ when the attack skips the last two residual modules (following the path in green color).
|
| 24 |
+
|
| 25 |
+
Motivated by the above observations, in this paper, we propose the Skip Gradient Method (SGM) to generate adversarial examples using gradients more from the skip connections rather than the residual modules. In particular, SGM utilizes a decay factor to reduce gradients from the residual modules. We find that this simple adjustment on the gradient flow can generate highly transferable adversarial examples, and the more skip connections in a network, the more transferable are the crafted attacks. This is in sharp contrast to the design principles (e.g., “going deeper” with skip connections) underpinning many modern DNNs. In particular, our main contributions are:
|
| 26 |
+
|
| 27 |
+
• We identify one surprising property of skip connections in ResNet-like neural networks, i.e., they allow an easy generation of highly transferable adversarial examples.
|
| 28 |
+
• We propose the Skip Gradient Method (SGM) to craft adversarial examples using gradients more from the skip connections. Using a single decay factor on gradients, SGM is an appealingly simple and generic technique that can be used by any existing gradient-based attack methods.
|
| 29 |
+
• We provide comprehensive transfer attack experiments, from different source models against 10 state-of-the-art DNNs, showing that SGM can greatly improve the transferability of crafted adversarial examples. When combined with existing transfer techniques, SGM improves the state-ofthe-art transferability benchmarks by a large margin.
|
| 30 |
+
|
| 31 |
+
# 2 RELATED WORK
|
| 32 |
+
|
| 33 |
+
Existing adversarial attacks can be categorized into two groups: 1) white-box attacks and 2) blackbox attacks. In the white-box setting, the adversary has full access to the parameters of the target model, while in the black-box setting, the target model is kept secret from the adversary.
|
| 34 |
+
|
| 35 |
+
# 2.1 WHITE-BOX ATTACKS
|
| 36 |
+
|
| 37 |
+
Given a clean example $_ { \textbf { \em x } }$ with class label $y$ and a target DNN model $f$ , the goal of an adversary is to find an adversarial example $\mathbf { { x } } _ { a d v }$ that fools the network into making an incorrect prediction (eg. $f ( { \pmb x } _ { a d v } ) \neq y )$ , while still remaining in the $\epsilon$ -ball centered at $_ { \textbf { \em x } }$ (eg. $\| \pmb { x } _ { a d v } - \pmb { x } \| _ { \infty } \leq \bar { \epsilon } )$ .
|
| 38 |
+
|
| 39 |
+
Fast Gradient Sign Method (FGSM) (Goodfellow et al., 2014). FGSM perturbs clean example $_ { \textbf { \em x } }$ for one step by the amount of $\epsilon$ along the gradient direction:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\begin{array} { r } { \pmb { x } _ { a d v } = \pmb { x } + \epsilon \cdot \mathrm { s i g n } \big ( \nabla _ { \pmb { x } } \ell ( f ( \pmb { x } ) , y ) \big ) . } \end{array}
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
The Basic Iterative Method (BIM) (Kurakin et al., 2016) is an iterative version of FGSM that perturbs for $T$ steps with step size $\epsilon / T$ .
|
| 46 |
+
|
| 47 |
+
Projected Gradient Descent (PGD) (Madry et al., 2018). PGD perturbs normal example $_ { \textbf { \em x } }$ for $T$ steps with smaller step size. After each step of perturbation, PGD projects the adversarial example back onto the $\epsilon$ -ball of $_ { \textbf { \em x } }$ , if it goes beyond the $\epsilon$ -ball:
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\begin{array} { r } { \pmb { x } _ { a d v } ^ { t + 1 } = \Pi _ { \epsilon } \big ( \pmb { x } _ { a d v } ^ { t } + \alpha \cdot \mathrm { s i g n } ( \nabla _ { \pmb { x } } \ell ( f ( \pmb { x } _ { a d v } ^ { t } ) , y ) ) \big ) , } \end{array}
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $\Pi _ { \epsilon } ( \cdot )$ is the projection operation. Different to BIM, PGD allows step size $\alpha > \epsilon / T$
|
| 54 |
+
|
| 55 |
+
There are also other types of white-box attacks including sparsity-based methods such as Jacobianbased Saliency Map Attack (JSMA) (Papernot et al., 2016), sparse attack (Modas et al., 2019), onepixel attack (Su et al., 2019), and optimization-based methods such as Carlini and Wagner (CW) (Carlini & Wagner, 2017) and elastic-net (EAD) (Chen et al., 2018).
|
| 56 |
+
|
| 57 |
+
# 2.2 BLACK-BOX ATTACKS
|
| 58 |
+
|
| 59 |
+
Black-box attacks can be generated by either attacking a surrogate model or using gradient estimation methods in combination with queries to the target model. Gradient estimation methods estimate the gradients of the target model using black-box optimization methods such as Finite Differences (FD) (Chen et al., 2017; Bhagoji et al., 2018) or Natural Evolution Strategies (NES) (Ilyas et al., 2018; Jiang et al., 2019). These methods all require a large number of queries to the target model, which not only reduces efficiency but also potentially exposes the attack. Alternatively, black-box adversarial examples can be crafted on a surrogate model then applied to attack the target model. Although the white-box methods can be directly applied on the surrogate model, they are far less effective in the black-box setting (Dong et al., 2018; Xie et al., 2019). Several transfer techniques have been proposed to improve the transferability of black-box attacks.
|
| 60 |
+
|
| 61 |
+
Momentum Iterative boosting (MI) (Dong et al., 2018). MI incorporates a momentum term into the gradient to boost the transferability:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\begin{array} { r } { \pmb { x } _ { a d v } ^ { t + 1 } = \Pi _ { \epsilon } \big ( \pmb { x } _ { a d v } ^ { t } + \alpha \cdot \mathrm { s i g n } ( \pmb { g } ^ { t + 1 } ) \big ) , \pmb { g } ^ { t + 1 } = \mu \cdot \pmb { g } ^ { t } + \frac { \nabla _ { \mathbf { x } } \ell \left( f \left( \pmb { x } _ { a d v } ^ { t } \right) , \pmb { y } \right) } { \| \nabla _ { \mathbf { x } } \ell \left( f \left( \pmb { x } _ { a d v } ^ { t } \right) , \pmb { y } \right) \| _ { 1 } } , } \end{array}
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where $g ^ { t }$ is the adversarial gradient at the $t$ -th step, $\alpha = \epsilon / T$ is the step size for a total of $T$ steps, $\mu$ is a decay factor, and $\| \cdot \| _ { 1 }$ is the $L _ { 1 }$ norm.
|
| 68 |
+
|
| 69 |
+
Diverse Input $\mathbf { \Pi } ( \mathbf { D } \mathbf { I } )$ (Xie et al., 2019). DI proposes to craft adversarial exampels using gradient with respect to the randomly-transformed input example:
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
\pmb { x } _ { a d v } ^ { t + 1 } = \Pi _ { \epsilon } \big ( \pmb { x } _ { a d v } ^ { t } + \alpha \cdot \mathrm { s i g n } \big ( \nabla _ { \pmb { x } } \ell \big ( f \big ( H ( \pmb { x } _ { a d v } ^ { t } ; p ) \big ) , y \big ) \big ) \big ) ,
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
where $H ( \boldsymbol { \mathbf { x } } _ { a d v } ^ { t } ; \boldsymbol { p } )$ is a stochastic transformation function on $\scriptstyle { \pmb { x } } _ { a d v } ^ { t }$ for a given probability $p$
|
| 76 |
+
|
| 77 |
+
Translation Invariant (TI) (Dong et al., 2019). TI targets to evade robustly trained DNNs by generating adversarial examples that are less sensitive to the discriminative regions of the surrogate model. More specifically, $\mathrm { T I }$ computes the gradients with respect to a set of translated versions of the original input:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\pmb { x } _ { a d v } ^ { t + 1 } = \Pi _ { \epsilon } \bigl ( \pmb { x } _ { a d v } ^ { t } + \alpha \cdot \mathrm { s i g n } ( W * \nabla _ { \pmb { x } } \ell ( f ( \pmb { x } _ { a d v } ^ { t } ) , y ) ) \bigr ) ,
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
where $W$ is a predefined kernel (e.g., uniform, linear, and Gaussian) matrix of size $( 2 k + 1 ) ( 2 k +$ 1) $k$ being the maximal number of pixels to shift). This kernel convolution is equivalent to the weighted sum of gradients over $( 2 k + 1 ) ^ { 2 }$ number of shifted input examples.
|
| 84 |
+
|
| 85 |
+
Furthermore, there are other studies focusing on intermediate feature representations. For example, Activation Attack (Inkawhich et al., 2019) drives the activation of a specified layer on a given image towards the layer of a target image, to yield a highly transferable targeted example. Intermediate Level Attack (Huang et al., 2019) attempts to fine-tune an existing adversarial example for greater black-box transferability by increasing its perturbation on a pre-specified layer of the source model.
|
| 86 |
+
|
| 87 |
+
Although the above transfer techniques are effective, they (including white-box attacks) either 1) treat the network (either the surrogate model or the target model) as a single component or 2) only use the intermediate layer output of the network. In other words, they do not directly consider the effects of different DNN architectural characteristics. Li et al. (2018) investigated the use of skip connections and dropout layers for sampling networks, which generates a huge set of ghost networks to perform an ensemble attack. Here, we focus on the architectural property of skip connections from the gradient view without modifying or generating any extra networks.
|
| 88 |
+
|
| 89 |
+
# 3 PROPOSED SKIP GRADIENT ATTACK
|
| 90 |
+
|
| 91 |
+
In this section, we first introduce the gradient decomposition of skip connection and residual module. Following that, we propose our Skip Gradient Method (SGM), then demonstrate the adversarial transferability property of skip connection via a case study.
|
| 92 |
+
|
| 93 |
+
# 3.1 GRADIENT DECOMPOSITION WITH SKIP CONNECTIONS
|
| 94 |
+
|
| 95 |
+
In ResNet-like neural networks, a skip connection uses identity mapping to bypass residual layers, allowing data flow from a shallow layer directly to subsequent deep layers. Thus, we can decompose the network into a collection of paths of different lengths (Veit et al., 2016). We denote a skip connection together with its associated residual module as a building block (residual block) of a network. Considering three successive building blocks (eg. $z _ { i + 1 } = z _ { i } + f _ { i + 1 } ( z _ { i } ) )$ in a residual network from input $z _ { \mathrm { 0 } }$ to output $z _ { 3 }$ , the output $z _ { 3 }$ can be expanded as:
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\begin{array} { r l } & { z _ { 3 } = z _ { 2 } + f _ { 3 } ( z _ { 2 } ) = [ z _ { 1 } + f _ { 2 } ( z _ { 1 } ) ] + f _ { 3 } ( z _ { 1 } + f _ { 2 } ( z _ { 1 } ) ) } \\ & { \quad = [ z _ { 0 } + f _ { 1 } ( z _ { 0 } ) + f _ { 2 } ( z _ { 0 } + f _ { 1 } ( z _ { 0 } ) ) ] + f _ { 3 } \big ( ( z _ { 0 } + f _ { 1 } ( z _ { 0 } ) ) + f _ { 2 } ( z _ { 0 } + f _ { 1 } ( z _ { 0 } ) ) \big ) . } \end{array}
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
According to the chain rule in calculus, the gradient of a loss function $\ell$ with respect to input $z _ { \mathrm { 0 } }$ can then be decomposed as,
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\frac { \partial \ell } { \partial z _ { 0 } } = \frac { \partial \ell } { \partial z _ { 3 } } \frac { \partial z _ { 3 } } { \partial z _ { 2 } } \frac { \partial z _ { 2 } } { \partial z _ { 1 } } \frac { \partial z _ { 1 } } { \partial z _ { 0 } } = \frac { \partial \ell } { \partial z _ { 3 } } ( 1 + \frac { \partial f _ { 3 } } { \partial z _ { 2 } } ) ( 1 + \frac { \partial f _ { 2 } } { \partial z _ { 1 } } ) ( 1 + \frac { \partial f _ { 1 } } { \partial z _ { 0 } } ) .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
Extending this toy example to a network with $L$ residual blocks, the gradient can be decomposed from $L$ -th to the $( l + 1 )$ -th $( 0 \leq l < L )$ ) residual block as,
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\frac { \partial \ell } { \partial \pmb { x } } = \frac { \partial \ell } { \partial z _ { L } } \prod _ { i = l } ^ { L - 1 } \big ( \frac { \partial f _ { i + 1 } } { \partial z _ { i } } + 1 \big ) \frac { \partial z _ { l } } { \partial \pmb { x } } .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
The example illustrated in Figure 1 is a the above decomposition of a ResNet-18 at the last 3 building blocks $( l = L - 3 )$ .
|
| 114 |
+
|
| 115 |
+
# 3.2 SKIP GRADIENT METHOD (SGM)
|
| 116 |
+
|
| 117 |
+
In order to use more gradient from the skip connections, here, we introduce a decay parameter into the decomposed gradient to reduce the gradient from the residual modules. Following the decomposition in Equation (8), the “skipped” gradient is,
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\nabla _ { \pmb { x } } \ell = \frac { \partial \ell } { \partial z _ { L } } \prod _ { i = 0 } ^ { L - 1 } \big ( \gamma \frac { \partial f _ { i + 1 } } { \partial z _ { i } } + 1 \big ) \frac { \partial z _ { 0 } } { \partial \pmb { x } } ,
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
where ${ \boldsymbol { z } } _ { 0 } = { \boldsymbol { x } }$ is the input of the network, and $\gamma \in ( 0 , 1 ]$ is the decay parameter. Accordingly, given a clean example $_ { \textbf { \em x } }$ and a DNN model $f$ , an adversarial example can be crafted iteratively by,
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
\pmb { x } _ { a d v } ^ { t + 1 } = \Pi _ { \epsilon } \Bigl ( \pmb { x } _ { a d v } ^ { t } + \alpha \cdot \mathrm { s i g n } \bigl ( \frac { \partial \ell } { \partial z _ { L } } \prod _ { i = 0 } ^ { L - 1 } ( \gamma \frac { \partial f _ { i + 1 } } { \partial z _ { i } } + 1 ) \frac { \partial z _ { 0 } } { \partial x } \bigr ) \Bigr ) .
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
Table 1: The success rates ( $\%$ ±std over 5 random runs) of black-box attacks (untargeted) crafted by PGD and its “skip gradient” (SGM) version, on different source models against a Inception V3 target model. The best results are in bold.
|
| 130 |
+
|
| 131 |
+
<table><tr><td></td><td>RN18 RN34</td><td>RN50 RN101 RN152</td><td>DN121 DN169</td><td>DN201</td></tr><tr><td>PGD</td><td>23.23±0.69 24.38±0.41</td><td>22.80±0.55 22.98±0.83 26.56±0.75</td><td></td><td>30.71±0.60 30.90±0.31 36.01±0.59</td></tr><tr><td>SGM</td><td>28.92±0.45 43.43±0.32</td><td>36.71±0.55 38.38±0.53 44.84±0.14</td><td>57.38±0.14 60.45±0.42 65.48±0.23</td><td></td></tr></table>
|
| 132 |
+
|
| 133 |
+
SGM is a generic technique that can be easily implemented on any neural network that has skip connections. During the backpropagation process, SGM simply multiplies the decay parameter to the gradient whenever it passes a residual module. Therefore, SGM does not require any computation overhead, and works efficiently even on densely connected networks such as DenseNets. The reduction of residual gradients is accumulated along the backpropagation path, that is, the residual gradients at lower layers will be reduced more times than those at higher layers. This is because, compared to high-level features, low-level features have already been well preserved by skip connections (see feature decompositions in Equation (6)).
|
| 134 |
+
|
| 135 |
+
# 3.3 ADVERSARIAL TRANSFERABILITY WITH SKIP CONNECTIONS: A CASE STUDY
|
| 136 |
+
|
| 137 |
+
To demonstrate the adversarial transferability of skip connections, we conduct a case study on 10- step PGD, and their corresponding SGM versions, to investigate the success rates of black-box attacks crafted with or without manipulating the skip connections. The black-box attacks are generated on 8 different source (surrogate) models ResNet(RN)-18/34/50/101/152 and DenseNet(DN)- 121/169/201, then applied to attack a Inception V3 target model. All models were trained on ImageNet training set. We randomly select 5000 ImageNet validation images that are correctly classified by all source models, and craft untargeted attacks under maximum $L _ { \infty }$ perturbation $\epsilon = 1 6$ , which is a typical black-box setting (Dong et al., 2018; Xie et al., 2019; Dong et al., 2019). The step size of PGD was set to $\alpha = 2$ , and the decay parameter of SGM was set to $\gamma = 0 . 5$ .
|
| 138 |
+
|
| 139 |
+
We run the attack for 5 times with different random seeds, and report the success rates (transferability) of different methods in Table 1. As can be seen, when the skip connections are manipulated with our SGM, the transferability of PGD is greatly improved across all source models. On all source models except RN18, the improvements are more than $1 3 \%$ . Without SGM, the best transferability against the Inception-V3 target model is $3 5 . 4 8 \%$ which is achieved by PGD on DN201, however, this is improved further by our proposed SGM to $6 5 . 3 8 \%$ $( > 2 9 \%$ gain). This not only highlights the surprising property of skip connections in terms of the generation of highly transferable attacks, but also indicates the significance of this property, as such a huge boost in transferability only takes a single decay factor.
|
| 140 |
+
|
| 141 |
+
The 8 source models can be interpreted as from 3 ResNet families: 1) RN18/34 are ResNets with normal residual blocks, 2) RN50/101/152 are ResNets with “bottleneck” residual blocks, and 3) DN121/169/201 are densely connected ResNets. Another important observation is that when there are more skip connections in a network within the same ResNet family (e.g., $\mathrm { R N } 3 4 > \mathrm { R N } 1 8$ , $\mathrm { R N } 1 5 2 > \mathrm { R N } 1 0 1 > \mathrm { R N } 5 0$ , and $\mathrm { D N } 2 0 1 > \mathrm { D N } 1 6 9 > \mathrm { D N } 1 2 1 )$ , or from ResNets to DenseNets (e.g. $\mathrm { D N } 1 2 1 / 1 6 9 / 2 0 1 > \mathrm { R N } 1 8 / 3 4$ and $\mathrm { D N } 1 2 1 / 1 6 9 / 2 0 1 > \mathrm { R N } 5 0 / 1 0 1 / 1 5 2 )$ , the crafted adversarial examples become more transferable, especially when the skip connections are manipulated by our SGM. This raises questions about the design principle behind many state-of-the-art DNNs: “going deeper” with techniques like skip connection and $1 \times 1$ convolution.
|
| 142 |
+
|
| 143 |
+
# 4 COMPARISON TO EXISTING TRANSFER ATTACKS
|
| 144 |
+
|
| 145 |
+
In this section, we compare the transferability of adversarial examples crafted by our proposed SGM and existing methods on ImageNet against both unsecured and secured target models.
|
| 146 |
+
|
| 147 |
+
Baselines. We compare SGM with FGSM, PGD, and 3 state-of-the-art transfer attacks: (1) Momentum Iterative (MI) (Dong et al., 2018), (2) Diverse Input (DI) (Xie et al., 2019), and (3) Transition Invariant (TI) (Dong et al., 2019). Note that the TI attack was originally proposed to attack secured models, although here we include TI to attack both unsecured models and secured models. For TI and our SGM, we test both the one-step and the iterative version, however, the other methods DI and MI only have an iterative version. The iteration step is set to 10 and 20 for unsecured and secured target models respectively. For all iterative methods PGD, TI and our SGM, the step size is set to $\alpha = 2$ . For our proposed SGM, the decay parameter is set to $\gamma = 0 . 2$ (0.5) and $\bar { \gamma } = 0 . 5$ (0.7)
|
| 148 |
+
|
| 149 |
+
on ResNet and DenseNet source models in PGD (FGSM) respectively. For simplicity, we utilize SGM to indicate $\mathrm { F G S M + S G M }$ in one-step attacks, and $\mathrm { P G D + S G M }$ in multi-step attacks. Other parameters of existing methods are configured as in their original papers.
|
| 150 |
+
|
| 151 |
+
Threat Model. We adopt a black-box threat model in which adversarial examples are generated by attacking a source model and then applied to attack the target model. The target model is of a different architecture (indicated by the model name) to the source model, expect when the source and target models are of the same architecture, where we directly use the source model as the target model (equivalent to a white-box setting). The attacks are crafted on 5000 randomly selected ImageNet validation images that are classified correctly by all source models, and are repeated for 5 times with different random seeds. For all attack methods, we follow the standard setting (Dong et al., 2018; Xie et al., 2019) to craft untargeted attacks under maximum $L _ { \infty }$ perturbation $\epsilon = 1 6$ with respect to pixel values in [0, 255].
|
| 152 |
+
|
| 153 |
+
Target Models. We consider two types of target models: 1) unsecured models that are trained on ImageNet training set using traditional training; and 2) secured models trained using adversarial training. For unsecured target model, we choose 7 state-of-the-art DNNs: VGG19 (with batch normalization) (Simonyan & Zisserman, 2015), ResNet-152 (RN152) (He et al., 2016a), DenseNet201 (DN152), 154 layer Squeeze-and-Excitation network (SE154) (Hu et al., 2018), Inception V3 (IncV3) (Szegedy et al., 2016), Inception V4 (IncV3) (Szegedy et al., 2017) and Inception-ResNet V2 (IncResV2) (Szegedy et al., 2017). For secured target models, we consider 3 robustly trained DNNs using ensemble adversarial training (Tramer et al., 2018):\` $\mathrm { I n c V } 3 _ { e n s 3 }$ (ensemble of $3 \ \mathrm { I n c V 3 }$ networks), $\mathrm { I n c V } 3 _ { e n s 4 }$ (ensemble of 4 IncV3 networks) and IncRes $\mathrm { V } 2 _ { e n s 3 }$ (ensemble of 3 IncResV2 networks).
|
| 154 |
+
|
| 155 |
+
Source Models. We choose 8 different source models from the ResNet family: ResNet(RN)- 18/34/50/101/152 and DenseNet(DN)-121/169/201. Whenever the input size of the source model does not match the target model, we resize the crafted adversarial images to the input size of the target model. For VGG19, ResNet and DenseNet models, images are cropped and resized to $2 2 4 \times 2 2 4$ , while for Inception/Inception-ResNet models, images are cropped and resized to $2 9 9 \times 2 9 9$ .
|
| 156 |
+
|
| 157 |
+
# 4.1 TRANSFERABILITY AGAINST UNSECURED MODELS
|
| 158 |
+
|
| 159 |
+
We first investigate the transferability of all attack methods against 7 unsecured models, which is to find the best method that can generate the most transferable attacks on one source model against all target models.
|
| 160 |
+
|
| 161 |
+
One-step Transferability. The one-step transferability is measured by the success rate of one-step attacks, as reported in Table 2. Here, we only show the results on two source models: 1) RN152 which is the best ResNet source model with the highest success rate on average against all target models, and 2) DN201 which is the best DenseNet source model. Also note that, when the source and target models are the same, the result represents the white-box success rate. Overall, adversarial examples crafted on DN201 have significantly better transferability than those crafted on RN152, especially for our SGM method. This is because there are $\sim 3 0 \times$ more skip connections that can be manipulated by our SGM in DN201 compared to RN152. In comparison to to both FGSM and TI, transferability is improved considerably by SGM in almost all test scenarios, except when transferring from RN152 to VGG19/IncV3/IncV4 where SGM is outperformed by TI. This implies that, when transfereing across different architectures (eg. ResNet VGG/Inception), translation adaptation may help increase the transferability of one-step perturbations. However, this advantage of TI disappears when there are more skip connections, as is the case for the DN201 source model.
|
| 162 |
+
|
| 163 |
+
Table 2: One-step transferability: the success rates ( $\% \pm$ std over 5 random runs) of black-box attacks crafted by different methods on 2 source models against 7 unsecured target models. The best results are in bold.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Source</td><td>Attack</td><td>VGG19</td><td>RN152</td><td>DN201</td><td>SE154</td><td>IncV3</td><td>IncV4</td><td>IncResV2</td></tr><tr><td rowspan="3">RN152</td><td>FGSM</td><td>41.96±0.52</td><td>71.53±0.34</td><td>37.49±0.10</td><td>30.00±0.56</td><td>25.66±0.07</td><td>21.55±0.16</td><td>19.90±0.49</td></tr><tr><td>TI</td><td>49.61±0.11</td><td>49.33±0.35</td><td>36.87±0.42</td><td>29.95±0.32</td><td>33.59±0.73</td><td>29.05±0.34</td><td>20.62±0.09</td></tr><tr><td>SGM</td><td>47.54±0.14</td><td>76.90±0.60</td><td>43.73±0.21</td><td>31.16±0.45</td><td>29.41±0.24</td><td>25.11±0.20</td><td>22.63±0.15</td></tr><tr><td rowspan="3">DN201</td><td>FGSM</td><td>49.87±0.17</td><td>38.89±0.29</td><td>81.51±0.33</td><td>34.94±0.53</td><td>31.21±0.47</td><td>27.08±0.23</td><td>23.87±0.45</td></tr><tr><td>TI</td><td>54.37±0.58</td><td>33.49±0.18</td><td>57.71±0.05</td><td>34.46±0.47</td><td>34.45±0.25</td><td>30.17±0.23</td><td>20.36±0.33</td></tr><tr><td>SGM</td><td>56.97±0.25</td><td>47.54±0.14</td><td>87.73±0.76</td><td>42.31±0.67</td><td>37.91±0.56</td><td>32.83±0.38</td><td>29.64±0.25</td></tr></table>
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 2: The attack success rates of black-box attacks crafted by different attack methods on 8 source models against 3 unsecured target models: VGG19 (left), SE154 (middle) and IncV3 (right).
|
| 169 |
+
|
| 170 |
+
Table 3: Multi-step transferability: the success rates ( $\% \pm$ std over 5 random runs) of black-box attacks crafted by different methods on 2 source models against 7 unsecured target models. The best results are in bold.
|
| 171 |
+
|
| 172 |
+
<table><tr><td>Source</td><td>Attack</td><td>VGG19</td><td>RN152</td><td>DN201</td><td>SE154</td><td>IncV3</td><td>IncV4</td><td>IncRes</td></tr><tr><td rowspan="5">RN152</td><td>PGD</td><td>45.03±0.21</td><td>99.91±0.04 51.49±0.51</td><td></td><td>29.35±0.49</td><td>26.56±0.75</td><td>21.03±0.19</td><td>19.10±0.37</td></tr><tr><td>TI</td><td>54.59±0.63</td><td>99.73±0.11</td><td>63.77±0.93</td><td>41.89±0.58 37.97±0.39</td><td></td><td></td><td>36.25±1.13 28.90±0.52</td></tr><tr><td>MI</td><td>65.42±0.60</td><td>99.77±0.02</td><td>75.79±0.69</td><td>53.07±0.44</td><td>50.22±0.07</td><td>43.32±0.27</td><td>41.71±0.36</td></tr><tr><td>DI</td><td>74.01±0.48</td><td>99.90±0.02</td><td>277.81±0.80</td><td>57.49±1.22</td><td>53.95±0.68</td><td>47.16±0.52</td><td>43.47±0.30</td></tr><tr><td>SGM</td><td>79.90±0.69</td><td>99.87±0.03</td><td>81.56±0.35</td><td>61.83±0.17</td><td>57.22±0.51</td><td>48.57±0.09</td><td>45.44±0.36</td></tr><tr><td rowspan="5">DN201</td><td>PGD</td><td>57.61±0.82</td><td>59.84±0.76</td><td>99.89±0.02</td><td>39.78±0.69</td><td>36.01±0.59</td><td>31.76±0.27</td><td>25.92±0.13</td></tr><tr><td>TI</td><td>54.90±0.75</td><td>50.63±1.02</td><td>99.64±0.07</td><td>40.40±0.31</td><td>39.13±0.52</td><td>37.03±1.00</td><td>28.83±0.49</td></tr><tr><td>MI</td><td>75.09±0.80</td><td>76.39±0.61</td><td>99.84±0.05</td><td>64.38±0.69</td><td>59.62±0.36</td><td>54.85±0.56</td><td>50.05±0.25</td></tr><tr><td>DI</td><td>78.11±0.56 78.18±0.91</td><td></td><td>99.81±0.05</td><td>61.75±0.88</td><td>60.04±0.81</td><td>56.15±0.36 49.00±0.83</td><td></td></tr><tr><td>SGM</td><td>82.66±0.29</td><td>86.65±0.50</td><td>99.67±0.08</td><td>72.03±0.53</td><td>65.48±0.23</td><td>58.77±0.78</td><td>54.97±0.25</td></tr></table>
|
| 173 |
+
|
| 174 |
+
Multi-step Transferability. First we provide a detailed study about the transferability of all attack methods from the 8 source models to the 3 representative unsecured target models. We then compare different attack methods on two best source models against all unsecured target models: the best ResNet source model and the best DenseNet source model. The multi-step (e.g., 10 step) transferability from all source models to three representative target models (VGG19, SE154 and IncV3) is illustrated in Figure 2. In all transfer scenarios, our proposed SGM outperforms existing methods consistently on almost all source models except RN18. Adversarial attacks crafted by SGM become more transferable when there are more skip connections in the source model (e.g., from RN18 to DN201). An interesting observation is that, when the target model is shallow such as VGG19 (left figure in Figure 2), shallow source models transfer better, however, when the target model is deep such as SE154 and IncV3 (middle and right figures in Figure 2), deeper source models tend to have better transferability. We suspect this is due to the architectural similarities shared by the target and source models. Note that against the VGG19 target model, the success rate of baseline methods all drop significantly when the ResNet source models become more complex (from RN18 to RN152). The small variations at RN50 and DN121 source models may be caused by the architectural difference between RN18/34 which consist of normal residual blocks, RN50/101/152 which consist of “bottleneck” residual blocks and DN121/169/201 which has dense skip connections.
|
| 175 |
+
|
| 176 |
+
Results for the best source models RN152 and DN201 against unsecured target models are reported in Table 3. The proposed SGM attack outperforms existing methods by a large margin consistently against different target models. Particularly, for transfer $\mathrm { D N } 2 0 1 \mathrm { S E } 1 5 4$ (a recent state-of-the-art DNN with only $2 . 2 5 1 \%$ top-5 error on ImageNet), SGM achieves a success rate of $7 2 . 0 3 \%$ , which is $> 7 \%$ and $> 1 0 \%$ higher than MI and DI respectively.
|
| 177 |
+
|
| 178 |
+
Combining with Existing Methods. We further demonstrate that the adversarial transferability of skip connections can be exploited in combination with existing techniques. The experiments are conducted on DN201 (the best source model in the above multi-step experiments), and TI attack is excluded as it was originally proposed against secured models and demonstrates limited improvement over PGD against unsecured models. The results are reported in Table $4 ^ { * }$ . The transferability of MI and DI is improved remarkably of $1 1 . 9 8 \% \sim 2 1 . 9 8 \%$ by SGM. When combined with both MI and DI, SGM improves the state-of-the-art $\left( \mathrm { M I + D I } \right)$ transferability by a huge margin consistently against all target models. In particular, SGM pushes the new state-of-the-art to at least $8 0 . 5 2 \%$ which previously was only $71 \%$ . This illustrates that skip connections can be easily manipulated to craft highly transferable attacks against many state-of-the-art DNN models.
|
| 179 |
+
|
| 180 |
+
Table 4: Combined with existing methods: the success rates $( \% )$ of attacks crafted on source model DN201 against 7 unsecured target models. The best results are in bold and $^ +$ indicates improvement.
|
| 181 |
+
|
| 182 |
+
<table><tr><td>Attack\Target</td><td>VGG19</td><td>RN152</td><td>DN201</td><td>SE154</td><td>IncV3</td><td>IncV4</td><td>IncRes</td></tr><tr><td>MI</td><td>75.09</td><td>76.39</td><td>99.84</td><td>64.38</td><td>59.62</td><td>54.85</td><td>50.05</td></tr><tr><td>MI+SGM DI</td><td>+12.01 78.11</td><td>+13.24 78.18</td><td>99.52 99.81</td><td>+17.16 61.75</td><td>+21.88 60.04</td><td>+15.57 56.15</td><td>+18.35 49.00</td></tr><tr><td>DI+SGM</td><td>+12.28</td><td>+13.76</td><td>99.52</td><td>+20.92</td><td>+17.66</td><td>+15.78</td><td>+20.20</td></tr><tr><td>MI+DI</td><td>87.16</td><td>87.28</td><td>99.76</td><td>79.80</td><td>76.68</td><td>75.20</td><td>71.05</td></tr><tr><td>MI+DI+SGM</td><td>93.00</td><td>93.92</td><td>99.42</td><td>89.86</td><td>85.72</td><td></td><td>80.50</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>81.23</td><td></td></tr></table>
|
| 183 |
+
|
| 184 |
+
Table 5: Transferability against secured models: the success rates $\% \pm$ std over 5 random runs) of multi-step attacks crafted on RN152 and DN201 source models against 3 secured models. The best results are in bold.
|
| 185 |
+
|
| 186 |
+
<table><tr><td>Source</td><td>Attack</td><td>IncV3ens3</td><td>IncVens4</td><td>IncResens3</td></tr><tr><td rowspan="2">RN152</td><td>PGD TI</td><td>12.47±1.27 45.36±0.97</td><td>10.72±1.37 45.81±0.93</td><td>6.97±0.71 38.19±0.81</td></tr><tr><td>MI DI</td><td>24.20±1.15 28.48±1.21</td><td>22.04±0.98 24.19±1.22</td><td>16.10±0.56</td></tr><tr><td rowspan="2"></td><td>SGM</td><td>31.57±0.55</td><td>27.77±0.47</td><td>17.31±0.77 20.02±0.66</td></tr><tr><td>TI+SGM</td><td>52.62±0.40</td><td>52.80±0.79</td><td>43.96±0.62</td></tr><tr><td rowspan="2"></td><td>PGD TI</td><td>18.16±0.56</td><td>15.30±0.62</td><td>10.40±0.49</td></tr><tr><td>MI</td><td>42.76±0.91</td><td>42.01±0.79</td><td>34.28±0.88</td></tr><tr><td rowspan="4">DN201</td><td>DI</td><td>31.79±0.83</td><td>28.21±0.15</td><td>20.60±0.38</td></tr><tr><td></td><td>34.84±1.35</td><td>29.23±0.83</td><td>21.64±0.80</td></tr><tr><td>SGM</td><td>41.45±0.30</td><td>37.85±0.22</td><td>29.41±0.02</td></tr><tr><td>TI+SGM</td><td>46.11±1.23</td><td>47.38±0.89</td><td>39.32±0.80</td></tr></table>
|
| 187 |
+
|
| 188 |
+
# 4.2 TRANSFERABILITY AGAINST ROBUSTLY TRAINED MODELS
|
| 189 |
+
|
| 190 |
+
The success rates of our SGM and other baseline methods against the 3 secured target models are reported in Table 5. Overall, with translation adaptation specifically designed for evading adversarially trained models, TI achieves the best standalone transferability, while SGM is the second best with higher success rates than either PGD, MI or DI. When combined with TI, SGM also improves the TI attack by a considerable margin across all transfer scenarios. This indicates that, although manipulating the skip connections alone may not sufficient to attack secured models, it still can make existing attacks more powerful. One interesting observation is that attacks crafted here on RN152 are more transferable than those crafted on DN201, which is quite the opposite to attacking unsecured models.
|
| 191 |
+
|
| 192 |
+
# 4.3 A CLOSER LOOK AT SGM
|
| 193 |
+
|
| 194 |
+
In this part, we conduct more experiments to investigate the gradient decay factor of our proposed SGM, and explore the potential use of SGM for ensemble-based attacks and white-box attacks.
|
| 195 |
+
|
| 196 |
+
Effect of Residual Gradient Decay $\gamma$ . We test the transferability of our proposed SGM with varying decay parameter $\gamma \in \ [ 0 . 1 , 1 . 0 ]$ , where $\gamma = 1 . 0$ means no decay on the residual gradients. The attacks are crafted by 10-step SGM on 5000 random ImageNet validation images. The results against 3 target models (VGG19, SE154 and IncV3) are illustrated in Figure 3. As can be observed, the trends are very consistent against different target models. On DenseNet source models, decreasing decay parameter (increasing decay strength) tends to improve transferability until it exceeds a certain threshold, e.g., $\gamma = 0 . 5$ . This is because the decay encourages the attack to focus on more transferable low-level information, however, it becomes less sufficient if all high-level class-relevant information is ignored. On ResNet source models, decreasing decay parameter can constantly improve transferability for $\gamma \geq 0 . 2$ . Compared to DenseNet source models, ResNets require more decay on the residual gradients. Recalling that skip connections reveal more transferable information of the source model, ResNets require more penalty on the residual gradients to increase the importance of skip gradients that reveal more transferable information of the source model.
|
| 197 |
+
|
| 198 |
+

|
| 199 |
+
Figure 3: Parameter tuning: the success rates of black-box attacks crafted by 10-step SGM with varying decay parameter $\gamma \in [ 0 . 1 , 1 . 0 ]$ . The solid and dash curves represent results on ResNet and DenseNet source models respectively.
|
| 200 |
+
|
| 201 |
+
Table 6: Multi-step transferability of ensemble-based attack: the success rates ( $\%$ ±std over 5 random runs) of multi-step attacks crafted by different methods on an ensemble of 3 source models (e.g. RN34, RN152 and DN201) against 7 unsecured target models. The best results are in bold.
|
| 202 |
+
|
| 203 |
+
<table><tr><td>Source</td><td>Attack</td><td>VGG19</td><td>RN152</td><td>DN201</td><td>SE154</td><td>IncV3</td><td>IncV4</td><td>IncRes</td></tr><tr><td rowspan="2">RN34</td><td>PGD</td><td>86.69±0.20</td><td>99.99±0.01</td><td>99.99±0.02</td><td>69.65±0.71</td><td>65.95±0.35</td><td>59.30±0.32</td><td>53.91±0.40</td></tr><tr><td>TI</td><td>84.35±0.21</td><td>99.59±0.11</td><td>99.77±0.06</td><td>571.67±0.19</td><td>67.22±0.82</td><td></td><td>66.02±0.66 56.83±0.89</td></tr><tr><td>+ RN152</td><td>MI</td><td>92.86±0.19</td><td>99.91±0.04</td><td>99.91±0.06</td><td>86.11±0.38</td><td>83.25±0.35</td><td>79.25±1.16</td><td>76.53±0.66</td></tr><tr><td>+</td><td>DI</td><td>96.34±0.23</td><td>99.84±0.20</td><td>99.84±0.20</td><td>89.72±0.52</td><td>87.53±0.29</td><td>85.04±0.75</td><td>81.11±0.44</td></tr><tr><td rowspan="2">DN201</td><td>SGM</td><td>97.36±0.17</td><td>99.87±0.07</td><td>99.86±0.09</td><td>90.40±0.26</td><td>87.86±0.51</td><td>82.97±0.71</td><td>80.93±0.55</td></tr><tr><td>DI+SGM</td><td>98.65±0.08</td><td>99.84±0.04</td><td>99.86±0.04</td><td>94.36±0.19</td><td>93.08±0.41</td><td>89.56±0.07</td><td>88.27±0.43</td></tr></table>
|
| 204 |
+
|
| 205 |
+
Table 7: Transferability of ensemble-based attack against secured models: the success rates (%±std over 5 random runs) of black-box attacks crafted on an ensemble of 3 source models (e.g. RN34, RN152 and DN201). The best results are in bold.
|
| 206 |
+
|
| 207 |
+
<table><tr><td>Source</td><td>Attack</td><td>IncV3ens3</td><td>IncVens4</td><td>IncResens3</td></tr><tr><td rowspan="3">RN34 +</td><td>PGD</td><td>37.63±0.37</td><td>32.69±0.62</td><td>23.49±0.55</td></tr><tr><td>TI</td><td>75.04±0.50</td><td>75.94±0.63</td><td>66.24±0.45</td></tr><tr><td>MI</td><td>54.68±0.27</td><td>50.24±0.48</td><td>39.27±0.33</td></tr><tr><td>RN152 +</td><td>DI</td><td>65.29±0.31</td><td>57.48±0.45</td><td>46.41±0.42</td></tr><tr><td rowspan="2">DN201</td><td>SGM</td><td>66.08±0.42</td><td>62.22±0.73</td><td>51.16±0.12</td></tr><tr><td>TI+SGM</td><td>87.65±1.00</td><td>85.11±0.27</td><td>77.75±0.41</td></tr></table>
|
| 208 |
+
|
| 209 |
+
As for the selection of $\gamma$ under a scenario without knowing the target model, from Figure 3 and Appendix C, we can see that the influence of $\gamma$ is more related to the source model rather than the target model, that is, given a source model, the best $\gamma$ against different target models are generally the same. This makes the selection of $\gamma$ quite straightforward: choosing the best $\gamma$ on the source model(s). For instance, in Figure 3, suppose the unknown target model is SE154 (middle figure), the adversary could tune $\gamma$ on source model DN201 to attack VGG19 (left figure) and find the best $\gamma = 0 . 5$ . The attacks crafted on DN201 with $\gamma = 0 . 5$ indeed achieved the best success rate against the SE154 target model (and other target models).
|
| 210 |
+
|
| 211 |
+
Ensemble-based Attacks. It has been shown that attacking multiple source models simultaneously can improve the transferability of the crafted adversarial examples, and is commonly adopted in practice. We follow the ensemble-based strategy (Liu et al., 2017) and craft attacks on an ensemble of RN34, RN152 and DN201. According to the discussion above, we select the best $\gamma$ individually for each source model: choose $\gamma$ for source RN34 and RN152 against target DN201, and $\gamma$ for source DN201 against target RN152. The success rates (transferability) against 7 unsecured models and 3 secured models are reported in Table 6 and Table 7 respectively. Similar to the results of single source model attacks, against unsecured target models, SGM has a similar standalone performance with DI, better than the others (except the two “white-box” scenarios against RN152 and DN201). When combined with other methods, e.g. DI, it improves the success rates again by a large margin.
|
| 212 |
+
|
| 213 |
+

|
| 214 |
+
Figure 4: White-box success rate for FGSM versus SGM. In (b) and (c), each color corresponds to one model, with FGSM is represented by solid curve and SGM is represented by dashed curve.
|
| 215 |
+
|
| 216 |
+
Against secured models, SGM achieves the second best standalone transferability, with TI is still the best. When combined with TI, SGM improves the success rate by $\sim 1 0 \%$ consistently against all secured target models. In particular, against $\mathrm { I n c V } 3 _ { e n s 3 }$ , $\mathrm { T I } { + } \mathrm { S G M }$ achieves higher success rate $( 8 7 . 6 5 \% )$ than reported in (Dong et al., 2019) $( 8 4 . 8 \% )$ , even if only 3 source models are used here and the source models (e.g. RN34, RN152 and DN201) are all of different architecture to IncV3 target model ((Dong et al., 2019) uses 6 source models including even the IncV3 model). From all aspects analyzed above, the existence of skip connections makes transferable attacks much easier to craft in practice.
|
| 217 |
+
|
| 218 |
+
Improving Weak White-box Attacks. In addition to the black-box transferability, we next show that SGM can also improve the weak (one-step) white-box attack FGSM. Note that the one-step version of SGM is equivalent to FGSM plus residual gradient decay. Our experiments are conducted on the 8 source models, and the white-box success rates under maximum $L _ { \infty }$ perturbation $\epsilon = 8$ (a typical white-box setting) are shown in Figure 4a. As can be observed, using SGM can help improve the adversarial strength (i.e., higher success rate). We then vary the maximum perturbation $\epsilon \dot { \in } [ 1 , 6 4 ]$ , and show the results on ResNet and DenseNet models separately in Figure 4b and Figure $_ \mathrm { 4 c }$ . Compared to FGSM, SGM can always give better adversarial strength, except when $\epsilon$ is extremely small $( \epsilon \leq 2 )$ ). When the perturbation space becomes infinitely small, the loss landscape within the space becomes flat and the gradient points to the optimal perturbation direction. However, when the perturbation space expands, one-step gradient becomes less accurate due to changes in the loss landscape (success rate decreases as $\epsilon$ increases from 4 to 16), and in this case, the skip gradient which contains more low-level information is more reliable than the residual gradient (the improvement is more significant for $\epsilon \in [ 4 , 1 6 ]$ ). Another interesting observation is that adversarial strength decreases when the model becomes more complex from RN18 to RN152, or DN121 to DN201. This is likely because the loss landscape of complex models is steeper than shallow models, making one-step gradient less reliable.
|
| 219 |
+
|
| 220 |
+
# 5 CONCLUSION
|
| 221 |
+
|
| 222 |
+
In this paper, we have identified a surprising property of the skip connections used by many state-ofthe-art ResNet-like neural networks, that is, they can be easily used to generate highly transferable adversarial examples. To demonstrate this architectural “weakness”, we proposed the Skip Gradient Method (SGM) to craft adversarial examples using more gradients from the skip connections rather than the residual ones, via a decay factor on gradients. We conducted a series of transfer attack experiments with 8 source models and 10 target models including 7 unsecured and 3 secured models, and showed that attacks crafted by SGM have significantly better transferability than those crafted by existing methods. When combined with existing techniques, SGM can also boost state-of-the-art transferability by a huge margin. We believe the high adversarial transferability of skip connections is due to the fact that they expose extra low-level information which is more transferable across different DNNs. Our findings in this paper not only remind researchers in adversarial research to pay attention to the architectural vulnerability of DNNs, but also raise new challenges for secure DNN architecture design.
|
| 223 |
+
|
| 224 |
+
# ACKNOWLEDGEMENT
|
| 225 |
+
|
| 226 |
+
Shu-Tao Xia is supported in part by National Key Research and Development Program of China under Grant 2018YFB1800204, National Natural Science Foundation of China under Grant 61771273, R&D Program of Shenzhen under Grant JCYJ20180508152204044, and research fund of PCL Future Regional Network Facilities for Large-scale Experiments and Applications (PCL2018KP001).
|
| 227 |
+
|
| 228 |
+
# REFERENCES
|
| 229 |
+
|
| 230 |
+
Yang Bai, Yan Feng, Yisen Wang, Tao Dai, Shu-Tao Xia, and Yong Jiang. Hilbert-based generative defense for adversarial examples. In ICCV, 2019.
|
| 231 |
+
|
| 232 |
+
Arjun Nitin Bhagoji, Warren He, Bo Li, and Dawn Song. Practical black-box attacks on deep neural networks using efficient query mechanisms. In ECCV, 2018.
|
| 233 |
+
|
| 234 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In S&P, 2017.
|
| 235 |
+
|
| 236 |
+
Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In AISec, 2017.
|
| 237 |
+
|
| 238 |
+
Pin-Yu Chen, Yash Sharma, Huan Zhang, Jinfeng Yi, and Cho-Jui Hsieh. Ead: elastic-net attacks to deep neural networks via adversarial examples. In AAAI, 2018.
|
| 239 |
+
|
| 240 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
|
| 241 |
+
|
| 242 |
+
Gavin Weiguang Ding, Luyu Wang, and Xiaomeng Jin. AdverTorch v0.1: An adversarial robustness toolbox based on pytorch. arXiv preprint arXiv:1902.07623, 2019.
|
| 243 |
+
|
| 244 |
+
Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In CVPR, 2018.
|
| 245 |
+
|
| 246 |
+
Yinpeng Dong, Tianyu Pang, Hang Su, and Jun Zhu. Evading defenses to transferable adversarial examples by translation-invariant attacks. In CVPR, 2019.
|
| 247 |
+
|
| 248 |
+
Ivan Evtimov, Kevin Eykholt, Earlence Fernandes, Tadayoshi Kohno, Bo Li, Atul Prakash, Amir Rahmati, and Dawn Song. Robust physical-world attacks on deep learning models. In CVPR, 2018.
|
| 249 |
+
|
| 250 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2014.
|
| 251 |
+
|
| 252 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016a.
|
| 253 |
+
|
| 254 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In ECCV, 2016b.
|
| 255 |
+
|
| 256 |
+
Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In CVPR, 2018.
|
| 257 |
+
|
| 258 |
+
Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In CVPR, 2017.
|
| 259 |
+
|
| 260 |
+
Qian Huang, Isay Katsman, Horace He, Zeqi Gu, Serge Belongie, and Ser-Nam Lim. Enhancing adversarial example transferability with an intermediate level attack. In ICCV, 2019.
|
| 261 |
+
|
| 262 |
+
Andrew Ilyas, Logan Engstrom, Anish Athalye, and Jessy Lin. Black-box adversarial attacks with limited queries and information. In ICML, 2018.
|
| 263 |
+
|
| 264 |
+
Nathan Inkawhich, Wei Wen, Hai Helen Li, and Yiran Chen. Feature space perturbations yield more transferable adversarial examples. In CVPR, 2019.
|
| 265 |
+
|
| 266 |
+
Linxi Jiang, Xingjun Ma, Shaoxiang Chen, James Bailey, and Yu-Gang Jiang. Black-box adversarial attacks on video recognition models. In ACM MM, 2019.
|
| 267 |
+
|
| 268 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. In ICLR, 2016.
|
| 269 |
+
|
| 270 |
+
Yingwei Li, Song Bai, Yuyin Zhou, Cihang Xie, Zhishuai Zhang, and Alan Yuille. Learning transferable adversarial examples via ghost networks. arXiv preprint arXiv:1812.03413, 2018.
|
| 271 |
+
|
| 272 |
+
Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In ICLR, 2017.
|
| 273 |
+
|
| 274 |
+
Xingjun Ma, Bo Li, Yisen Wang, Sarah M Erfani, Sudanthi Wijewickrema, Grant Schoenebeck, Dawn Song, Michael E Houle, and James Bailey. Characterizing adversarial subspaces using local intrinsic dimensionality. In ICLR, 2018.
|
| 275 |
+
|
| 276 |
+
Xingjun Ma, Yuhao Niu, Lin Gu, Yisen Wang, Yitian Zhao, James Bailey, and Feng Lu. Understanding adversarial attacks on deep learning based medical image analysis systems. arXiv preprint arXiv:1907.10456, 2019.
|
| 277 |
+
|
| 278 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In ICLR, 2018.
|
| 279 |
+
|
| 280 |
+
Apostolos Modas, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. Sparsefool: a few pixels make a big difference. In CVPR, 2019.
|
| 281 |
+
|
| 282 |
+
Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In EuroS&P, 2016.
|
| 283 |
+
|
| 284 |
+
Mahmood Sharif, Sruti Bhagavatula, Lujo Bauer, and Michael K Reiter. Accessorize to a crime: Real and stealthy attacks on state-of-the-art face recognition. In CCS, 2016.
|
| 285 |
+
|
| 286 |
+
Carl-Johann Simon-Gabriel, Yann Ollivier, Leon Bottou, Bernhard Scholkopf, and David Lopez- ¨ Paz. First-order adversarial vulnerability of neural networks and input dimension. In ICML, 2019.
|
| 287 |
+
|
| 288 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
|
| 289 |
+
|
| 290 |
+
Jiawei Su, Danilo Vasconcellos Vargas, and Kouichi Sakurai. One pixel attack for fooling deep neural networks. In IEEE Transactions on Evolutionary Computation. IEEE, 2019.
|
| 291 |
+
|
| 292 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2013.
|
| 293 |
+
|
| 294 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
|
| 295 |
+
|
| 296 |
+
Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In AAAI, 2017.
|
| 297 |
+
|
| 298 |
+
Florian Tramer, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick Mc- \` Daniel. Ensemble adversarial training: Attacks and defenses. In ICLR, 2018.
|
| 299 |
+
|
| 300 |
+
Andreas Veit, Michael J Wilber, and Serge Belongie. Residual networks behave like ensembles of relatively shallow networks. In NeurIPS, 2016.
|
| 301 |
+
|
| 302 |
+
Yisen Wang, Xingjun Ma, James Bailey, Jinfeng Yi, Bowen Zhou, and Quanquan Gu. On the convergence and robustness of adversarial training. In ICML, 2019.
|
| 303 |
+
|
| 304 |
+
Yisen Wang, Difan Zou, Jinfeng Yi, James Bailey, Xingjun Ma, and Quanquan Gu. Improving adversarial robustness requires revisiting misclassified examples. In ICLR, 2020.
|
| 305 |
+
|
| 306 |
+
Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan L Yuille. Improving transferability of adversarial examples with input diversity. In CVPR, 2019.
|
| 307 |
+
|
| 308 |
+
Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans-´ formations for deep neural networks. In CVPR, 2017.
|
| 309 |
+
|
| 310 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
|
| 311 |
+
|
| 312 |
+
# A VISUALIZATION OF ADVERSARIAL EXAMPLES CRAFTED BY SGM
|
| 313 |
+
|
| 314 |
+
In this section, we visualize 6 clean images and their corresponding adversarial examples crafted using our SGM on either a ResNet-152 or a DenseNet201 in Figure 5. These visualization results show that the generated adversarial perturbations are human imperceptible.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure 5: Visualization of 6 clean images and their corresponding adversarial examples. The clean images are shown in the top row, adversarial images crafted on ResNet-152 are shown in the middle row, while those crafted on DenseNet-201 are shown in the bottom row. All adversarial images are crafted using our proposed SGM (10-step) under maximum perturbation $\epsilon = 1 6$ .
|
| 318 |
+
|
| 319 |
+
# B COMPARISON WITH PREVIOUSLY PUBLISHED RESULTS
|
| 320 |
+
|
| 321 |
+
In this section, we compare the experimental settings in previous and our works, and discuss some small discrepancies of the baseline performance reported in ours and previous works.
|
| 322 |
+
|
| 323 |
+
Table 8 and 9 summarizes these differences for single-source and ensemble-based attack respectively. Out of all these works (Dong et al., 2018; 2019; Xie et al., 2019), results reported in (Xie et al., 2019) are more complete. Our reported success rate of baseline attacks (e.g. MI and DI) matches that reported in (Xie et al., 2019), sometimes even higher. The slight discrepancy is caused by the difference in experimental settings. Table 10 summarizes the different source models used by baseline attacks, and Table 11 summarizes the difference in dataset, number of test images, input image size, maximum $L _ { \infty }$ perturbation $\epsilon$ , number of attack steps $N$ and attack step size $\alpha$ . Compared to $2 9 9 \times 2 9 9$ image size, here we use a more standard image size $2 2 4 \times 2 2 4$ on ImageNet. The use of smaller input size may reduce the effectiveness of existing attacks (Simon-Gabriel et al., 2019).
|
| 324 |
+
|
| 325 |
+
In another work by Liu et al. (2017), $81 \%$ success rate was reported for optimization-based attack crafted on ResNet-152 against target VGG16, which is higher than our $6 5 . 5 2 \%$ from ResNet-152 to VGG19. This is because they did not restrict the maximum perturbation $\epsilon$ . The root mean square deviation (RMSD) of their attacks is 22.83,which indicates that many pixels are perturbed more than 16 pixel values. In our experiments, the RMSD is 6.29 for PGD, 7.71 for SGM, and 12.55 for MI. This appears to be another reason for the performance discrepancy. Note that the advantage of bounded small perturbation is increasing imperceptibility to human observers (see Figure 5).
|
| 326 |
+
|
| 327 |
+
Table 8: Previously reported attack success rates $( \% )$ of baseline single-source attacks against 6 target models. “-” means no results were reported.
|
| 328 |
+
|
| 329 |
+
<table><tr><td>Reference</td><td>Attack</td><td>IncV3</td><td>IncV4</td><td>IncRes</td><td>IncV3ens3</td><td>IncV3ens4</td><td>IncResens3</td></tr><tr><td rowspan="3">Dong et al. (2018)</td><td>FGSM</td><td>35.0</td><td>28.2</td><td>27.5</td><td>14.6</td><td>13.2</td><td>7.5</td></tr><tr><td>BIM</td><td>26.7</td><td>22.7</td><td>21.2</td><td>9.3</td><td>8.9</td><td>6.2</td></tr><tr><td>MI</td><td>53.6</td><td>48.9</td><td>44.7</td><td>22.1</td><td>21.7</td><td>12.9</td></tr><tr><td rowspan="3">Dong et al. (2019)</td><td>FGSM</td><td>-</td><td>-</td><td>-</td><td>20.2</td><td>17.7</td><td>9.9</td></tr><tr><td>MI</td><td>=</td><td>1</td><td>-</td><td>25.1</td><td>23.7</td><td>13.3</td></tr><tr><td>DI</td><td>-</td><td>-</td><td>-</td><td>40.5</td><td>36.0</td><td>24.1</td></tr><tr><td rowspan="4">Xie et al. (2019)</td><td>FGSM</td><td>34.4</td><td>28.50</td><td>27.1</td><td>12.4</td><td>11.0</td><td>6.0</td></tr><tr><td>PGD</td><td>20.8</td><td>17.2</td><td>14.9</td><td>5.4</td><td>4.6</td><td>2.8</td></tr><tr><td>MI</td><td>50.1</td><td>44.1</td><td>42.2</td><td>18.2</td><td>15.2</td><td>9.0</td></tr><tr><td>DI</td><td>53.8</td><td>49.0</td><td>44.8</td><td>13.0</td><td>11.1</td><td>6.9</td></tr><tr><td rowspan="4">Ours</td><td>FGSM</td><td>26.56</td><td>21.03</td><td>19.10</td><td>1</td><td>-</td><td>1</td></tr><tr><td>PGD</td><td>26.56</td><td>21.03</td><td>19.10</td><td>12.47</td><td>10.72</td><td>6.97</td></tr><tr><td>MI</td><td>50.22</td><td>43.32</td><td>41.71</td><td>24.20</td><td>22.04</td><td>16.10</td></tr><tr><td>DI</td><td>53.95</td><td>47.16</td><td>43.47</td><td>34.84</td><td>29.23</td><td>21.64</td></tr></table>
|
| 330 |
+
|
| 331 |
+
Table 9: Previously reported attack success rates $( \% )$ of ensemble-based baseline attacks against 6 target models. “-” means no results were reported.
|
| 332 |
+
|
| 333 |
+
<table><tr><td>Reference</td><td>Attack</td><td>IncV3</td><td>IncV4</td><td>IncRes</td><td>IncV3ens3</td><td>IncV3ens4</td><td>IncResens3</td></tr><tr><td rowspan="3">Dong et al. (2018)</td><td>FGSM</td><td>45.7</td><td>39.9</td><td>38.8</td><td>15.4</td><td>15.0</td><td>6.4</td></tr><tr><td>BIM</td><td>72.1</td><td>61.0</td><td>54.4</td><td>18.6</td><td>18.7</td><td>9.9</td></tr><tr><td>MI</td><td>87.9</td><td>81.2</td><td>76.5</td><td>37.6</td><td>40.3</td><td>23.3</td></tr><tr><td rowspan="4">Dong et al. (2019)</td><td>FGSM</td><td>-</td><td>-</td><td>-</td><td>27.5</td><td>23.7</td><td>13.4</td></tr><tr><td>MI</td><td></td><td>1</td><td>1</td><td>50.5</td><td>48.3</td><td>32.8</td></tr><tr><td>DI</td><td>-</td><td>-</td><td>-</td><td>66.0</td><td>63.3</td><td>45.9</td></tr><tr><td>TI+DI</td><td>-</td><td>-</td><td>-</td><td>84.8</td><td>82.7</td><td>78.0</td></tr><tr><td rowspan="4">Xie et al. (2019)</td><td>PGD</td><td>43.7</td><td>36.4</td><td>33.3</td><td>12.9</td><td>15.1</td><td>8.8</td></tr><tr><td>MI</td><td>69.9</td><td>67.9</td><td>64.1</td><td>36.3</td><td>35.0</td><td>30.4</td></tr><tr><td>DI</td><td>71.4</td><td>65.9</td><td>64.6</td><td>22.8</td><td>26.1</td><td>15.8</td></tr><tr><td>DI+MI</td><td>80.7</td><td>80.6</td><td>80.7</td><td>44.6</td><td>44.5</td><td>39.4</td></tr><tr><td rowspan="5">Ours</td><td>PGD</td><td>65.95</td><td>59.30</td><td>53.91</td><td>37.63</td><td>32.69</td><td>23.49</td></tr><tr><td>MI</td><td>83.25</td><td>79.25</td><td>76.53</td><td>54.68</td><td>50.24</td><td>39.27</td></tr><tr><td>DI</td><td>87.53</td><td>85.04</td><td>81.11</td><td>65.29</td><td>57.48</td><td>46.41</td></tr><tr><td>DI+SGM</td><td>93.08</td><td>89.56</td><td>88.27</td><td>80.14</td><td>76.52</td><td>66.40</td></tr><tr><td>TI+SGM</td><td>-</td><td>-</td><td>-</td><td>87.65</td><td>85.11</td><td>77.75</td></tr></table>
|
| 334 |
+
|
| 335 |
+
Table 10: Source models used by existing single-source and ensemble-based black-box attacks. “Hold-out” refers to the hold-out target model from the group, with all remaining models are used as source models. Group 1 consists of ResNet-v2-152, IncV3, IncV4 and IncRes, while group 2 consists of ResNet-v2-152, IncV3, IncV4, IncRes, $\mathrm { I n c V } 3 _ { e n s 3 }$ , $\mathrm { I n c V } 3 _ { e n s 4 }$ and $\mathrm { I n c R e s } _ { e n s 3 }$ .
|
| 336 |
+
|
| 337 |
+
<table><tr><td>Reference</td><td>Single-source attack</td><td>Ensemble-basedattack</td></tr><tr><td>Dong et al. (2018)</td><td>ResNet-v2-152</td><td>hold-out from group 1 or group 2</td></tr><tr><td>Dong et al. (2019)</td><td>ResNet-v2-152</td><td>hold-out from group 1</td></tr><tr><td>Xie et al. (2019)</td><td>ResNet-v2-152</td><td>hold-out from group 2</td></tr><tr><td>Ours</td><td>RN152</td><td>RN34+RN152+DN201</td></tr></table>
|
| 338 |
+
|
| 339 |
+
For proper implementation, we use open-source codes and pretrained models for our experiments, e.g., AdverTorch (Ding et al., 2019) for FGSM, PGD and MI, and source/target models from two GitHub repositories†‡§ for all models. We reproduced DI and TI in PyTorch.
|
| 340 |
+
|
| 341 |
+
Table 11: Difference in experimental settings of our work compared to previous works.“NeurIPS 2017” indicates the dataset used for NeurIPS 2017 adversarial competition. : maximum per-pixel perturbation; $N$ : number of attack steps; $\alpha$ : attack step size.
|
| 342 |
+
|
| 343 |
+
<table><tr><td>Reference</td><td>Dataset</td><td>Number</td><td>Input size</td><td>E</td><td>N</td><td>α</td></tr><tr><td>Dong et al. (2018)</td><td>ImageNet</td><td>1000</td><td>299 × 299</td><td>16</td><td>10</td><td>1.6</td></tr><tr><td>Dong et al. (2019)</td><td>NeurIPS 2017</td><td>1000</td><td>299 × 299</td><td>16</td><td>10</td><td>1.6</td></tr><tr><td>Xie et al. (2019)</td><td>ImageNet</td><td>5000</td><td>299×299</td><td>15</td><td>19</td><td>1.0</td></tr><tr><td>Ours</td><td>ImageNet</td><td>5000</td><td>224×224</td><td>16</td><td>10/20</td><td>2.0</td></tr></table>
|
| 344 |
+
|
| 345 |
+
# C TRANSFERABILITY OF DECAY PARAMETER $\gamma$
|
| 346 |
+
|
| 347 |
+
In this section, we study the “transferability” of decay parameter $\gamma$ across different target models. RN152 and DN201 are used as the source model, and the target model are varying to observe trends. As indicated in Figure 6, all black-box target models share the same best selection of $\gamma$ , which makes $\gamma$ selection quite simple. Even if the true target model is unknown, the adversary can tune the gamma for a resnet-like neural network through another model and obtain the best selection as well.
|
| 348 |
+
|
| 349 |
+

|
| 350 |
+
Figure 6: “Transferability” of decay parameter: the success rates of black-box attacks crafted by 10-step SGM with varying decay parameter $\gamma \in \ [ 0 . 1 , 1 . 0 ]$ . The curves represent results against different target models respectively.
|
md/train/BJwFrvOeg/BJwFrvOeg.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A NEURAL KNOWLEDGE LANGUAGE MODEL
|
| 2 |
+
|
| 3 |
+
Sungjin $\mathbf { A } \mathbf { h } \mathbf { n } ^ { 1 }$ , Heeyoul Choi2∗, Tanel Parnamaa ¨ 3, & Yoshua Bengio4 1,3,4Universite de Montr ´ eal, ´ 2Handong Global University, 4CIFAR Senior Fellow {1sjn.ahn, 2heeyoul,3tanel.parnamaa}@gmail.com {4yoshua.bengio}@umontreal.ca
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Current language models have significant limitations in their ability to encode and decode factual knowledge. This is mainly because they acquire such knowledge based on statistical co-occurrences, even if most of the knowledge words are rarely observed named entities. In this paper, we propose a Neural Knowledge Language Model (NKLM) which combines symbolic knowledge provided by a knowledge graph with the RNN language model. The model predicts whether the word to generate has an underlying fact or not. Then, a word is either generated from the vocabulary or copied from the description of the predicted fact. We train and test the model on a new dataset, WikiFacts. In experiments, we show that the NKLM significantly improves the perplexity while generating a much smaller number of unknown words. In addition, we demonstrate that the sampled descriptions include named entities which used to be the unknown words in RNN language models.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Kanye West, a famous $<$ unknown $>$ and the husband of <unknown>, released his latest album <unknown $>$ in $<$ <unknown>.
|
| 12 |
+
|
| 13 |
+
A core purpose of language is to communicate knowledge. Thus, for human-level language understanding, it is important for a language model to take advantage of knowledge. Although traditional language models are good at capturing statistical co-occurrences of entities as long as they are observed frequently in a corpus (e.g., words like verbs, pronouns, and prepositions), they are in general limited in their ability to encode or decode knowledge, which is often represented by named entities such as person names, place names, years, etc. (as shown in the above example sentence of Kanye West.) When trained with a very large corpus, traditional language models have demonstrated to some extent the ability to encode/decode knowledge (Vinyals & Le, 2015; Serban et al., 2015). However, we claim that simply feeding a larger corpus into a bigger model hardly results in a good knowledge language model.
|
| 14 |
+
|
| 15 |
+
The primary reason for this is the difficulty in learning good representations for rare or unknown words because these are a majority of the knowledge-related words. In particular, for applications such as question answering (Iyyer et al., 2014; Weston et al., 2016; Bordes et al., 2015) and dialogue modeling (Vinyals & Le, 2015; Serban et al., 2015), these words are of our main interest. Specifically, in the recurrent neural network language model (RNNLM) (Mikolov et al., 2010) the computational complexity is linearly dependent on the number of vocabulary words. Thus, including all words of a language is computationally prohibitive. Instead, we typically fill our vocabulary with a limited number of frequent words and regard all the other words as the unknown (UNK) word. Even if we can include a large number of words in the vocabulary, according to Zipf’s law, a large portion of the words will be rarely observed in the corpus and thus learning good representations for these words remains a problem.
|
| 16 |
+
|
| 17 |
+
The fact that languages and knowledge can change over time also makes it difficult to simply rely on a large corpus. Media produce an endless stream of new knowledge every day (e.g., the results of baseball games played yesterday) that is even changing over time (e.g., “the current president of the
|
| 18 |
+
|
| 19 |
+
United States is ”). Furthermore, a good language model should exercise some level of reasoning. For example, it may be possible to observe several occurrences of Barack Obama’s year of birth in a large corpus and thus the model may be able to predict it. However, after seeing mentions of his year of birth, presented with a simple reformulation of that piece of knowledge into a sentence such as “Barack Obama’s age is ”, one would not expect current language models to handle the required amount of reasoning in order to predict the next word (i.e. the age) easily. However, a good model should be able to reason the answer from this context1.
|
| 20 |
+
|
| 21 |
+
In this paper, we propose a Neural Knowledge Language Model (NKLM) as a step towards addressing the limitations of traditional language modeling when it comes to exploiting factual knowledge. In particular, we incorporate symbolic knowledge provided by a knowledge graph (Nickel et al., 2015) into the RNNLM. A knowledge graph (KG) is a collection of facts which have a form of (subject, relationship, object). We observe particularly the following properties of KGs that make the connection to the language model sensible. First, facts in KGs are mostly about rare words in text corpora. KGs are managed and updated in a similar way that Wikipedia pages are managed to date. The KG embedding methods (Bordes et al., 2011; 2013) provide distributed representations for the entities in the KG. The graph can be traversed for reasoning (Gu et al., 2015). Finally, facts come along with textual representations which we call the fact description and take advantage of here.
|
| 22 |
+
|
| 23 |
+
There are a few differences between the NKLM and the traditional RNNLM. First, we assume that a word generation is either based on a fact or not. Thus, at each time step, before predicting a word, we predict whether the word to generate has an underlying fact or not. As a result, our model provides the predictions over facts in a topic in addition to the word predictions. Similarly to how context information of previous words flows through the hidden states in the RNNLM, in the NKLM the previous information on both facts and words flow through an RNN and provide richer context. Second, the model has two ways to generate the next word. One option is to generate a “vocabulary word” from the vocabulary softmax as is in the RNNLM. The other option is to generate a “knowledge word” by copying a word contained in the description of the predicted fact. Considering that the fact description is often short and consists of out-of-vocabulary words, we predict the position of the word to copy within the fact description. This knowledge-copy mechanism makes it possible to generate words which are not in the predefined vocabulary. Thus, it does not require to learn explicit embeddings of the words to generate, and consequently resolves the rare/unknown word problem. Lastly, the NKLM can immediately adapt to adding or modifying knowledge because the model learns to predict facts, which can easily be modified without having to retrain the model.
|
| 24 |
+
|
| 25 |
+
Training the above model in a supervised way requires to align words with facts. To this end, we introduce a new dataset, called WikiFacts. For each topic in the dataset, a set of facts from the Freebase KG (Bollacker et al., 2008) and a Wikipedia description of the same topic is provided along with the alignment information. This alignment is done automatically by performing string matching between the fact description and the Wikipedia description.
|
| 26 |
+
|
| 27 |
+
# 2 RELATED WORK
|
| 28 |
+
|
| 29 |
+
There have been remarkable advances in language modeling research based on neural networks (Bengio et al., 2003; Mikolov et al., 2010). In particular, the RNNLMs are interesting for their ability to take advantage of longer-term temporal dependencies without a strong conditional independence assumption. It is especially noteworthy that the RNNLM using the Long Short-Term Memory (LSTM) (Hochreiter & Schmidhuber, 1997) has recently advanced to the level of outperforming carefully-tuned traditional n-gram based language models (Jozefowicz et al., 2016).
|
| 30 |
+
|
| 31 |
+
There have been many efforts to speed up the language models so that they can cover a larger vocabulary. These methods approximate the softmax output using hierarchical softmax (Morin & Bengio, 2005; Mnih & Hinton, 2009), importance sampling (Jean et al., 2015), noise contrastive estimation (Mnih & Teh, 2012), etc. Although helpful to mitigate the computational problem, these approaches still suffer from the statistical problem due to rare or unknown words. Having the UNK word as the output of a generative language model is also inconvenient (e.g, dialogue system).
|
| 32 |
+
|
| 33 |
+
To help deal with the rare/unknown word problem, the pointer networks (Vinyals et al., 2015) have been adopted to implement the copy mechanism (Gulcehre et al., 2016; Gu et al., 2016) and applied to machine translation and text summarization. With this approach, the (unknown) word to copy from the context sentence is inferred from neighboring words. However, because in our case the context can be very short and often contains no known relevant words (e.g., person names), we cannot use the existing approach directly.
|
| 34 |
+
|
| 35 |
+
Our knowledge memory is also related to the recent literature on neural networks with external memory (Bahdanau et al., 2014; Weston et al., 2015; Graves et al., 2014). In Weston et al. (2015), given simple sentences as facts which are stored in the external memory, the question answering task is studied. In fact, the tasks that the knowledge-based language model aims to solve (i.e. predict the next word) can be considered as a fill-in-the-blank type of question answering. The idea of jointly using Wikipedia and knowledge graphs has also been used in the context of enriching word embedding (Celikyilmaz et al., 2015; Long et al., 2016).
|
| 36 |
+
|
| 37 |
+
# 3 MODEL
|
| 38 |
+
|
| 39 |
+
# 3.1 PRELIMINARY
|
| 40 |
+
|
| 41 |
+
A topic2 $k$ in a set of entities $\mathcal { E }$ is associated with topic knowledge $\mathcal { F } _ { k }$ (e.g., from Freebase) and topic description $W _ { k }$ (e.g., from Wikipedia). Topic knowledge $\mathcal { F } _ { k }$ is a set of facts $\{ a ^ { k , 1 } , a ^ { k , 2 } , \ldots , a ^ { k , | \mathcal { F } _ { k } | } \}$ where each fact $a$ is a triple of subject $\in \mathcal { E }$ , relationship, and object $\in \mathcal { E }$ , e.g., (Barack Obama, Married-To, Michelle Obama). Topic description $W _ { k }$ is a sequence of words $( \bar { w } _ { 1 } ^ { k } , w _ { 2 } ^ { k } , \dots , w _ { | W _ { k } | } ^ { k } )$ describing the topic (e.g., a description of a topic in Wikipedia). Because the subject entities in $\mathcal { F } _ { k }$ are all equal to the topic entity $k ^ { 3 }$ and the words describing relationships can easily be found in the vocabulary, we use the description of the object entity (e.g., Michelle Obama) as our fact description.
|
| 42 |
+
|
| 43 |
+
Given $\mathcal { F } _ { k }$ and $W _ { k }$ , we perform simple string matching between words in $W _ { k }$ and words in the fact descriptions in $\mathcal { F } _ { k }$ and thereby build a sequence of augmented observations $Y _ { k } = \{ y _ { t } ^ { k } =$ $( w _ { t } , a _ { t } , z _ { t } ) \bar \} _ { t = 1 : | W _ { k } | }$ . Here, $w _ { t } \in W _ { k }$ is an observed word, $a _ { t } \in \mathcal { F } _ { k }$ a fact on which the generated word $w _ { t }$ is based, and $z _ { t }$ a binary variable indicating whether $w _ { t }$ is in the vocabulary $\nu$ (including UNK) or not. Because not all words are based on a fact (e.g., words like, is, a, the, have), we introduce a special type of fact, called Not-a-Fact (NaF), and assign NaF to such words.
|
| 44 |
+
|
| 45 |
+
For example, a description “Rogers was born in Latrobe, Pennsylvania in $1 9 2 8 ^ { \circ }$ from a topic Fred Rogers in Wikipedia, is augmented to, $Y = \{ ( w { = } ^ { \cdots } \mathrm { R o g e r s } ^ { \cdots }$ , $a { = } 0 , \ z { = } 0 $ , (“was”, NaF, 1), (“born”, NaF, 1), (“in”, NaF, 1), (“Latrobe”, 42, 0), (“Pennsylvania”, 42, 1), (“in”, NaF, 1), $( ^ { \ast } 1 9 2 8 ^ { \prime \prime } , 8 3 , 0 ) \}$ Here, we use facts on Fred Rogers, $a ^ { 4 2 } =$ (Fred Rogers, Place of Birth, Latrobe Pennsylvania), $a ^ { 8 3 } =$ (Fred Rogers, Year of Birth, 1928), and a special fact $a ^ { 0 } =$ (Fred Rogers, Topic Itself, Fred Rogers) which we define in order to refer to the topic string itself. We also assume here that the words Rogers, Latrobe and 1928 are not in the vocabulary.
|
| 46 |
+
|
| 47 |
+
During the inference and training of topic $k$ , we assume that the topic knowledge $\mathcal { F } _ { k }$ is loaded in the knowledge memory in a form of a matrix $\mathbf { F } _ { k } \in \mathbb { R } ^ { D _ { a } \times | \mathcal { F } _ { k } | }$ where the $i$ -th column is a fact embedding $\mathbf { a } ^ { k , \breve { i } } \in \mathbb { R } ^ { D _ { a } }$ . The fact embedding is the concatenation of subject, relationship, and object embeddings. We obtain these entity embeddings from a preliminary run of a knowledge graph embedding method such as TransE (Bordes et al., 2013). Note that we fix the fact embedding during the training of our model to help the model predict new facts at test time. But, we learn the embedding of the Topic Itself. For notation, to denote the vector representation of any object of our interest, we use bold lowercase characters. For example, the embedding of a word $w _ { t }$ is represented by $\mathbf { w } _ { t } = \mathbf { W } [ w _ { t } ]$ where $\mathbf { W } ^ { D _ { w } \times | \mathcal { V } | }$ is the word embedding matrix, and $\mathbf { W } [ { w _ { t } } ]$ denotes the $w _ { t }$ -th column of $\mathbf { W }$ .
|
| 48 |
+
|
| 49 |
+

|
| 50 |
+
Figure 1: The NKLM model. The input consisting of a word (either $\mathbf { w } _ { t - 1 } ^ { o }$ or $\mathbf { w } _ { t - 1 } ^ { v }$ ) and a fact $\left( \mathbf { a } _ { t - 1 } \right)$ goes into LSTM. The LSTM’s output $\mathbf { h } _ { t }$ together with the knowledge context e generates the fact key $\mathbf { k } _ { t }$ . Using the fact key, the fact embedding $\mathbf { a } _ { t }$ is retrieved from the topic knowledge memory. Using $\mathbf { a } _ { t }$ and $\mathbf { h } _ { t }$ , knowledge-copy switch $z _ { t }$ is determined, which in turn determines the next word generation source $\mathbf { w } _ { t } ^ { v }$ or $\mathbf { w } _ { t } ^ { o }$ . The copied word $\mathbf { w } _ { t } ^ { o }$ is a symbol taken from the fact description $\mathcal { O } _ { a _ { t } }$ .
|
| 51 |
+
|
| 52 |
+
# 3.2 INFERENCE
|
| 53 |
+
|
| 54 |
+
At each time step, the NKLM follows four sub-steps. First, using both the word and fact outputs from the previous time step as the input of the current time step, we update the LSTM controller. Second, given the output of the LSTM, the NKLM predicts a fact (including NaF) and extracts corresponding fact embedding from the knowledge memory. Thirdly, with the extracted fact and the state of the LSTM controller, the NKLM makes a binary decision to choose the source of word generation. Finally, a word is generated according to the chosen source. A model diagram is depicted in Fig. 1. In the following, we describe these four steps in more detail.
|
| 55 |
+
|
| 56 |
+
1) Input Representation and LSTM Controller. As shown in Fig. 1, the input at time step $t$ is the concatenation of three embedding vectors corresponding to a fact $a _ { t - 1 }$ , a vocabulary word $w _ { t - 1 } ^ { v }$ , and a copied word $w _ { t - 1 } ^ { o }$ , all predicted in the previous time step. However, because at a time step, the predicted word comes only either from the vocabulary or by copying from the fact description, we set either $w _ { t - 1 } ^ { v }$ or $w _ { t - 1 } ^ { o }$ to a zero vector when it is not selected in the previous step. As we shall see, we use position embeddings to represent the copied words by its position within the fact description. And, because the dimensions of the vocabulary word embedding and the position embedding for copied words are different, we use such concatenation of $w _ { t - 1 } ^ { v }$ and $w _ { t - 1 } ^ { o }$ to represent the word input. The resulting input representation $\mathbf { x } _ { t } = f _ { \mathrm { c o n c a t } } ( \mathbf { a } _ { t - 1 } , \mathbf { w } _ { t - 1 } ^ { v } , \mathbf { w } _ { t - 1 } ^ { o } )$ is then fed into the LSTM controller, and obtain the output states $( \mathbf { h } _ { t } , \mathbf { c } _ { t } ) = f _ { \mathrm { L S T M } } ( \mathbf { x } _ { t } , \mathbf { h } _ { t - 1 } )$ . Note that $\mathbf { a } _ { t - 1 }$ and $\mathbf { w } _ { t - 1 } ^ { o }$ (e.g., corresponding to $n$ -th position) together can deliver information that a symbol in $n$ -th position in the description of fact $a _ { t - 1 }$ was used in the previous time step.
|
| 57 |
+
|
| 58 |
+
2) Fact Extraction. Then, we predict a relevant fact $a _ { t }$ on which the word $w _ { t }$ will be based. If the word $w _ { t }$ is supposed to be irrelevant to any fact, the NaF type is predicted. Unlike the fact embeddings, we learn the NaF embedding during training.
|
| 59 |
+
|
| 60 |
+
Predicting a fact is done in two steps. First, a fact-key $\mathbf { k } _ { \mathrm { f a c t } } ~ \in ~ \mathbb { R } ^ { D _ { a } }$ is generated by $\mathbf { k } _ { \mathrm { f a c t } } ~ =$ $f _ { \mathrm { f a c t k e y } } ( \mathbf { h } _ { t } , \mathbf { e } _ { k } )$ . Here, $\mathbf { e } _ { k } \in \mathbb { R } ^ { D _ { a } }$ is the topic context embedding (or a subgraph embedding of the topic) which encodes information about what facts are available in the knowledge memory so that the key generator adapts to changes in the knowledge memory. For example, if we remove a fact from the memory, without retraining, the fact-key generator should be aware of the absence of that information and thus should not generate a key vector for the removed fact. Although, in the experiments, we use mean-pooling (average of the all fact embeddings in the knowledge memory) to obtain $\mathbf { e } _ { k }$ , one can also consider using the soft-attention mechanism (Bahdanau et al., 2014). For the fact-key generator $f _ { \mathrm { f a c t k e y } }$ , we use an MLP with one hidden layer of ReLU nonlinearity.
|
| 61 |
+
|
| 62 |
+
Then, using the generated fact-key $\mathbf { k } _ { \mathrm { f a c t } }$ , we perform key-value lookup over the knowledge memory $\mathbf { F } _ { k }$ to predict a fact and retrieve its embedding $\mathbf { a } _ { t }$ ,
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\begin{array} { r l } & { P ( a _ { t } | h _ { t } ) = \frac { \exp ( { \bf k } _ { \mathrm { f a c t } } ^ { \top } { \bf F } _ { k } [ a _ { t } ] ) } { \sum _ { a ^ { \prime } } \exp ( { \bf k } _ { \mathrm { f a c t } } ^ { \top } { \bf F } _ { k } [ a ^ { \prime } ] ) } , } \\ & { ~ a _ { t } = \underset { a _ { t } \in \mathcal { F } _ { k } } { \mathrm { a r g m a x } } P ( a _ { t } | h _ { t } ) , } \\ & { ~ { \bf a } _ { t } = F _ { k } [ a _ { t } ] . } \end{array}
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
Note that in order to perform the copy mechanism, we need to pick a single fact from the knowledge memory instead of using the weighted average of the fact embeddings as in the soft-attention.
|
| 69 |
+
|
| 70 |
+
3) Knowledge-Copy Switch. Given the encoding of the context $\mathbf { h } _ { t }$ and the embedding of the extracted fact $\mathbf { a } _ { t }$ , the model decides the source for the next word generation: either from the vocabulary or from the fact description by copy. As $z _ { t } = 1$ if the word $w _ { t }$ is in the vocabulary, we define the probability of selecting copy as:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\hat { z } _ { t } = p ( 1 - z _ { t } | h _ { t } ) = \mathrm { s i g m o i d } ( f _ { \mathrm { c o p y } } ( \mathbf { h } _ { t } , \mathbf { a } _ { t } ) ) .
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
Here, $f _ { \mathrm { c o p y } }$ is an MLP with one ReLU hidden layer and a single linear output unit. For facts about attributes such as nationality or profession, the words in the fact description (e.g., “American” or “actor”) are likely to be in the vocabulary, but for facts like the year of birth or father name, the model is likely to choose to copy.
|
| 77 |
+
|
| 78 |
+
4) Word Generation. Word $w _ { t }$ is generated from the source indicated by the copy-switch $\hat { z } _ { t }$ as follows:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
w _ { t } = \left\{ \begin{array} { l l } { w _ { t } ^ { v } \in \mathcal { V } , } & { \mathrm { i f ~ } \hat { z } _ { t } < 0 . 5 , } \\ { w _ { t } ^ { o } \in \mathcal { O } _ { a _ { t } } , } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
For vocabulary word $w _ { t } ^ { v } \in \mathcal { V }$ , we use the softmax function where each output dimension corresponds to a word in the vocabulary including UNK,
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
P ( w _ { t } ^ { v } = w | h _ { t } ) = \frac { \exp ( \mathbf { k } _ { \mathrm { v o c a } } ^ { \top } \mathbf { W } [ w ] ) } { \sum _ { w ^ { \prime } \in \mathcal { V } } \exp ( \mathbf { k } _ { \mathrm { v o c a } } ^ { \top } \mathbf { W } [ w ^ { \prime } ] ) } .
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
where $\mathbf { k } _ { \mathrm { v o c a } } \in \mathbb { R } ^ { D _ { w } }$ is obtained by $f _ { \mathrm { v o c a } } ( \mathbf { h } _ { t } , \mathbf { a } _ { t } )$ which is an MLP with a ReLU hidden layer and linear output units of dimension $D _ { w }$ .
|
| 91 |
+
|
| 92 |
+
For knowledge word $w _ { t } ^ { o } \in \mathcal { O } _ { a _ { t } }$ , we predict the position of the word in the fact description and then copy the word on the predicted position to output. This is because, unlike with the traditional copy mechanism, our context words (i.e., the fact description) often consist of all unknown words and/or are short in length. Copying allows us not to rely on the word embeddings for the knowledge words. Instead, we learn the position embeddings shared among all knowledge words. This makes sense because words in the fact description usually appear one by one in increasing order. Thus, given that the first symbol $o _ { 1 } = { ^ { } M i c h e l l e ^ { , * } }$ was used in the previous time step and prior to that other words such as “President” and $" U S "$ were also observed, the model can easily predict that it is time to select the second symbol, i.e., $o _ { 2 } = \ ^ { } O b a m a ^ { \prime \prime }$ .
|
| 93 |
+
|
| 94 |
+
For this copy-by-position, we first generate the position key $\mathbf { k } _ { \mathrm { p o s } } \in \mathbb { R } ^ { D _ { o } }$ by a function $f _ { \mathrm { p o s k e y } } ( \mathbf { h } _ { t } , \mathbf { a } _ { t } )$ which is again an MLP with one hidden layer and linear outputs whose dimension is equal to the maximum length of the fact descriptions $N _ { \mathrm { m a x } } ^ { o } = \operatorname* { m a x } _ { a \in \mathcal { F } } | O _ { a } |$ where $\mathcal { F } = \cup _ { k } \mathcal { F } _ { k }$ . Then, the $n$ -th symbol $o _ { n } \in \mathcal { O } _ { a _ { t } }$ is chosen by
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
P ( w _ { t } ^ { o } = o _ { n } | h _ { t } , a _ { t } ) = \frac { \exp ( \mathbf { k } _ { \mathrm { p o s } } ^ { \top } \mathbf { P } [ n ] ) } { \sum _ { n ^ { \prime } } \exp ( \mathbf { k } _ { \mathrm { p o s } } ^ { \top } \mathbf { P } [ n ^ { \prime } ] ) } ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
with $n ^ { \prime }$ running from 0 to $| \mathcal { O } _ { a _ { t } } | - 1$ . Here, $\mathbf { P } ^ { D _ { o } \times N _ { \mathrm { m a x } } ^ { o } }$ is the position embedding matrix. Note that $N _ { \mathrm { m a x } } ^ { o }$ is typically a much smaller number (e.g., 20 in our experiments) than the size of vocabulary. The position embedding matrix $\mathbf { P }$ is learned during training.
|
| 101 |
+
|
| 102 |
+
Although in this paper we find that the simple position prediction performs well, we note that one could also consider a more advanced encoding such as one based on a convolutional network $( \mathrm { K i m }$ , 2014) to model the fact description. At test time, to compute $p ( w _ { t } ^ { k } | w _ { < t } ^ { k } )$ , we can obtain $\{ z _ { < t } ^ { k } , a _ { < t } ^ { k } \}$ from $\{ w _ { < t } ^ { k } \}$ and $\mathcal { F } _ { k }$ using the automatic labeling script, and perform the above inference process with hard decisions taken about $z _ { t }$ and $a _ { t }$ based on the model’s predictions.
|
| 103 |
+
|
| 104 |
+
# 3.3 LEARNING
|
| 105 |
+
|
| 106 |
+
Given word observations $\{ W _ { k } \} _ { k = 1 } ^ { K }$ and knowledge $\{ \mathcal { F } _ { k } \} _ { k = 1 } ^ { K }$ , our objective is to maximize the log-likelihood of the observed words w.r.t the model parameter $\theta$ ,
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\theta ^ { * } = \underset { \theta } { \operatorname { a r g m a x } } \sum _ { k } \log P _ { \theta } ( W _ { k } | \mathcal { F } _ { k } ) .
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
Table 1: Statistics of the WikiFacts-FilmActor- $\cdot \mathrm { v } 0 . 1$ Dataset.
|
| 113 |
+
|
| 114 |
+
<table><tr><td rowspan=1 colspan=1># topics</td><td rowspan=1 colspan=1># tokens</td><td rowspan=1 colspan=1># unique tokens</td><td rowspan=1 colspan=1>#facts</td><td rowspan=1 colspan=1># entities</td></tr><tr><td rowspan=1 colspan=1>10K</td><td rowspan=1 colspan=1>1.5M</td><td rowspan=1 colspan=1>78k</td><td rowspan=1 colspan=1>813k</td><td rowspan=1 colspan=1>560K</td></tr><tr><td rowspan=1 colspan=1># relations</td><td rowspan=1 colspan=1>maxkFk</td><td rowspan=1 colspan=1>avgk|Fk</td><td rowspan=1 colspan=1>maxaOa</td><td rowspan=1 colspan=1>avgaOa</td></tr><tr><td rowspan=1 colspan=1>1.5K</td><td rowspan=1 colspan=1>1K</td><td rowspan=1 colspan=1>79</td><td rowspan=1 colspan=1>19</td><td rowspan=1 colspan=1>2.15</td></tr></table>
|
| 115 |
+
|
| 116 |
+
Because, given $W _ { k }$ and $\mathcal { F } _ { k }$ , a sequence of $Y _ { k } = \{ y _ { t } = \left( w _ { t } , z _ { t } , a _ { t } \right) \} _ { t = 1 : | W _ { k } | }$ is deterministically induced for each word $w _ { t }$ , the following equality is satisfied
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
P _ { \theta } ( W _ { k } | \mathcal { F } _ { k } ) = P _ { \theta } ( Y _ { k } | \mathcal { F } _ { k } ) .
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
By the chain rule, we can decompose the probability of the observation $Y _ { k }$ as
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\log P _ { \theta } ( Y _ { k } | \mathcal { F } _ { k } ) = \sum _ { t = 1 } ^ { | Y _ { k } | } \log P _ { \theta } ( y _ { t } ^ { k } | y _ { 1 : t - 1 } ^ { k } , \mathcal { F } _ { k } ) .
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
Then, after omitting $\mathcal { F } _ { k }$ and $k$ for simplicity, we can rewrite the single step conditional probability as
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
P _ { \theta } ( y _ { t } | y _ { 1 : t - 1 } ) = P _ { \theta } ( w _ { t } , a _ { t } , z _ { t } | h _ { t } ) = P _ { \theta } ( w _ { t } | a _ { t } , z _ { t } , h _ { t } ) P _ { \theta } ( a _ { t } | h _ { t } ) P _ { \theta } ( z _ { t } | h _ { t } ) .
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
We maximize the above objective using stochastic gradient optimization.
|
| 135 |
+
|
| 136 |
+
# 4 EVALUATION
|
| 137 |
+
|
| 138 |
+
# 4.1 WIKIFACTS DATASET
|
| 139 |
+
|
| 140 |
+
An obstacle in developing the above model is the lack of the dataset where the text corpus is aligned with facts at the word level. To this end, we produced the WikiFacts dataset by aligning Wikipedia descriptions with corresponding Freebase facts. Because many Freebase topics provide a link to its corresponding topic in Wikipedia, we choose a set of topics for which both a Freebase entity and a Wikipedia description exist. In the experiments, we used a version called WikiFacts-FilmActor-v0.1 where the domain is restricted to the /Film/Actor in Freebase.
|
| 141 |
+
|
| 142 |
+
For all object entity descriptions $\{ O _ { a ^ { k } } \}$ associated with $\mathcal { F } _ { k }$ , we performed string matching to the Wikipedia description $W _ { k }$ . We used the summary part (first few paragraphs) of the Wikipedia page as text to be modeled but discarded topics for which the number of facts is greater than 1000 or the Wikipedia description is too short $\mathit { \Theta } \prec 3$ sentences). For the string matching, we also used the synonyms and alias provided by WordNet (Miller, 1995) and Freebase.
|
| 143 |
+
|
| 144 |
+
We augmented the fact set $\mathcal { F } _ { k }$ with the anchor facts $\mathcal { A } _ { k }$ whose relationship is all set to UnknownRelation. That is, observing that an anchor (words under hyperlink) in Wikipedia descriptions has a corresponding Freebase entity as well as being semantically closely related to the topic in which the anchor is found, we make a synthetic fact of the form (Topic, UnknownRelation, Anchor). This potentially compensates for some missing facts in Freebase. Because we extract the anchor facts from the full Wikipedia page and they all share the same relation, it is more challenging for the model to use these anchor facts than using the Freebase facts. As a result, for each word $w$ in the dataset, we have a tuple $( w , z _ { w } , a _ { w } , k _ { w } )$ . Here, $k _ { w }$ is the topic where $w$ appears. We provide a summary of the dataset statistics in Table 1. The dataset will be available on a public webpage4.
|
| 145 |
+
|
| 146 |
+
# 4.2 EXPERIMENTS
|
| 147 |
+
|
| 148 |
+
Setup. We split the dataset into 80/10/10 for train, validation, and test. As a baseline model, we use the RNNLM. For both the NKLM and the RNNLM, two-layer LSTMs with dropout regularization (Zaremba et al., 2014) are used. We tested models with different numbers of LSTM hidden units [200, 500, 1000], and report results from the 1000 hidden-unit model. For the NKLM, we set the symbol embedding dimension to 40 and word embedding dimension to 400. Under this setting, the number of parameters in the NKLM is slightly smaller than that of the RNNLM. We used
|
| 149 |
+
|
| 150 |
+
<table><tr><td></td><td colspan="2">Validation</td><td colspan="2">Test</td><td></td><td></td></tr><tr><td>Model</td><td>PPL UPP</td><td>UPP-f</td><td>PPL</td><td>UPP</td><td>UPP-f</td><td># UNK</td></tr><tr><td>RNNLM</td><td>39.4 97.9</td><td>56.8</td><td>39.4</td><td>107.0</td><td>58.4</td><td>23247</td></tr><tr><td>NKLM</td><td>27.5 45.4</td><td>33.5</td><td>28.0</td><td>48.7</td><td>34.6</td><td>12523</td></tr><tr><td>no-copy</td><td>38.4 93.5</td><td>54.9</td><td>38.3</td><td>102.1</td><td>56.4</td><td>29756</td></tr><tr><td>no-fact-no-copy</td><td>40.5 98.8</td><td>58.0</td><td>40.3</td><td>107.4</td><td>59.3</td><td>32671</td></tr><tr><td>no-TransE</td><td>48.9 80.7</td><td>59.6</td><td>49.3</td><td>85.8</td><td>61.0</td><td>13903</td></tr></table>
|
| 151 |
+
|
| 152 |
+
Table 2: We compare four different versions of the NKLM to the RNNLM on three different perplexity metrics. We used 10K vocabulary. In no-copy, we disabled the knowledge-copy functionality, and in no-fact-no-copy, using topic knowledge is also additionally disabled by setting all facts as NaF. Thus, no-fact-no-copy is very similar to RNNLM. In no-TransE, we used random vectors instead of the TransE embeddings to initialize the KG entities. As shown, the NKLM shows best performance in all cases. The no-fact-no-copy performs similar to the RNNLM as expected (slightly worse partly because it has smaller model parameters than that of the RNNLM). As expected, no-copy performs better than no-fact-no-copy by using additional information from the fact embedding, but without the copy mechanism. In the comparison of the NKLM and no-copy, we can see the significant gain of using the copy mechanism to predict named entities. In the last column, we can also see that, with the copy mechanism, the number of predicting unknown decreases significantly. Lastly, we can see that the TransE embedding is important.
|
| 153 |
+
|
| 154 |
+
100-dimension TransE embeddings for Freebase entities and relations, and concatenate the relation and object embeddings to obtain fact embeddings. We averaged all fact embeddings in $\mathcal { F } _ { k }$ to obtain the topic context embedding $\mathbf { e } _ { k }$ . We unrolled the LSTMs for 30 steps and used minibatch size 20. We trained the models using stochastic gradient ascent with gradient clipping range [-5,5]. The initial learning rate was set to 0.5 for the NKLM and 1.5 for the RNNLM, and decayed after every epoch by a factor of 0.98. We trained for 50 epochs and report the results chosen by the best validation set results.
|
| 155 |
+
|
| 156 |
+
Evaluation metric. The perplexity $\begin{array} { r } { \exp ( - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log p _ { w _ { i } } ) } \end{array}$ is the standard performance metric for language modeling. This, however, has a problem in evaluating language models for a corpus containing many named entities: a model can get good perplexity by accurately predicting UNK words. As an extreme example, when all words in a sentence are unknown words, a model predicting everything as UNK will get a good perplexity. Considering that unknown words provide virtually no useful information, this is clearly a problem in tasks such as question answering, dialogue modeling, and knowledge language modeling.
|
| 157 |
+
|
| 158 |
+
To this end, we introduce a new evaluation metric, called the Unknown-Penalized Perplexity (UPP), and evaluate the models on this metric as well as the standard perplexity (PPL). Because the actual word underlying the UNK should be one of the out-of-vocabulary (OOV) words, in UPP, we penalize the likelihood of unknown words as follows:
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
P _ { \mathrm { U P P } } ( w _ { \mathrm { u n k } } ) = P ( w _ { \mathrm { u n k } } ) / | \mathcal { V } _ { \mathrm { t o t a l } } \ : \backslash \ : \mathcal { V } _ { \mathrm { v o c a } } | .
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
Here, $\mathcal { V } _ { \mathrm { t o t a l } }$ is a set of all unique words in the corpus, and $\mathcal { V } _ { \mathrm { v o c a } }$ is the vocabulary used in the softmax. In other words, in UPP we assume that the OOV set is equal to $| \mathcal { V } _ { \mathrm { t o t a l } } \backslash \mathcal { V } _ { \mathrm { v o c a } } |$ and thus assign a uniform probability to OOV words. In another version, UPP-fact, we consider the fact that the RNNLM can also use the knowledge given to the NKLM to some extent, but with limited capability (because the model is not designed for it). For this, we assume that the OOV set is equal to the total knowledge vocabulary of a topic $k$ , i.e.,
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
P _ { \mathrm { U P P - f a c t } } ( w _ { \mathrm { u n k } } ) = P ( w _ { \mathrm { u n k } } ) / | \mathcal { O } _ { k } | ,
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
where $\mathcal { O } _ { k } = \cup _ { i } O _ { a ^ { k , i } }$ . In other words, by using UPP-fact, we assume that, for an unknown word, the RNNLM can pick one of the knowledge words with uniform probability. We describe the detail results and discussion on the experiments in the captions of Table 2, 3, and 4.
|
| 171 |
+
|
| 172 |
+
Observations from the experiment results. Our observations from the experiment results are as follows. (a) The NKLM outperforms the RNNLM in all three perplexity measures. (b) The copy mechanism is the key of the significant performance improvement. Without the copy mechanism, the NKLM still performs better than the RNNLM due to its usage of the fact information, but the improvement is not so significant. (c) The NKLM results in a much smaller number of UNKs (roughly, a half of the RNNLM). (d) When no knowledge is available, the NKLM performs as well as the
|
| 173 |
+
|
| 174 |
+
<table><tr><td colspan="3">Validation</td><td colspan="3">Test</td><td></td></tr><tr><td>Model</td><td>PPL</td><td>UPP</td><td>UPP-f</td><td>PPL UPP</td><td>UPP-f</td><td>#UNK</td></tr><tr><td rowspan="2">NKLM_5k RNNLM.5k</td><td>22.8</td><td>48.5</td><td>30.7</td><td>23.2 52.0</td><td>31.7</td><td>19557</td></tr><tr><td>27.4</td><td>108.5</td><td>47.6</td><td>27.5 118.3</td><td>48.9</td><td>34994</td></tr><tr><td>NKLM_10k RNNLM_10k</td><td>27.5</td><td>45.4</td><td>33.5</td><td>28.0 48.7</td><td>34.6</td><td>12523</td></tr><tr><td>NKLM_20k</td><td>39.4 33.4</td><td>97.9 45.9</td><td>56.8 37.9</td><td>39.4 107.0 34.7 49.2</td><td>58.4 39.7</td><td>23247 9677</td></tr><tr><td>RNNLM_20k NKLM_40k</td><td>57.9</td><td>99.5</td><td>72.1</td><td>59.3 108.3</td><td>75.5</td><td>13773</td></tr><tr><td>RNNLM_40k</td><td>41.4 82.4</td><td>49.0 107.9</td><td>44.4 92.3</td><td>43.6 52.7 86.4 116.9</td><td>47.1 97.9</td><td>5809 9009</td></tr></table>
|
| 175 |
+
|
| 176 |
+
Table 3: The NKLM and the RNNLM are compared for vocabularies of four different sizes [5K, 10K, 20K, 40K]. As shown, in all cases the NKLM significantly outperforms the RNNLM. Interestingly, for the standard perplexity (PPL), the gap between the two models increases as the vocabulary size increases while for UPP the gap stays at a similar level regardless of the vocabulary size. This tells us that the standard perplexity is significantly affected by the UNK predictions, because with UPP the contribution of UNK predictions to the total perplexity is very small. Also, from the UPP value for the RNNLM, we can see that it initially improves when vocabulary size is increased as it can cover more words, but decreases back when the vocabulary size is largest (40K) because the rare words are added last to the vocabulary.
|
| 177 |
+
|
| 178 |
+
<table><tr><td rowspan=1 colspan=1>Warm-up</td><td rowspan=1 colspan=1>Louise Allbritton(3july<unk>february1979)was</td></tr><tr><td rowspan=1 colspan=1>RNNLMNKLM</td><td rowspan=1 colspan=1>a <unk><unk>who was born in <unk>,<unk>,<unk>,<unk>,<unk>,<unk>,<unk>an english [Actor].he was born in[Oklahoma],anddied in[Oklahoma]. he was maried to[Charles][Colingwood]</td></tr><tr><td rowspan=1 colspan=1>Warm-up</td><td rowspan=1 colspan=1>Issa Serge Coelo(born 1967)isa<unk></td></tr><tr><td rowspan=1 colspan=1>RNNLMNKLM</td><td rowspan=1 colspan=1>actor.he is best known for his roleas<unk><unk>in the television series<unk>.he also[Film] director.he is best known for his role as the<unk><unk>in the film[Un][taxi][pour][Aouzou]</td></tr><tr><td rowspan=1 colspan=1>Warm-up</td><td rowspan=1 colspan=1>Adamwade Gontierisa canadian Musician and Songwriter.</td></tr><tr><td rowspan=1 colspan=1>RNNLMNKLM</td><td rowspan=1 colspan=1>she is best known for her role as <unk><unk>on the television series<unk>.she has also appearedhe is best known for his work with the band [Three] [Days] [Grace] .he is the founder of the</td></tr><tr><td rowspan=1 colspan=1>Warm-up</td><td rowspan=1 colspan=1>Rory Calhoun(august 8,1922 april 28</td></tr><tr><td rowspan=1 colspan=1>RNNLMNKLM</td><td rowspan=1 colspan=1>,2010)was a<unk>actress.she was born in<unk>,<unk>,<unk>.she was,2008 )was an american [Actor].he was born in [Los][Angeles] california.he was born in</td></tr></table>
|
| 179 |
+
|
| 180 |
+
Table 4: Sampled Descriptions. Given the warm-up phrases, we generate samples from the NKLM and the RNNLM. We denote the copied knowledge words by [word] and the UNK words by <unk>. Overall, the RNNLM generates many UNKs (we used 10K vocabulary) while the NKLM is capable to generate named entities even if the model has not seen some of the words at all during training. In the first case, we found that the generated symbols (words in []) conform to the facts of the topic (Louise Allbritton) except that she actually died in Mexico, not in Oklahoma. (We found that the place of death fact was missing.) While she is an actress, the model generated a word [Actor]. This is because in Freebase, there exists only /profession/actor but no /profession/actress. It is also noteworthy that the NKLM fails to use the gender information provided by facts; the NKLM uses “he” instead of “she” although the fact /gender/female is available. From this, we see that if a fact is not detected (i.e., NaF), the statistical co-occurrence governs the information flow. Similarly, in other samples, the NKLM generates movie titles (Un Taxi Pour Aouzou), band name (Three Days Grace), and place of birth (Los Angeles). In addition, to see the NKLM’s ability to adapt to knowledge updates without retraining, we changed the fact /place of birth/Oklahoma to /place of birth/Chicago and found that the NKLM replaces “Oklahoma” by “Chicago” while keeping other words the same.
|
| 181 |
+
|
| 182 |
+
RNNLM. (e) KG embedding using TransE is an efficient way to initialize the fact embeddings. (f) The NKLM generates named entities in the provided facts whereas the RNNLM generates many more UNKs. (g) The NKLM shows its ability to adapt immediately to the change of the knowledge. (h) The standard perplexity is significantly affected by the prediction accuracy on the unknown words. Thus, one need carefully consider it as a metric for knowledge-related language models.
|
| 183 |
+
|
| 184 |
+
# 5 CONCLUSION
|
| 185 |
+
|
| 186 |
+
In this paper, we presented a novel Neural Knowledge Language Model (NKLM) that brings the symbolic knowledge from a knowledge graph into the expressive power of RNN language models. The
|
| 187 |
+
|
| 188 |
+
NKLM significantly outperforms the RNNLM in terms of perplexity and generates named entities which are not observed during training, as well as immediately adapting to changes in knowledge. We believe that the WikiFact dataset introduced in this paper, can be useful in other knowledge-related language tasks as well. In addition, the Unknown-Penalized Perplexity introduced in this paper in order to resolve the limitation of the standard perplexity, can be useful in evaluating other language tasks. The task that we investigated in this paper is limited in the sense that we assume that the true topic of a given description is known. Relaxing this assumption by making the model search for proper topics on-the-fly will make the model more practical. We believe that there are many more open research challenges related to the knowledge language models.
|
| 189 |
+
|
| 190 |
+
# ACKNOWLEDGMENTS
|
| 191 |
+
|
| 192 |
+
The authors would like to thank Alberto Garc´ıa-Duran, Caglar Gulcehre, Chinnadhurai Sankar, Iulian´ Serban and Sarath Chandar for feedback and discussions as well as the developers of Theano (Bastien et al., 2012), NSERC, CIFAR, Samsung and Canada Research Chairs for funding, and Compute Canada for computing resources.
|
| 193 |
+
|
| 194 |
+
# REFERENCES
|
| 195 |
+
|
| 196 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
|
| 197 |
+
|
| 198 |
+
Fred´ eric Bastien, Pascal Lamblin, Razvan Pascanu, James Bergstra, Ian Goodfellow, Arnaud Bergeron, ´ Nicolas Bouchard, David Warde-Farley, and Yoshua Bengio. Theano: new features and speed improvements. arXiv preprint arXiv:1211.5590, 2012.
|
| 199 |
+
|
| 200 |
+
Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic ´ language model. In Journal of Machine Learning Research, 2003.
|
| 201 |
+
|
| 202 |
+
Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. Freebase: a collaboratively created graph database for structuring human knowledge. In Proceedings of the 2008 ACM SIGMOD international conference on Management of data, pp. 1247–1250. ACM, 2008.
|
| 203 |
+
|
| 204 |
+
Antoine Bordes, Jason Weston, Ronan Collobert, and Yoshua Bengio. Learning structured embeddings of knowledge bases. In AAAI 2011, 2011.
|
| 205 |
+
|
| 206 |
+
Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Advances in Neural Information Processing Systems, pp. 2787–2795, 2013.
|
| 207 |
+
|
| 208 |
+
Antoine Bordes, Nicolas Usunier, Sumit Chopra, and Jason Weston. Large-scale simple question answering with memory networks. arXiv preprint arXiv:1506.02075, 2015.
|
| 209 |
+
|
| 210 |
+
Asli Celikyilmaz, Dilek Hakkani-Tur, Panupong Pasupat, and Ruhi Sarikaya. Enriching word embeddings using knowledge graph for semantic tagging in conversational dialog systems. In 2015 AAAI Spring Symposium Series, 2015.
|
| 211 |
+
|
| 212 |
+
Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
|
| 213 |
+
|
| 214 |
+
Jiatao Gu, Zhengdong Lu, Hang Li, and Victor O. K. Li. Incorporating copying mechanism in sequence-to-sequence learning. CoRR, abs/1603.06393, 2016.
|
| 215 |
+
|
| 216 |
+
Kelvin Gu, John Miller, and Percy Liang. Traversing knowledge graphs in vector space. EMNLP 2015, 2015.
|
| 217 |
+
|
| 218 |
+
Caglar Gulcehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. Pointing the unknown words. ACL 2016, 2016.
|
| 219 |
+
|
| 220 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 221 |
+
|
| 222 |
+
Mohit Iyyer, Jordan L Boyd-Graber, Leonardo Max Batista Claudino, Richard Socher, and Hal Daume III. A neural network for factoid question answering over paragraphs. In ´ EMNLP 2014, pp. 633–644, 2014.
|
| 223 |
+
|
| 224 |
+
Sebastien Jean, Kyunghyun Cho, Roland Memisevic, and Yoshua Bengio. On using very large target vocabulary for neural machine translation. ACL 2015, 2015.
|
| 225 |
+
|
| 226 |
+
Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016.
|
| 227 |
+
|
| 228 |
+
Yoon Kim. Convolutional neural networks for sentence classification. EMNLP 2014, 2014.
|
| 229 |
+
|
| 230 |
+
Teng Long, Ryan Lowe, Jackie Chi Kit Cheung, and Doina Precup. Leveraging lexical resources for learning entity embeddings in multi-relational data. 2016.
|
| 231 |
+
|
| 232 |
+
Tomas Mikolov, Martin Karafiat, Lukas Burget, Jan Cernock ´ y, and Sanjeev Khudanpur. Recurrent \` neural network based language model. In INTERSPEECH 2010, volume 2, pp. 3, 2010.
|
| 233 |
+
|
| 234 |
+
George A Miller. Wordnet: a lexical database for english. Communications of the ACM, 38(11): 39–41, 1995.
|
| 235 |
+
|
| 236 |
+
Andriy Mnih and Geoffrey E Hinton. A scalable hierarchical distributed language model. In Advances in neural information processing systems, pp. 1081–1088, 2009.
|
| 237 |
+
|
| 238 |
+
Andriy Mnih and Yee Whye Teh. A fast and simple algorithm for training neural probabilistic language models. ICML 2012, 2012.
|
| 239 |
+
|
| 240 |
+
Frederic Morin and Yoshua Bengio. Hierarchical probabilistic neural network language model. AISTATS 2005, pp. 246, 2005.
|
| 241 |
+
|
| 242 |
+
Maximilian Nickel, Kevin Murphy, Volker Tresp, and Evgeniy Gabrilovich. A review of relational machine learning for knowledge graphs: From multi-relational link prediction to automated knowledge graph construction. arXiv preprint arXiv:1503.00759, 2015.
|
| 243 |
+
|
| 244 |
+
Iulian V Serban, Alessandro Sordoni, Yoshua Bengio, Aaron Courville, and Joelle Pineau. Building end-to-end dialogue systems using generative hierarchical neural networks. 30th AAAI Conference on Artificial Intelligence, 2015.
|
| 245 |
+
|
| 246 |
+
Oriol Vinyals and Quoc Le. A neural conversational model. arXiv preprint arXiv:1506.05869, 2015.
|
| 247 |
+
|
| 248 |
+
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. NIPS 2015, 2015.
|
| 249 |
+
|
| 250 |
+
Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. ICLR 2015, 2015.
|
| 251 |
+
|
| 252 |
+
Jason Weston, Antoine Bordes, Sumit Chopra, and Tomas Mikolov. Towards ai-complete question answering: A set of prerequisite toy tasks. ICLR 2016, 2016.
|
| 253 |
+
|
| 254 |
+
Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
|
| 255 |
+
|
| 256 |
+

|
| 257 |
+
APPENDIX: HEATMAPS
|
| 258 |
+
|
| 259 |
+
Figure 2: This is a heatmap of an example sentence generated by the NKLM having a warmup “Rory Calhoun ( august 8 , 1922 april $2 8 '$ . The first row shows the probability of knowledge-copy switch (Equation 5 in Section 3.1). The bottom heat map shows the state of the topic-memory at each time step (Equation 2 in Section 3.1). In particular, this topic has 8 facts and an additional ${ < } \mathrm { N a F > }$ fact. For the first six time steps, the model retrieves ${ < } \mathrm { N a F } >$ from the knowledge memory, copy-switch is off and the words are generated from the general vocabulary. For the next time step, the model gives higher probability to three different profession facts: “Screenwriter”, “Actor” and “Film Producer.” The fact “Actor” has the highest probability, copy-switch is higher than 0.5, and therefore “Actor” is copied as the next word. Moreover, we see that the model correctly retrieves the place of birth fact and outputs “Los Angeles.” After that, the model still predicts the place of birth fact, but copy-switch decides that the next word should come from the general vocabulary, and outputs “California.”
|
| 260 |
+
|
| 261 |
+

|
| 262 |
+
Figure 3: This is an example sentence generated by the NKLM having a warmup “Louise Allbritton ( 3 july <unk>february 1979 ) was”. We see that the model correctly retrieves and outputs the profession (“Actor”), place of birth (“Oklahoma”), and spouse (“Charles Collingwood”) facts. However, the model makes a mistake by retrieving the place of birth fact in a place where the place of death fact is supposed to be used. This is probably because the place of death fact is missing in this topic memory and then the model searches for a fact about location, which is somewhat encoded in the place of birth fact. In addition, Louise Allbritton was a woman, but the model generates a male profession “Actor” and male pronoun “he”. The “Actor” is generated because there is no “Actress” representation in Freebase.
|
md/train/BkgrBgSYDS/BkgrBgSYDS.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/BkrSv0lA-/BkrSv0lA-.md
ADDED
|
@@ -0,0 +1,507 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LOSS-AWARE WEIGHT QUANTIZATION OF DEEP NET-WORKS
|
| 2 |
+
|
| 3 |
+
Lu Hou, James T. Kwok
|
| 4 |
+
Department of Computer Science and Engineering
|
| 5 |
+
Hong Kong University of Science and Technology
|
| 6 |
+
Hong Kong
|
| 7 |
+
{lhouab, jamesk}@cse.ust.hk
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
The huge size of deep networks hinders their use in small computing devices. In this paper, we consider compressing the network by weight quantization. We extend a recently proposed loss-aware weight binarization scheme to ternarization, with possibly different scaling parameters for the positive and negative weights, and $m$ -bit (where $m > 2$ ) quantization. Experiments on feedforward and recurrent neural networks show that the proposed scheme outperforms state-of-the-art weight quantization algorithms, and is as accurate (or even more accurate) than the full-precision network.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
The last decade has witnessed huge success of deep neural networks in various domains. Examples include computer vision, speech recognition, and natural language processing (LeCun et al., 2015). However, their huge size often hinders deployment to small computing devices such as cell phones and the internet of things. Many attempts have been recently made to reduce the model size. One common approach is to prune a trained dense network (Han et al., 2015; 2016). However, most of the pruned weights may come from the fully-connected layers where computations are cheap, and the resultant time reduction is insignificant. Li et al. (2017b) and Molchanov et al. (2017) proposed to prune filters in the convolutional neural networks based on their magnitudes or significance to the loss. However, the pruned network has to be retrained, which is again expensive.
|
| 16 |
+
|
| 17 |
+
Another direction is to use more compact models. GoogleNet (Szegedy et al., 2015) and ResNet (He et al., 2016) replace the fully-connected layers with simpler global average pooling. However, they are also deeper. SqueezeNet (Iandola et al., 2016) reduces the model size by replacing most of the $3 \times 3$ filters with $1 \times 1$ filters. This is less efficient on smaller networks because the dense $1 \times 1$ convolutions are costly. MobileNet (Howard et al., 2017) compresses the model using separable depth-wise convolution. ShuffleNet (Zhang et al., 2017) utilizes pointwise group convolution and channel shuffle to reduce the computation cost while maintaining accuracy. However, highly optimized group convolution and depth-wise convolution implementations are required. Alternatively, Novikov et al. (2015) compressed the model by using a compact multilinear format to represent the dense weight matrix. The CP and Tucker decompositions have also been used on the kernel tensor in CNNs (Lebedev et al., 2014; Kim et al., 2016). However, they often need expensive fine-tuning.
|
| 18 |
+
|
| 19 |
+
Another effective approach to compress the network and accelerate training is by quantizing each full-precision weight to a small number of bits. This can be further divided to two sub-categories, depending on whether pre-trained models are used (Lin et al., 2016a; Mellempudi et al., 2017) or the quantized model is trained from scratch (Courbariaux et al., 2015; Li et al., 2017a). Some of these also directly learn with low-precision weights, but they usually suffer from severe accuracy deterioration (Li et al., 2017a; Miyashita et al., 2016). By keeping the full-precision weights during learning, Courbariaux et al. (2015) pioneered the BinaryConnect algorithm, which uses only one bit for each weight while still achieving state-of-the-art classification results. Rastegari et al. (2016) further incorporated weight scaling, and obtained better results. Instead of simply finding the closest binary approximation of the full-precision weights, a loss-aware scheme is proposed in (Hou et al., 2017). Beyond binarization, TernaryConnect (Lin et al., 2016b) quantizes each weight to $\{ - 1 , 0 , 1 \}$ . Li & Liu (2016) and Zhu et al. (2017) added scaling to the ternarized weights, and DoReFa-Net (Zhou et al., 2016) further extended quantization to more than three levels. However, these methods do not consider the effect of quantization on the loss, and rely on heuristics in their procedures (Zhou et al., 2016; Zhu et al., 2017). Recently, a loss-aware low-bit quantized neural network is proposed in (Leng et al., 2017). However, it uses full-precision weights in the forward pass and the extra-gradient method (Vasilyev et al., 2010) for update, both of which are expensive.
|
| 20 |
+
|
| 21 |
+
In this paper, we propose an efficient and disciplined ternarization scheme for network compression. Inspired by (Hou et al., 2017), we explicitly consider the effect of ternarization on the loss. This is formulated as an optimization problem which is then solved efficiently by the proximal Newton algorithm. When the loss surface’s curvature is ignored, the proposed method reduces to that of (Li & Liu, 2016), and is also related to the projection step of (Leng et al., 2017). Next, we extend it to (i) allow the use of different scaling parameters for the positive and negative weights; and (ii) the use of $m$ bits (where $m > 2$ ) for weight quantization. Experiments on both feedforward and recurrent neural networks show that the proposed quantization scheme outperforms state-of-the-art algorithms.
|
| 22 |
+
|
| 23 |
+
Notations: For a vector $\mathbf { x }$ , $\sqrt { \mathbf { x } }$ denotes the element-wise square root (i.e., $[ { \sqrt { \mathbf { x } } } ] _ { i } = { \sqrt { x _ { i } } } )$ , $| \mathbf { x } |$ is the element-wise absolute value, $\begin{array} { r } { \| \mathbf { x } \| _ { p } = ( \sum _ { i } | x _ { i } | ^ { p } ) ^ { \frac { 1 } { p } } } \end{array}$ is its $p$ -norm, and $\mathrm { D i a g ( x ) }$ returns a diagonal matrix with $\mathbf { x }$ on the diagonal. For two vectors $\mathbf { x }$ and $\mathbf { y }$ , $\mathfrak { c } \odot$ y denotes the element-wise multiplication and $\mathbf { x } \oslash \mathbf { y }$ the element-wise division. Given a threshold $\Delta$ , $\mathbf { I } _ { \Delta } ( \mathbf { x } )$ returns a vector such that $[ { \bf I } _ { \Delta } ( { \bf x } ) ] _ { i } = 1$ if $x _ { i } > \Delta$ , $- 1$ if $x _ { i } < - \Delta$ , and 0 otherwise. $\mathbf { I } _ { \Delta } ^ { + } ( \mathbf { x } )$ considers only the positive threshold, i.e., $[ \mathbf { I } _ { \Delta } ^ { + } ( \mathbf { x } ) ] _ { i } = 1$ if $x _ { i } > \Delta$ , and 0 otherwise. Similarly, $[ \mathbf { I } _ { \Delta } ^ { - } ( \mathbf { x } ) ] _ { i } = - 1$ if $x _ { i } < - \Delta$ , and 0 otherwise. For a matrix $\mathbf { X }$ , vec $( \mathbf { X } )$ returns a vector by stacking all the columns of $\mathbf { X }$ , and diag $( \mathbf { X } )$ returns a vector whose entries are from the diagonal of $\mathbf { X }$ .
|
| 24 |
+
|
| 25 |
+
# 2 RELATED WORK
|
| 26 |
+
|
| 27 |
+
Let the full-precision weights from all $L$ layers be $\mathbf { w } ~ = ~ [ \mathbf { w } _ { 1 } ^ { \top } , \mathbf { w } _ { 2 } ^ { \top } , \dots , \mathbf { w } _ { L } ^ { \top } ] ^ { \top }$ , where $\begin{array} { r l } { \mathbf { w } _ { l } } & { { } = } \end{array}$ $\mathrm { v e c } ( \mathbf { W } _ { l } )$ , and $\mathbf { W } _ { l }$ is the weight matrix at layer $l$ . The corresponding quantized weights will be denoted $\hat { \mathbf { w } } = [ \hat { \mathbf { w } } _ { 1 } ^ { \top } , \hat { \mathbf { w } } _ { 2 } ^ { \top } , \ldots , \tilde { \mathbf { w } } _ { L } ^ { \top } ] ^ { \top }$ .
|
| 28 |
+
|
| 29 |
+
# 2.1 WEIGHT BINARIZED NETWORKS
|
| 30 |
+
|
| 31 |
+
In BinaryConnect (Courbariaux et al., 2015), each element of $\mathbf { w } _ { l }$ is binarized to $- 1$ or $+ 1$ by using the sign function: Binarize $( \mathbf { w } _ { l } ) = \mathrm { s i g n } ( \mathbf { w } _ { l } )$ . In the Binary-Weight-Network (BWN) (Rastegari et al., 2016), a scaling parameter is also included, i.e., Binarize $\left( \mathbf { w } _ { l } \right) = \alpha _ { l } \mathbf { b } _ { l }$ , where $\alpha _ { l } > 0$ , $\mathbf { b } _ { l } \in$ $\{ - 1 , + 1 \} ^ { n _ { l } }$ and $n _ { l }$ is the number of weights in $\mathbf { w } _ { l }$ . By minimizing the difference between $\mathbf { w } _ { l }$ and $\alpha _ { l } \mathbf { b } _ { l }$ , the optimal $\alpha _ { l } , \mathbf { b } _ { l }$ have the simple form: $\alpha _ { l } = \| \dot { \mathbf { w } } _ { l } \| _ { 1 } / n _ { l }$ , and ${ \bf b } _ { l } = \mathrm { s i g n } ( { \bf w } _ { l } )$ .
|
| 32 |
+
|
| 33 |
+
Instead of simply finding the best binary approximation for the full-precision weight $\mathbf { w } _ { l } ^ { t }$ at iteration $t$ , the loss-aware binarized network (LAB) directly minimizes the loss w.r.t. the binarized weight $\alpha _ { l } ^ { t } \mathbf { b } _ { l } ^ { t }$ (Hou et al., 2017). Let $\mathbf { d } _ { l } ^ { t - 1 }$ be a vector containing the diagonal of an approximate Hessian of the loss. It can be shown that $\begin{array} { r } { \dot { \alpha } _ { l } ^ { t } = \lVert \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } \rVert _ { 1 } / \lVert \mathbf { d } _ { l } ^ { t - 1 } \rVert _ { 1 } } \end{array}$ and $\mathbf { b } _ { l } ^ { t } = \mathrm { s i g n } ( \mathbf { w } _ { l } ^ { t } )$ .
|
| 34 |
+
|
| 35 |
+
# 2.2 WEIGHT TERNARIZED NETWORKS
|
| 36 |
+
|
| 37 |
+
In a weight ternarized network, zero is used as an additional quantized value. In TernaryConnect (Lin et al., 2016b), each weight value is clipped to $[ - 1 , 1 ]$ before quantization, and then a non-negative weight $[ \mathbf { w } _ { l } ^ { t } ] _ { i }$ is stochastically quantized to 1 with probability $\left[ \mathbf { w } _ { l } ^ { t } \right] _ { i }$ (and 0 otherwise). When $\left[ \mathbf { w } _ { l } ^ { t } \right] _ { i }$ is negative, it is quantized to $- 1$ with probability $- [ \mathbf { w } _ { l } ^ { t } ] _ { i }$ , and 0 otherwise.
|
| 38 |
+
|
| 39 |
+
In the ternary weight network (TWN) (Li & Liu, 2016), $\mathbf { w } _ { l } ^ { t }$ is quantized to $\hat { \mathbf { w } } _ { l } ^ { t } = \alpha _ { l } ^ { t } \mathbf { I } _ { \Delta _ { l } ^ { t } } ( \mathbf { w } _ { l } ^ { t } )$ , where $\Delta _ { l } ^ { t }$ is a threshold (i.e., $[ \hat { \mathbf { w } } _ { l } ^ { t } ] _ { i } = \alpha _ { l } ^ { t }$ if $[ \mathbf { w } _ { l } ^ { t } ] _ { i } > \Delta _ { l } ^ { t }$ , $- \alpha _ { l } ^ { t }$ if $[ { \bf w } _ { l } ^ { t } ] _ { i } < - \Delta _ { l } ^ { t }$ and 0 otherwise). To obtain $\Delta _ { l } ^ { t }$ and $\alpha _ { l } ^ { t }$ , TWN minimizes the $\ell _ { 2 }$ -distance between the full-precision and ternarized
|
| 40 |
+
|
| 41 |
+
weights, leading to
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
\Delta _ { l } ^ { t } = \arg \operatorname* { m a x } _ { \Delta > 0 } \frac { 1 } { \| \mathbf { I } _ { \Delta } ( \mathbf { w } _ { l } ^ { t } ) \| _ { 1 } } \left( \sum _ { i : [ \mathbf { w } _ { l } ^ { t } ] _ { i } ] > \Delta _ { l } ^ { t } } \vert [ \mathbf { w } _ { l } ^ { t } ] _ { i } \vert \right) ^ { 2 } , \alpha _ { l } ^ { t } = \frac { 1 } { \| \mathbf { I } _ { \Delta _ { l } ^ { t } } ( \mathbf { w } _ { l } ^ { t } ) \| _ { 1 } } \sum _ { i : [ \mathbf { w } _ { l } ^ { t } ] _ { i } ] > \Delta _ { l } ^ { t } } \vert [ \mathbf { w } _ { l } ^ { t } ] _ { i } \vert .
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
However, $\Delta _ { l } ^ { t }$ in (1) is difficult to solve. Instead, TWN simply sets $\Delta _ { l } ^ { t } = 0 . 7 \cdot \mathbf { E } ( | \mathbf { w } _ { l } ^ { t } | )$ in practice.
|
| 48 |
+
|
| 49 |
+
In TWN, one scaling parameter $( \alpha _ { l } ^ { t } )$ is used for both the positive and negative weights at layer $l$ . In the trained ternary quantization (TTQ) network (Zhu et al., 2017), different scaling parameters $( \alpha _ { l } ^ { t }$ and $\beta _ { l } ^ { t } .$ ) are used. The weight $\mathbf { w } _ { l } ^ { t }$ is thus quantized to $\hat { \mathbf { w } } _ { l } ^ { t } = \alpha _ { l } ^ { t } \mathbf { I } _ { \Delta _ { l } ^ { t } } ^ { + } ( \mathbf { w } _ { l } ^ { t } ) + \beta _ { l } ^ { t } \mathbf { I } _ { \Delta _ { l } ^ { t } } ^ { - } ( \mathbf { w } _ { l } ^ { t } )$ . The scaling parameters are learned by gradient descent. As for $\Delta _ { l } ^ { t }$ , two heuristics are used. The first sets $\Delta _ { l } ^ { t }$ to a constant fraction of $\operatorname* { m a x } ( | \mathbf { w } _ { l } ^ { t } | )$ , while the second sets $\Delta _ { l } ^ { t }$ such that at all layers are equally sparse.
|
| 50 |
+
|
| 51 |
+
# 2.3 WEIGHT QUANTIZED NETWORKS
|
| 52 |
+
|
| 53 |
+
In a weight quantized network, $m$ bits (where $\begin{array} { r l r } { m } & { { } \geq } & { 2 ) } \end{array}$ are used to represent each weight. Let $\mathcal { Q }$ be a set of $( 2 k + 1 )$ quantized values, where $\textit { k } ~ = ~ 2 ^ { m - 1 ^ { * } } - 1$ . The two popular choices of $\mathcal { Q }$ are $\{ - 1 , - \frac { k - 1 } { k } , \ldots , - \frac { 1 } { k } , 0 , \frac { 1 } { k } , \ldots , \frac { k - 1 } { k } , 1 \}$ (linear quantization), and $\left\{ - 1 , - { \frac { 1 } { 2 } } , \ldots , - { \frac { 1 } { 2 ^ { k - 1 } } } , 0 , { \frac { 1 } { 2 ^ { k - 1 } } } , \ldots , { \frac { 1 } { 2 } } , 1 \right\}$ (logarithmic quantization). By limiting the quantized values to powers of two, logarithmic quantization is advantageous in that expensive floating-point operations can be replaced by cheaper bit-shift operations. When $m = 2$ , both schemes reduce to $\mathcal { Q } = \{ - 1 , 0 , 1 \}$ .
|
| 54 |
+
|
| 55 |
+
In the DoReFa-Net (Zhou et al., 2016), weight $\mathbf { w } _ { l } ^ { t }$ is heuristically quantized to $m$ -bit, with:1
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
[ \hat { \mathbf { w } } _ { l } ^ { t } ] _ { i } = 2 \cdot \mathrm { q u a n t i z e } _ { m } \left( \frac { \operatorname { t a n h } ( [ \mathbf { w } _ { l } ^ { t } ] _ { i } ) } { 2 \operatorname* { m a x } ( | \operatorname { t a n h } ( [ \mathbf { w } _ { l } ^ { t } ] _ { i } ) | ) } + \frac { 1 } { 2 } \right) - 1
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
in $\{ - 1 , - \frac { 2 ^ { m } - 2 } { 2 ^ { m } - 1 } , \ldots , - \frac { 1 } { 2 ^ { m } - 1 } , \frac { 1 } { 2 ^ { m } - 1 } , \ldots , \frac { 2 ^ { m } - 2 } { 2 ^ { m } - 1 } , 1 \}$ − 12m−1 , 12m−1 , . . . , 2m−22m−1 , 1}, where quantizem(x) = 2 $\ l _ { m } ( x ) \ = \ { \frac { 1 } { 2 ^ { m } - 1 } } \mathrm { r o u n d } ( ( 2 ^ { m } \ -$ $1 ) x$ ). Similar to loss-aware binarization (Hou et al., 2017), Leng et al. (2017) proposed a loss-aware quantized network called low-bit neural network (LBNN). The alternating direction method of multipliers (ADMM) (Boyd et al., 2011) is used for optimization. At the tth iteration, the full-precision weight $\mathbf { w } _ { l } ^ { t }$ is first updated by the method of extra-gradient (Vasilyev et al., 2010):
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\begin{array} { r } { \tilde { \mathbf { w } } _ { l } ^ { t } = \mathbf { w } _ { l } ^ { t - 1 } - \eta ^ { t } \nabla _ { l } \mathcal { L } ( \mathbf { w } _ { l } ^ { t - 1 } ) , \mathbf { w } _ { l } ^ { t } = \mathbf { w } _ { l } ^ { t - 1 } - \eta ^ { t } \nabla _ { l } \mathcal { L } ( \tilde { \mathbf { w } } _ { l } ^ { t } ) , } \end{array}
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where $\mathcal { L }$ is the augmented Lagrangian in the ADMM formulation, and $\eta ^ { t }$ is the stepsize. Next, $\mathbf { w } _ { l } ^ { t }$ is projected to the space of $m$ -bit quantized weights so that $\hat { \mathbf { w } } _ { l } ^ { t }$ is of the form $\alpha _ { l } \mathbf { b } _ { l }$ , where $\alpha _ { l } > 0$ , and $\mathbf { b } _ { l } \in \left\{ - 1 , - { \frac { 1 } { 2 } } , \ldots , - { \frac { 1 } { 2 ^ { k - 1 } } } , 0 , { \frac { 1 } { 2 ^ { k - 1 } } } , \ldots , { \frac { 1 } { 2 } } , 1 \right\}$ .
|
| 68 |
+
|
| 69 |
+
# 3 LOSS-AWARE QUANTIZATION
|
| 70 |
+
|
| 71 |
+
# 3.1 TERNARIZATION USING PROXIMAL NEWTON ALGORITHM
|
| 72 |
+
|
| 73 |
+
In weight ternarization, TWN simply finds the closest ternary approximation of the full precision weight at each iteration, while TTQ sets the ternarization threshold heuristically. Inspired by LAB (for binarization), we consider the loss explicitly during quantization and obtain the quantization thresholds and scaling parameter by solving an optimization problem.
|
| 74 |
+
|
| 75 |
+
As in TWN, the weight $\mathbf { w } _ { l }$ is ternarized as $\hat { \mathbf { w } } _ { l } = \alpha _ { l } \mathbf { b } _ { l }$ , where $\alpha _ { l } > 0$ and ${ \bf b } _ { l } \in \{ - 1 , 0 , 1 \} ^ { n _ { l } }$ . Given a loss function $\ell$ , we formulate weight ternarization as the following optimization problem:
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\operatorname* { m i n } _ { \hat { \mathbf { w } } } \ \ell ( \hat { \mathbf { w } } ) : \ \hat { \mathbf { w } } _ { l } = \alpha _ { l } \mathbf { b } _ { l } , \ \alpha _ { l } > 0 , \ \mathbf { b } _ { l } \in \mathcal { Q } ^ { n _ { l } } , \ l = 1 , \ldots , L ,
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where $\mathcal { Q }$ is the set of desired quantized values. As in LAB, we will solve this using the proximal Newton method (Lee et al., 2014; Rakotomamonjy et al., 2016). At iteration $t$ , the objective is replaced by the second-order expansion
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\ell ( \hat { \mathbf { w } } ^ { t - 1 } ) + \nabla \ell ( \hat { \mathbf { w } } ^ { t - 1 } ) ^ { \top } ( \hat { \mathbf { w } } - \hat { \mathbf { w } } ^ { t - 1 } ) + \frac { 1 } { 2 } ( \hat { \mathbf { w } } - \hat { \mathbf { w } } ^ { t - 1 } ) ^ { \top } \mathbf { H } ^ { t - 1 } ( \hat { \mathbf { w } } - \hat { \mathbf { w } } ^ { t - 1 } ) ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $\mathbf { H } ^ { t - 1 }$ is an estimate of the Hessian of $\ell$ at $\hat { \mathbf { w } } ^ { t - 1 }$ . We use the diagonal equilibration preconditioner (Dauphin et al., 2015), which is robust in the presence of saddle points and also readily available in popular stochastic deep network optimizers such as Adam (Kingma & Ba, 2015). Let $\mathbf { D } _ { l }$ be the approximate diagonal Hessian at layer $l$ . We use $\mathbf { D } = \mathrm { D i a g } ( [ \mathrm { d i a g } ( \mathbf { \tilde { D _ { 1 } } } ) ^ { \top } , \dots , \mathrm { d i a g } ( \mathbf { \tilde { D } } _ { L } ) ^ { \top } ] ^ { \top } )$ as an estimate of $\mathbf { H }$ . Substituting (4) into (3), we solve the following subproblem at the tth iteration:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\begin{array} { r l } { \operatorname* { m i n } _ { \hat { \mathbf { w } } ^ { t } } } & { \nabla \ell ( \hat { \mathbf { w } } ^ { t - 1 } ) ^ { \top } ( \hat { \mathbf { w } } ^ { t } - \hat { \mathbf { w } } ^ { t - 1 } ) + \displaystyle \frac { 1 } { 2 } ( \hat { \mathbf { w } } ^ { t } - \hat { \mathbf { w } } ^ { t - 1 } ) ^ { \top } \mathbf { D } ^ { t - 1 } ( \hat { \mathbf { w } } ^ { t } - \hat { \mathbf { w } } ^ { t - 1 } ) } \\ { \mathrm { s . t . } } & { \quad \hat { \mathbf { w } } _ { l } ^ { t } = \alpha _ { l } ^ { t } \mathbf { b } _ { l } ^ { t } , \ \alpha _ { l } ^ { t } > 0 , \ \mathbf { b } _ { l } ^ { t } \in \mathcal { Q } ^ { n _ { l } } , \ l = 1 , \dots , L . } \end{array}
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
Proposition 3.1 The objective in (5) can be rewritten as
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\operatorname* { m i n } _ { \hat { \mathbf { w } } ^ { t } } \frac { 1 } { 2 } \sum _ { l = 1 } ^ { L } \left( \sqrt { \mathbf { d } _ { l } ^ { t - 1 } } ^ { \top } ( \hat { \mathbf { w } } _ { l } ^ { t } - \mathbf { w } _ { l } ^ { t } ) \right) ^ { 2 } ,
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
where $\mathbf { d } _ { l } ^ { t - 1 } \equiv d i a g ( \mathbf { D } _ { l } ^ { t - 1 } )$ , and
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\mathbf { w } _ { l } ^ { t } \equiv \hat { \mathbf { w } } _ { l } ^ { t - 1 } - \nabla _ { l } \ell \big ( \hat { \mathbf { w } } ^ { t - 1 } \big ) \oslash \mathbf { d } _ { l } ^ { t - 1 } .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Obviously, this objective can be minimized layer by layer. Each proximal Newton iteration thus consists of two steps: (i) Obtain $\mathbf { w } _ { l } ^ { t }$ in (7) by gradient descent along $\nabla _ { l } \ell \big ( \hat { \mathbf { w } } ^ { t - 1 } \big )$ , which is preconditioned by the adaptive learning rate $1 \bigcirc \mathbf { d } _ { l } ^ { t - 1 }$ so that the rescaled dimensions have similar curvatures; (ii) Quantize $\mathbf { w } _ { l } ^ { t }$ to $\hat { \mathbf { w } } _ { l } ^ { t }$ by minimizing the scaled difference between $\hat { \mathbf { w } } _ { l } ^ { t }$ and $\mathbf { w } _ { l } ^ { t }$ in (6). Intuitively, when the curvature is low $\big [ \mathbf { d } _ { l } ^ { t - 1 } \big ] _ { i }$ is small), the loss is not sensitive to the weight and ternarization error can be less penalized. When the loss surface is steep, ternarization has to be more accurate.
|
| 106 |
+
|
| 107 |
+
Though the constraint in (6) is more complicated than that in LAB, interestingly the following simple relationship can still be obtained for weight ternarization.
|
| 108 |
+
|
| 109 |
+
Proposition 3.2 With $\mathcal { Q } = \{ - 1 , 0 , 1 \}$ , and the optimal $\hat { \mathbf { w } } _ { l } ^ { t }$ in (6) of the form αb. For a fixed b, α = kbdt−1l wtl k1t−1 ; whereas when α is fixed, b = Iα/2(wtl ).
|
| 110 |
+
|
| 111 |
+
Equivalently, b can be written as $\Pi _ { \mathcal { Q } } ( \mathbf { w } _ { l } ^ { t } / \alpha )$ , where $\Pi _ { \mathcal { Q } } ( \cdot )$ projects each entry of the input argument to the nearest element in $\mathcal { Q }$ . Further discussions on how to solve for $\alpha _ { l } ^ { t }$ will be presented in Sections 3.1.1 and 3.1.2. When the curvature is the same for all dimensions at layer $l$ , the following Corollary shows that the solution above reduces that of TWN.
|
| 112 |
+
|
| 113 |
+
Corollary 3.1 When $\mathbf { D } _ { l } ^ { t - 1 } = \lambda \mathbf { I }$ , $\alpha _ { l } ^ { t }$ reduces to the TWN solution in $( l )$ with $\Delta _ { l } ^ { t } = \alpha _ { l } ^ { t } / 2$ .
|
| 114 |
+
|
| 115 |
+
In other words, TWN corresponds to using the proximal gradient algorithm, while the proposed method corresponds to using the proximal Newton algorithm with diagonal Hessian. In composite optimization, it is known that the proximal Newton algorithm is more efficient than the proximal gradient algorithm (Lee et al., 2014; Rakotomamonjy et al., 2016). Moreover, note that the interesting relationship $\Delta _ { l } ^ { t } = \alpha _ { l } ^ { t } / 2$ is not observed in TWN, while TTQ completely neglects this relationship.
|
| 116 |
+
|
| 117 |
+
In LBNN (Leng et al., 2017), its projection step uses an objective which is similar to (6), but without using the curvature information. Besides, their $\mathbf { w } _ { l } ^ { t }$ is updated with the extra-gradient in (2), which doubles the number of forward, backward and update steps, and can be costly. Moreover, LBNN uses full-precision weights in the forward pass, while all other quantization methods including ours use quantized weights (which eliminates most of the multiplications and thus faster training).
|
| 118 |
+
|
| 119 |
+
When (i) $\ell$ is continuously differentiable with Lipschitz-continuous gradient (i.e., there exists $\beta > 0$ such that $\left\| \nabla \ell ( \mathbf { u } ) - \nabla \ell ( \mathbf { v } ) \right\| _ { 2 } \leq \beta \left\| \mathbf { u } - \mathbf { v } \right\| _ { 2 }$ for any $\mathbf { u } , \mathbf { v } ,$ ); (ii) $\ell$ is bounded from below; and (iii) $[ \mathbf { d } _ { l } ^ { t } ] _ { k } > \ddot { \beta \ } \forall l , \dot { k } , \dot { t } .$ , it can be shown that the objective of (3) produced by the proximal Newton algorithm (with solution in Proposition 3.2) converges (Hou et al., 2017). In practice, it is important to keep the full-precision weights during update (Courbariaux et al., 2015). Hence, we replace (7) by $\mathbf { w } _ { l } ^ { t } \dot { } - \mathbf { w } _ { l } ^ { t - 1 } \dot { } - \nabla _ { l } \ell ( \hat { \mathbf { w } } ^ { t - 1 } ) \bigcirc \mathbf { d } _ { l } ^ { t - 1 }$ . The whole procedure, which is called Loss-Aware Ternarization (LAT), is shown in Algorithm 3 of Appendix B. It is similar to Algorithm 1 of LAB (Hou et al., 2017), except that $\alpha _ { l } ^ { t }$ and $\mathbf { b } _ { l } ^ { t }$ are computed differently. In step 4, following (Li & Liu, 2016), we first rescale input $\mathbf { x } _ { l } ^ { t - 1 }$ with $\alpha _ { l }$ , so that multiplications in dot products and convolutions become additions. Algorithm 3 can also be easily extended to ternarize weights in recurrent networks. Interested readers are referred to (Hou et al., 2017) for details.
|
| 120 |
+
|
| 121 |
+
# 3.1.1 EXACT SOLUTION OF $\alpha _ { l } ^ { t }$
|
| 122 |
+
|
| 123 |
+
To simplify notations, we drop the superscripts and subscripts. From Proposition 3.2,
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
\alpha = \frac { \| \mathbf { b } \odot \mathbf { d } \odot \mathbf { w } \| _ { 1 } } { \| \mathbf { b } \odot \mathbf { d } \| _ { 1 } } , \ \mathbf { b } = \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) .
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
We now consider how to solve for $\alpha$ . First, we introduce some notations. Given a vector $\mathbf { x } = [ x _ { 1 } , x _ { 2 } , \ldots , x _ { n } ]$ , and an indexing vector $\mathbf { s } \in \mathbb { R } ^ { n }$ whose entries are a permutation of $\{ 1 , \ldots , n \}$ , $\mathrm { p e r m } _ { \mathbf { s } } ( \mathbf { x } )$ returns the vector $[ x _ { s _ { 1 } } , x _ { s _ { 2 } } , \ldots x _ { s _ { n } } ]$ , and $\begin{array} { r } { \mathsf { c u m } ( \mathbf { x } ) = [ x _ { 1 } , \sum _ { i = 1 } ^ { 2 } x _ { i } , \hdots , \sum _ { i = 1 } ^ { n } x _ { i } ] } \end{array}$ returns partial sums for elements in $\mathbf { x }$ . For example, let $\mathbf { a } ~ = ~ \left[ 1 , - 1 , - 2 \right]$ , and $\mathbf { b } ~ = ~ [ 3 , 1 , 2 ]$ . Then, $\mathrm { \bar { p e r m } _ { b } ( a ) = [ - 2 , 1 , - 1 ] }$ and $\mathtt { c u m } ( \mathbf { a } ) = [ 1 , 0 ^ { \overline { { \prime } } } , - 2 ]$ .
|
| 130 |
+
|
| 131 |
+
We sort elements of $| \mathbf { w } |$ in descending order, and let the vector containing the sorted indices be s. For example, if $\mathbf { w } = [ 1 , 0 , - 2 ]$ , then $\mathbf { s } = [ 3 , 1 , 2 ]$ . From (8),
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\alpha = \frac { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \odot \mathbf { w } \| _ { 1 } } { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \| _ { 1 } } = \frac { [ \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } } ( | \mathbf { d } \odot \mathbf { w } | ) ) ] _ { j } } { [ \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } } ( | \mathbf { d } | ) ) ] _ { j } } = 2 c _ { j } ,
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where $\mathbf { c } = \mathbf { c u m } ( \mathrm { p e r m } _ { \mathbf { s } } ( | \mathbf { d } \odot \mathbf { w } | ) ) \oslash \mathbf { c u m } ( \mathrm { p e r m } _ { \mathbf { s } } ( \mathbf { d } ) ) \oslash 2$ , and $j$ is the index such that
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
[ \mathrm { p e r m } _ { \mathbf { s } } ( | \mathbf { w } | ) ] _ { j } > c _ { j } > [ \mathrm { p e r m } _ { \mathbf { s } } ( | \mathbf { w } | ) ] _ { j + 1 } .
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
For simplicity of notations, let the dimensionality of w (and thus also of $\mathbf { c }$ ) be $n$ , and the operation find(condition $\mathbf { \tau } ( \mathbf { x } )$ ) returns all indices in $\mathbf { x }$ that satisfies the condition. It is easy to see that any $j$ satisfying (10) is in $S \equiv \mathrm { f i n d } ( [ \mathrm { p e r m } _ { \mathbf { s } } ( | { \mathbf { w } } | ) ] _ { [ 1 : ( n - 1 ) ] } - \mathbf { c } _ { [ 1 : ( n - 1 ) ] } ) \odot ( [ \mathrm { p e r m } _ { \mathbf { s } } ( | { \mathbf { w } } | ) ] _ { [ 2 : n ] } - \mathbf { c } _ { [ 1 : n - 1 ] } ) < \delta$ 0), where $\mathbf { c } _ { [ 1 : ( n - 1 ) ] }$ is the subvector of c with elements in the index range 1 to $n - 1$ . The optimal $\alpha \ : ( = \ : 2 c _ { j } )$ ) is then the one which yields the smallest objective in (6), which can be simplified by Proposition 3.3 below. The procedure is shown in Algorithm 1.
|
| 144 |
+
|
| 145 |
+
Propositio $\begin{array} { r l r } & { } & { \textbf { n 3 3 } T h e o p t i m a l \alpha _ { l } ^ { t } \ o f ( 6 ) e q u a l s \ 2 \arg \operatorname* { m a x } _ { c _ { j } : j \in S } c _ { j } ^ { 2 } \cdot \big [ c u m ( p e r m _ { \mathrm { s } } ( \mathbf { d } _ { l } ^ { t - 1 } ) ) \big ] _ { j } . } \end{array}$
|
| 146 |
+
|
| 147 |
+
# Algorithm 1 Exact solver of (6)
|
| 148 |
+
|
| 149 |
+
1: Input: full-precision weight $\mathbf { w } _ { l } ^ { t }$ , diagonal entries of the approximate Hessian $\mathbf { d } _ { l } ^ { t - 1 }$ .
|
| 150 |
+
2: $\mathbf { s } = \arg \operatorname { s o r t } ( | \mathbf { w } _ { l } ^ { t } | )$ ;
|
| 151 |
+
3: $\mathbf { c } = \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } } ( | \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } | ) ) \oslash \mathrm { c u m ( p e r m } _ { \mathbf { s } } ( \mathbf { d } _ { l } ^ { t - 1 } ) ) \oslash 2 ;$
|
| 152 |
+
4: $\begin{array} { r } { S = \mathrm { { f i n d } } ( ( \left[ { \mathrm { p e r m } } _ { \mathrm { s } } ( | \mathbf { w } _ { l } ^ { t } | ) \right] _ { [ 1 : ( n - 1 ) ] } - \mathbf { c } _ { [ 1 : ( n - 1 ) ] } ) ( } \end{array}$ $\odot$ ([perms(|wtl |)][2:n] − c[1:n−1]) < 0);
|
| 153 |
+
5: $\begin{array} { r } { \alpha _ { l } ^ { t } = 2 \arg \operatorname* { m a x } _ { c _ { j } : j \in \mathcal { S } } c _ { j } ^ { 2 } \cdot [ \mathsf { c u m } ( \mathsf { p e r m } _ { \mathsf { s } } ( \mathbf { d } _ { l } ^ { t - 1 } ) ) ] _ { j } } \end{array}$ ;
|
| 154 |
+
6: $\mathbf { b } _ { l } ^ { t } = \mathbf { I } _ { \alpha _ { l } ^ { t } / 2 } ( \mathbf { w } _ { l } ^ { t } )$ ;
|
| 155 |
+
7: Output: $\hat { \mathbf { w } } _ { l } ^ { t } = \alpha _ { l } ^ { t } \mathbf { b } _ { l } ^ { t }$ .
|
| 156 |
+
|
| 157 |
+
# 3.1.2 APPROXIMATE SOLUTION OF $\alpha _ { l } ^ { t }$
|
| 158 |
+
|
| 159 |
+
In case the sorting operation in step 2 is expensive, $\alpha _ { l } ^ { t }$ and $\mathbf { b } _ { l } ^ { t }$ can be obtained by alternating the iteration in Proposition 3.2 (Algorithm 2). Empirically, it converges very fast, usually in 5 iterations.
|
| 160 |
+
|
| 161 |
+
# Algorithm 2 Approximate solver for (6).
|
| 162 |
+
|
| 163 |
+
1: Input: $\mathbf { b } _ { l } ^ { t - 1 }$ , full-precision weight $\mathbf { w } _ { l } ^ { t }$ , diagonal entries of the approximate Hessian $\mathbf { d } _ { l } ^ { t - 1 }$ .
|
| 164 |
+
2: Initialize: $\alpha = 1 . 0$ , $\alpha _ { \mathrm { o l d } } = 0 . 0 , \mathbf { b } = \mathbf { b } _ { l } ^ { t - 1 }$ , $\epsilon = 1 0 ^ { - 6 }$ ;
|
| 165 |
+
3: while $| \alpha - \alpha _ { \mathrm { o l d } } | > \epsilon$ do
|
| 166 |
+
4: $\alpha _ { 0 } { } _ { \mathrm { l d } } = \alpha$ ;
|
| 167 |
+
5: $\begin{array} { r } { \alpha = \frac { \| \mathbf { b } \odot \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } \| _ { 1 } } { \| \mathbf { b } \odot \mathbf { d } _ { l } ^ { t - 1 } \| _ { 1 } } } \end{array}$ ;
|
| 168 |
+
6: $\mathbf { b } = \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } _ { l } ^ { t } )$ ;
|
| 169 |
+
7: end while
|
| 170 |
+
8: Output: $\hat { \mathbf { w } } _ { l } ^ { t } = \alpha \mathbf { b }$ .
|
| 171 |
+
|
| 172 |
+
# 3.2 EXTENSION TO TERNARIZATION WITH TWO SCALING PARAMETERS
|
| 173 |
+
|
| 174 |
+
As in TTQ (Zhu et al., 2017), we can use different scaling parameters for the positive and negative weights in each layer. The optimization subproblem at the tth iteration then becomes:
|
| 175 |
+
|
| 176 |
+
$$
|
| 177 |
+
\begin{array} { r l } { \operatorname* { m i n } _ { \hat { \mathbf { w } } ^ { t } } } & { \nabla \ell ( \hat { \mathbf { w } } ^ { t - 1 } ) ^ { \top } ( \hat { \mathbf { w } } ^ { t } - \hat { \mathbf { w } } ^ { t - 1 } ) + \displaystyle \frac { 1 } { 2 } ( \hat { \mathbf { w } } ^ { t } - \hat { \mathbf { w } } ^ { t - 1 } ) ^ { \top } \mathbf { D } ^ { t - 1 } ( \hat { \mathbf { w } } ^ { t } - \hat { \mathbf { w } } ^ { t - 1 } ) } \\ { \mathrm { s . t . } } & { \quad \hat { \mathbf { w } } _ { l } ^ { t } \in \{ - \beta _ { l } ^ { t } , 0 , \alpha _ { l } ^ { t } \} ^ { n _ { l } } , \alpha _ { l } ^ { t } > 0 , \beta _ { l } ^ { t } > 0 , l = 1 , \ldots , L . } \end{array}
|
| 178 |
+
$$
|
| 179 |
+
|
| 180 |
+
Proposition 3.4 The optimal $\begin{array} { r l } & { \frac { \| \mathbf { p } _ { l } ^ { t } \odot \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } \| _ { 1 } } { \| \mathbf { p } _ { l } ^ { t } \odot \mathbf { d } _ { l } ^ { t - 1 } \| _ { 1 } } , \mathbf { p } _ { l } ^ { t } = \mathbf { I } _ { \alpha _ { l } ^ { t } / 2 } ^ { + } ( \mathbf { w } _ { l } ^ { t } ) , \beta _ { l } ^ { t } = \frac { \| \mathbf { q } _ { l } ^ { t } \odot \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } \| _ { 1 } } { \| \mathbf { q } _ { l } ^ { t } \odot \mathbf { d } _ { l } ^ { t - 1 } \| _ { 1 } } } \end{array}$ $\hat { \mathbf { w } } _ { l } ^ { t }$ in (5) is of the form , and $\begin{array} { r c l } { \hat { \mathbf { w } } _ { l } ^ { t } } & { = } & { \alpha _ { l } ^ { t } \mathbf { p } _ { l } ^ { t } + \beta _ { l } ^ { t } \mathbf { q } _ { l } ^ { t } } \end{array}$ $\mathbf { q } _ { l } ^ { t } = \mathbf { I } _ { \beta _ { l } ^ { t } / 2 } ^ { - } ( \mathbf { w } _ { l } ^ { t } )$ . , where $\begin{array} { r l } { \alpha _ { l } ^ { t } } & { { } = } \end{array}$
|
| 181 |
+
|
| 182 |
+
The exact and approximate solutions for $\alpha _ { l } ^ { t }$ and $\beta _ { l } ^ { t }$ can be obtained in a similar way as in Sections 3.1.1 and 3.1.2. Details are in Appendix C.
|
| 183 |
+
|
| 184 |
+
# 3.3 EXTENSION TO LOW-BIT QUANTIZATION
|
| 185 |
+
|
| 186 |
+
For $m$ -bit quantization, we simply change the set $\mathcal { Q }$ of desired quantized values in (3) to one with $k = 2 ^ { m - 1 } - 1$ quantized values. The optimization still contains a gradient descent step with adaptive learning rates like LAT, and a quantization step which can be solved efficiently by alternating minimization of $( \alpha , \mathbf { b } )$ (similar to the procedure in Algorithm 2) using the following Proposition.
|
| 187 |
+
|
| 188 |
+
Proposition 3.5 Let the optimal $\hat { \mathbf { w } } _ { l } ^ { t }$ in (6) be of the form αb. For a fixed b, $\begin{array} { r } { \alpha = \frac { \| \mathbf b \odot \mathbf d _ { l } ^ { t - 1 } \odot \mathbf w _ { l } ^ { t } \| _ { 1 } } { \| \mathbf b \odot \mathbf d _ { l } ^ { t - 1 } \| _ { 1 } } } \end{array}$ ; whereas when linear quantiza $\alpha$ is fixeon and $\mathbf { b } = \Pi _ { \mathcal { Q } } ( \frac { \mathbf { w } _ { l } ^ { t } } { \alpha } )$ $\begin{array} { r } { \mathcal { Q } = \left\{ - 1 , - \frac { k - 1 } { k } , \dots , - \frac { 1 } { k } , 0 , \frac { 1 } { k } , \dots , \frac { k - 1 } { k } , 1 \right\} } \end{array}$ forion. $\begin{array} { r } { \mathcal { Q } = \left\{ - 1 , - \frac { 1 } { 2 } , \ldots , - \frac { 1 } { 2 ^ { k - 1 } } , 0 , \frac { 1 } { 2 ^ { k - 1 } } , \ldots , \frac { 1 } { 2 } , 1 \right\} } \end{array}$
|
| 189 |
+
|
| 190 |
+
# 4 EXPERIMENTS
|
| 191 |
+
|
| 192 |
+
In this section, we perform experiments on both feedforward and recurrent neural networks. The following methods are compared: (i) the original full-precision network; (ii) weight-binarized networks, including BinaryConnect (Courbariaux et al., 2015), Binary-Weight-Network (BWN) (Rastegari et al., 2016), and Loss-Aware Binarized network (LAB) (Hou et al., 2017); (iii) weightternarized networks, including Ternary Weight Networks (TWN) (Li & Liu, 2016), Trained Ternary Quantization $( \mathrm { T T Q } ) ^ { 2 }$ (Zhu et al., 2017), the proposed Loss-Aware Ternarized network with exact solution (LATe), approximate solution (LATa), and with two scaling parameters (LAT2e and LAT2a); (iv) $m$ -bit-quantized networks (where $m > 2$ ), including DoReFa-Netm (Zhou et al., 2016), the proposed loss-aware quantized network with linear quantization (LAQm(linear)), and logarithmic quantization $\left( \mathrm { L A Q m } ( \log ) \right)$ . Since weight quantization can be viewed as a form of regularization (Courbariaux et al., 2015), we do not use other regularizers such as dropout and weight decay.
|
| 193 |
+
|
| 194 |
+
# 4.1 FEEDFORWARD NETWORKS
|
| 195 |
+
|
| 196 |
+
In this section, we perform experiments with the multilayer perceptron (on the MNIST data set) and convolutional neural networks (on CIFAR-10, CIFAR-100 and SVHN). For MNIST, CIFAR-10, and SVHN, the setup is similar to that in (Courbariaux et al., 2015; Hou et al., 2017). Details can be found in Appendix D. For CIFAR-100, we use 45, 000 images for training, another 5, 000 for validation, and the remaining 10, 000 for testing. The testing errors are shown in Table 1.
|
| 197 |
+
|
| 198 |
+
Ternarization: On MNIST, CIFAR100 and SVHN, the weight-ternarized networks perform better than weight-binarized networks, and are comparable to the full-precision networks. Among the weight-ternarized networks, the proposed LAT and its variants have the lowest errors. On CIFAR-10, LATa has similar performance as the full-precision network, but is outperformed by BinaryConnect.
|
| 199 |
+
|
| 200 |
+
Figure 1(a) shows convergence of the training loss for LATa on CIFAR-10, and Figure 1(b) shows the scaling parameter obtained at each CNN layer. As can be seen, the scaling parameters for the first and last layers (conv1 and linear3, respectively) are larger than the others. This agrees with the finding that, to maintain the activation variance and back-propagated gradients variance during the forward and backward propagations, the variance of the weights between the lth and $( l + 1 )$ th layers should roughly follow $2 / ( n _ { l } + n _ { l + 1 } )$ (Glorot & Bengio, 2010). Hence, as the input and output layers are small, larger scaling parameters are needed for their high-variance weights.
|
| 201 |
+
|
| 202 |
+
Table 1: Testing errors $( \% )$ on the feedforward networks. Algorithm with the lowest error in each group is highlighted.
|
| 203 |
+
|
| 204 |
+
<table><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-100</td><td rowspan=1 colspan=1>SVHN</td></tr><tr><td rowspan=1 colspan=2>no binarization full-precision</td><td rowspan=1 colspan=1>1.11</td><td rowspan=1 colspan=1>10.38</td><td rowspan=1 colspan=1>39.06</td><td rowspan=1 colspan=1>2.28</td></tr><tr><td rowspan=3 colspan=2>BinaryConnectbinarization BWNLAB</td><td rowspan=1 colspan=1>1.28</td><td rowspan=1 colspan=1>9.86</td><td rowspan=1 colspan=1>46.42</td><td rowspan=1 colspan=1>2.45</td></tr><tr><td rowspan=1 colspan=1>1.31</td><td rowspan=1 colspan=1>10.51</td><td rowspan=1 colspan=1>43.62</td><td rowspan=1 colspan=1>2.54</td></tr><tr><td rowspan=1 colspan=1>1.18</td><td rowspan=1 colspan=1>10.50</td><td rowspan=1 colspan=1>43.06</td><td rowspan=1 colspan=1>2.35</td></tr><tr><td rowspan=9 colspan=2>TWN1 scaling LATeternarization LATaTTQ2 scaling LAT2eLAT2aDoReFa-Net33-bit quantization LAQ3(linear)LAQ3(log)</td><td rowspan=1 colspan=1>1.23</td><td rowspan=1 colspan=1>10.64</td><td rowspan=1 colspan=1>43.49</td><td rowspan=1 colspan=1>2.37</td></tr><tr><td rowspan=1 colspan=1>1.15</td><td rowspan=1 colspan=1>10.47</td><td rowspan=1 colspan=1>39.10</td><td rowspan=1 colspan=1>2.30</td></tr><tr><td rowspan=1 colspan=1>1.14</td><td rowspan=1 colspan=1>10.38</td><td rowspan=1 colspan=1>39.19</td><td rowspan=1 colspan=1>2.30</td></tr><tr><td rowspan=1 colspan=1>1.20</td><td rowspan=1 colspan=1>10.59</td><td rowspan=1 colspan=1>42.09</td><td rowspan=1 colspan=1>2.38</td></tr><tr><td rowspan=1 colspan=1>1.20</td><td rowspan=1 colspan=1>10.45</td><td rowspan=1 colspan=1>39.01</td><td rowspan=1 colspan=1>2.34</td></tr><tr><td rowspan=1 colspan=1>1.19</td><td rowspan=1 colspan=1>10.48</td><td rowspan=1 colspan=1>38.84</td><td rowspan=1 colspan=1>2.35</td></tr><tr><td rowspan=1 colspan=1>1.31</td><td rowspan=1 colspan=1>10.54</td><td rowspan=1 colspan=1>45.05</td><td rowspan=1 colspan=1>2.39</td></tr><tr><td rowspan=1 colspan=1>LAQ3(linear)</td><td rowspan=1 colspan=1>1.20</td><td rowspan=1 colspan=1>10.67</td><td rowspan=1 colspan=1>38.70</td><td rowspan=1 colspan=1>2.34</td></tr><tr><td rowspan=1 colspan=1>1.16</td><td rowspan=1 colspan=1>10.52</td><td rowspan=1 colspan=1>38.50</td><td rowspan=1 colspan=1>2.29</td></tr></table>
|
| 205 |
+
|
| 206 |
+

|
| 207 |
+
Figure 1: Convergence of the training loss and scaling parameter by LATa on CIFAR-10.
|
| 208 |
+
|
| 209 |
+
Using Two Scaling Parameters: Compared to TTQ, the proposed LAT2 always has better performance. However, the extra flexibility of using two scaling parameters does not always translate to lower testing error. As can be seen, it outperforms algorithms with one scaling parameter only on CIFAR-100. We speculate this is because the capacities of deep networks are often larger than needed, and so the limited expressiveness of quantized weights may not significantly deteriorate performance. Indeed, as pointed out in (Courbariaux et al., 2015), weight quantization is a form of regularization, and can contribute positively to the performance.
|
| 210 |
+
|
| 211 |
+
Using More Bits: Among the 3-bit quantization algorithms, the proposed scheme with logarithmic quantization has the best performance. It also outperforms the other quantization algorithms on CIFAR-100 and SVHN. However, as discussed above, more quantization flexibility is useful only when the weight-quantized network does not have enough capacity.
|
| 212 |
+
|
| 213 |
+
# 4.2 RECURRENT NETWORKS
|
| 214 |
+
|
| 215 |
+
In this section, we follow (Hou et al., 2017) and perform character-level language modeling experiments on the long short-term memory (LSTM) (Hochreiter & Schmidhuber, 1997). The training objective is the cross-entropy loss over all target sequences. Experiments are performed on three data sets: (i) Leo Tolstoy’s War and Peace; (ii) source code of the Linux Kernel; and (iii) Penn Treebank Corpus (Taylor et al., 2003). For the first two, we follow the setting in (Karpathy et al., 2016; Hou et al., 2017). For Penn Treebank, we follow the setting in (Mikolov & Zweig, 2012). In the experiment, we tried different initializations for TTQ and then report the best. Cross-entropy values on the test set are shown in Table 2.
|
| 216 |
+
|
| 217 |
+
Table 2: Testing cross-entropy values on the LSTM. Algorithm with the lowest cross-entropy value in each group is highlighted.
|
| 218 |
+
|
| 219 |
+
<table><tr><td></td><td></td><td></td><td></td><td rowspan=1 colspan=1>War and Peace</td><td rowspan=1 colspan=1>Linux Kernel</td><td rowspan=1 colspan=1>PennTreebank</td></tr><tr><td rowspan=1 colspan=4>no binarization full-precision</td><td rowspan=1 colspan=1>1.268</td><td rowspan=1 colspan=1>1.326</td><td rowspan=1 colspan=1>1.083</td></tr><tr><td rowspan=3 colspan=4>BinaryConnectbinarization BWNLAB</td><td rowspan=1 colspan=1>2.942</td><td rowspan=1 colspan=1>3.532</td><td rowspan=1 colspan=1>1.737</td></tr><tr><td rowspan=1 colspan=3>BWN</td><td rowspan=1 colspan=1>1.313</td><td rowspan=1 colspan=1>1.307</td><td rowspan=1 colspan=1>1.078</td></tr><tr><td rowspan=1 colspan=1>1.291</td><td rowspan=1 colspan=1>1.305</td><td rowspan=1 colspan=1>1.081</td></tr><tr><td rowspan=6 colspan=4>TWN1 scaling LATeternarization LATaTTQ2 scaling LAT2eLAT2a</td><td rowspan=1 colspan=1>1.290</td><td rowspan=1 colspan=1>1.280</td><td rowspan=1 colspan=1>1.045</td></tr><tr><td rowspan=1 colspan=1>1.248</td><td rowspan=1 colspan=1>1.256</td><td rowspan=1 colspan=1>1.022</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>LATa</td><td rowspan=1 colspan=1>1.253</td><td rowspan=1 colspan=1>1.264</td><td rowspan=1 colspan=1>1.024</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>TTQ</td><td rowspan=1 colspan=1>1.272</td><td rowspan=1 colspan=1>1.302</td><td rowspan=1 colspan=1>1.031</td></tr><tr><td rowspan=1 colspan=1>ng</td><td rowspan=1 colspan=1>LAT2e</td><td rowspan=1 colspan=1>1.239</td><td rowspan=1 colspan=1>1.258</td><td rowspan=1 colspan=1>1.018</td></tr><tr><td rowspan=1 colspan=1>1.245</td><td rowspan=1 colspan=1>1.258</td><td rowspan=1 colspan=1>1.015</td></tr><tr><td rowspan=3 colspan=4>DoReFa-Net33-bit quantization LAQ3(linear)LAQ3(log)</td><td rowspan=1 colspan=1>1.349</td><td rowspan=1 colspan=1>1.276</td><td rowspan=1 colspan=1>1.017</td></tr><tr><td rowspan=1 colspan=1>1.282</td><td rowspan=1 colspan=1>1.327</td><td rowspan=1 colspan=1>1.017</td></tr><tr><td rowspan=1 colspan=1>1.268</td><td rowspan=1 colspan=1>1.273</td><td rowspan=1 colspan=1>1.009</td></tr><tr><td rowspan=3 colspan=4>DoReFa-Net44-bit quantization LAQ4 (linear)LAQ4 (log)</td><td rowspan=1 colspan=1>1.328</td><td rowspan=1 colspan=1>1.320</td><td rowspan=1 colspan=1>1.019</td></tr><tr><td rowspan=1 colspan=3>LAQ4 (linear)</td><td rowspan=1 colspan=1>1.294</td><td rowspan=1 colspan=1>1.337</td><td rowspan=1 colspan=1>1.046</td></tr><tr><td rowspan=1 colspan=1>1.272</td><td rowspan=1 colspan=1>1.319</td><td rowspan=1 colspan=1>1.016</td></tr></table>
|
| 220 |
+
|
| 221 |
+
Ternarization: As in Section 4.1, the proposed LATe and LATa outperform the other weight ternarization schemes, and are even better than the full-precision network on all three data sets. Figure 2 shows convergence of the training and validation losses on War and Peace. Among the ternarization methods, LAT and its variants converge faster than both TWN and TTQ.
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
Figure 2: Convergence of the training and validation losses on War and Peace.
|
| 225 |
+
|
| 226 |
+
Using Two Scaling Parameters: LAT2e and LAT2a outperform TTQ on all three data sets. They also perform better than using one scaling parameter on War and Peace and Penn Treebank.
|
| 227 |
+
|
| 228 |
+
Using More Bits: The proposed LAQ always outperforms DoReFa-Net when 3 or 4 bits are used. As noted in Section 4.1, using more bits does not necessarily yield better generalization performance, and ternarization (using 2 bits) yields the lowest validation loss on War and Peace and Linux Kernel. Moreover, logarithmic quantization is better than linear quantization. Figure 3 shows distributions of the input-to-hidden (full-precision and quantized) weights of the input gate trained after 20 epochs using LAQ3(linear) and LAQ3(log) (results on the other weights are similar). As can be seen, distributions of the full-precision weights are bell-shaped. Hence, logarithmic quantization can give finer resolutions to many of the weights which have small magnitudes.
|
| 229 |
+
|
| 230 |
+

|
| 231 |
+
Figure 3: Distributions of the full-precision and LAQ3-quantized weights on War and Peace. Left ((a) and (b)): Linear quantization; Right ((c) and (d)): Logarithmic quantization.
|
| 232 |
+
|
| 233 |
+
Quantized vs Full-precision Networks: The quantized networks often perform better than the fullprecision networks. We speculate that this is because deep networks often have larger-than-needed capacities, and so are less affected by the limited expressiveness of quantized weights. Moreover, low-bit quantization acts as regularization, and so contributes positively to the performance.
|
| 234 |
+
|
| 235 |
+
# 5 CONCLUSION
|
| 236 |
+
|
| 237 |
+
In this paper, we proposed a loss-aware weight quantization algorithm that directly considers the effect of quantization on the loss. The problem is solved using the proximal Newton algorithm. Each iteration consists of a preconditioned gradient descent step and a quantization step that projects fullprecision weights onto a set of quantized values. For ternarization, an exact solution and an efficient approximate solution are provided. The procedure is also extended to the use of different scaling parameters for the positive and negative weights, and to $m$ -bit (where $m > 2$ ) quantization. Experiments on both feedforward and recurrent networks show that the proposed quantization scheme outperforms the current state-of-the-art.
|
| 238 |
+
|
| 239 |
+
# ACKNOWLEDGMENTS
|
| 240 |
+
|
| 241 |
+
This research was supported in part by the Research Grants Council of the Hong Kong Special Administrative Region (Grant 614513). We thank the developers of Theano (Theano Development Team, 2016), Pylearn2 (Goodfellow et al., 2013) and Lasagne. We also thank NVIDIA for the gift of GPU card.
|
| 242 |
+
|
| 243 |
+
# REFERENCES
|
| 244 |
+
|
| 245 |
+
S. Boyd, N. Parikh, E. Chu, B. Peleato, and J. Eckstein. Distributed optimization and statistical learning via the alternating direction method of multipliers. Foundations and Trends in Machine Learning, 3(1):1–122, 2011.
|
| 246 |
+
M. Courbariaux, Y. Bengio, and J. P. David. BinaryConnect: Training deep neural networks with binary weights during propagations. In Advances in Neural Information Processing Systems, pp. 3105–3113, 2015.
|
| 247 |
+
Y. Dauphin, H. de Vries, and Y. Bengio. Equilibrated adaptive learning rates for non-convex optimization. In Advances in Neural Information Processing Systems, pp. 1504–1512, 2015.
|
| 248 |
+
X. Glorot and Y. Bengio. Understanding the difficulty of training deep feedforward neural networks. In International Conference on Artificial Intelligence and Statistics, pp. 249–256, 2010.
|
| 249 |
+
I. J. Goodfellow, D. Warde-Farley, P. Lamblin, V. Dumoulin, M. Mirza, R. Pascanu, J. Bergstra, F. Bastien, and Y. Bengio. Pylearn2: a machine learning research library. Preprint, 2013.
|
| 250 |
+
S. Han, J. Pool, J. Tran, and W. J. Dally. Learning both weights and connections for efficient neural network. In Advances in Neural Information Processing Systems, pp. 1135–1143, 2015.
|
| 251 |
+
S. Han, H. Mao, and W. J. Dally. Deep compression: Compressing deep neural network with pruning, trained quantization and Huffman coding. In International Conference on Learning Representations, 2016.
|
| 252 |
+
K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In International Conference on Computer Vision and Pattern Recognition, pp. 770–778, 2016.
|
| 253 |
+
S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, pp. 1735–1780, 1997.
|
| 254 |
+
L. Hou, Q. Yao, and J. T. Kwok. Loss-aware binarization of deep networks. In International Conference on Learning Representations, 2017.
|
| 255 |
+
A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam. MobileNets: Efficient convolutional neural networks for mobile vision applications. Preprint arXiv:1704.04861, 2017.
|
| 256 |
+
F. N. Iandola, S. Han, M. W. Moskewicz, K. Ashraf, W. J. Dally, and K. Keutzer. Squeezenet: Alexnet-level accuracy with 50x fewer parameters and ${ < } 0 . 5 \mathrm { M B }$ model size. Preprint arXiv:1602.07360, 2016.
|
| 257 |
+
A. Karpathy, J. Johnson, and F. F. Li. Visualizing and understanding recurrent networks. In International Conference on Learning Representations, 2016.
|
| 258 |
+
Y. D. Kim, E. Park, S. Yoo, T. Choi, L. Yang, and D. Shin. Compression of deep convolutional neural networks for fast and low power mobile applications. In International Conference on Learning Representations, 2016.
|
| 259 |
+
D. Kingma and J. Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
|
| 260 |
+
V. Lebedev, Y. Ganin, M. Rakhuba, I. Oseledets, and V. Lempitsky. Speeding-up convolutional neural networks using fine-tuned cp-decomposition. Preprint arXiv:1412.6553, 2014.
|
| 261 |
+
Y. LeCun, Y. Bengio, and G. Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
|
| 262 |
+
J. D. Lee, Y. Sun, and M. A. Saunders. Proximal Newton-type methods for minimizing composite functions. SIAM Journal on Optimization, 24(3):1420–1443, 2014.
|
| 263 |
+
C. Leng, H. Li, S. Zhu, and R. Jin. Extremely low bit neural network: Squeeze the last bit out with admm. Preprint arXiv:1707.09870, 2017.
|
| 264 |
+
F. Li and B. Liu. Ternary weight networks. Preprint arXiv:1605.04711, 2016.
|
| 265 |
+
H. Li, S. De, Z. Xu, C. Studer, H. Samet, and Goldstein T. Training quantized nets: A deeper understanding. In Advances in Neural Information Processing Systems, 2017a.
|
| 266 |
+
H. Li, A. Kadav, I. Durdanovic, H. Samet, and H. P. Graf. Pruning filters for efficient convnets. In International Conference on Learning Representations, 2017b.
|
| 267 |
+
D. Lin, S. Talathi, and S. Annapureddy. Fixed point quantization of deep convolutional networks. In International Conference on Machine Learning, pp. 2849–2858, 2016a.
|
| 268 |
+
Z. Lin, M. Courbariaux, R. Memisevic, and Y. Bengio. Neural networks with few multiplications. In International Conference on Learning Representations, 2016b.
|
| 269 |
+
N. Mellempudi, A. Kundu, D. Mudigere, D. Das, B. Kaul, and P. Dubey. Ternary neural networks with fine-grained quantization. Preprint arXiv:1705.01462, 2017.
|
| 270 |
+
T. Mikolov and G. Zweig. Context dependent recurrent neural network language model. IEEE Spoken Language Technology Workshop, 12:234–239, 2012.
|
| 271 |
+
D. Miyashita, E. H. Lee, and B. Murmann. Convolutional neural networks using logarithmic data representation. Preprint arXiv:1603.01025, 2016.
|
| 272 |
+
P. Molchanov, S. Tyree, T. Karras, T. Aila, and J. Kautz. Pruning convolutional neural networks for resource efficient transfer learning. In International Conference on Learning Representations, 2017.
|
| 273 |
+
A. Novikov, D. Podoprikhin, A. Osokin, and D. P. Vetrov. Tensorizing neural networks. In Advances in Neural Information Processing Systems, pp. 442–450, 2015.
|
| 274 |
+
A. Rakotomamonjy, R. Flamary, and G. Gasso. DC proximal Newton for nonconvex optimization problems. IEEE Transactions on Neural Networks and Learning Systems, 27(3):636–647, 2016.
|
| 275 |
+
M. Rastegari, V. Ordonez, J. Redmon, and A. Farhadi. XNOR-Net: ImageNet classification using binary convolutional neural networks. In European Conference on Computer Vision, 2016.
|
| 276 |
+
C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In International Conference on Computer Vision and Pattern Recognition, pp. 1–9, 2015.
|
| 277 |
+
A. Taylor, M. Marcus, and B. Santorini. The Penn treebank: An overview. In Treebanks, pp. 5–22. Springer, 2003.
|
| 278 |
+
Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. Preprint arXiv:1605.02688, 2016.
|
| 279 |
+
F. P. Vasilyev, E. V. Khoroshilova, and A. S. Antipin. An extragradient method for finding the saddle point in an optimal control problem. Moscow University Computational Mathematics and Cybernetics, 34(3):113–118, 2010.
|
| 280 |
+
X. Zhang, X. Zhou, M. Lin, and J. Sun. ShuffleNet: An extremely efficient convolutional neural network for mobile devices. Preprint arXiv:1707.01083, 2017.
|
| 281 |
+
S. Zhou, Z. Ni, X. Zhou, H. Wen, Y. Wu, and Y. Zou. DoReFa-Net: Training low bitwidth convolutional neural networks with low bitwidth gradients. Preprint arXiv:1606.06160, 2016.
|
| 282 |
+
C. Zhu, S. Han, H. Mao, and W. J. Dally. Trained ternary quantization. In International Conference on Learning Representations, 2017.
|
| 283 |
+
|
| 284 |
+
# A PROOFS
|
| 285 |
+
|
| 286 |
+
A.1 PROOF OF PROPOSITION 3.1
|
| 287 |
+
|
| 288 |
+
With $\mathbf { w } _ { l } ^ { t }$ in (7), the objective in (5) can be rewritten as
|
| 289 |
+
|
| 290 |
+
$$
|
| 291 |
+
\begin{array} { r l } { { \nabla \ell ( \widetilde { \mathbf { w } } ^ { t - 1 } ) ^ { \top } ( \widetilde { \mathbf { w } } ^ { t } - \widetilde { \mathbf { w } } ^ { t - 1 } ) + \frac { 1 } { 2 } ( \widetilde { \mathbf { w } } ^ { t } - \widetilde { \mathbf { w } } ^ { t - 1 } ) ^ { \top } \mathbf { D } ^ { t - 1 } ( \widetilde { \mathbf { w } } ^ { t } - \widetilde { \mathbf { w } } ^ { t - 1 } ) } } \\ { = } & { \frac { 1 } { 2 } \sum _ { t = 1 } ^ { L } ( \sqrt { \mathbf { d } _ { t } ^ { t - 1 } } ^ { \top } ( \widetilde { \mathbf { w } } _ { t } ^ { t } - ( \widetilde { \mathbf { w } } _ { t } ^ { t - 1 } - \nabla _ { t } \ell ( \widetilde { \mathbf { w } } ^ { t - 1 } ) \mathcal { O } \mathbf { d } _ { t } ^ { t - 1 } ) ) ) ^ { 2 } + c _ { 1 } } \\ & { = } & { \frac { 1 } { 2 } \sum _ { t = 1 } ^ { L } ( \sqrt { \mathbf { d } _ { t } ^ { t - 1 } } ^ { \top } ( \widetilde { \mathbf { w } } _ { t } ^ { t } - \mathbf { w } _ { t } ^ { t } ) ) ^ { 2 } + c _ { 1 } } \\ { = } & { \frac { 1 } { 2 } \sum _ { t = 1 } ^ { L } ( \sqrt { \mathbf { d } _ { t } ^ { t - 1 } } ^ { \top } ( \alpha _ { t } ^ { t } \mathbf { b } _ { t } ^ { t } - \mathbf { w } _ { t } ^ { t } ) ) ^ { 2 } + c _ { 1 } } \\ & { = } & { \frac { 1 } { 2 } \sum _ { t = 1 } ^ { L } ( \sqrt { \mathbf { d } _ { t } ^ { t - 1 } } ^ { \top } ( \alpha _ { t } ^ { t } \mathbf { b } _ { t } ^ { t } - \mathbf { w } _ { t } ^ { t } ) ) ^ { 2 } + c _ { 1 } } \\ { = } & { \frac { 1 } { 2 } \sum _ { t = 1 } ^ { L } \frac { m } { \mathbf { d } _ { t } ^ { t } - \mathbf { \Phi } } \mathbf { d } _ { t } ^ { t } - \mathbf { w } _ { t } ^ { t } _ { t } - \mathbf { w } _ { t } ^ { t } _ { t } ^ { 2 } + c _ { 1 } , } \end{array}
|
| 292 |
+
$$
|
| 293 |
+
|
| 294 |
+
where $\begin{array} { r } { c _ { 1 } = - \frac { 1 } { 2 } \big ( \sqrt { \mathbf { d } _ { l } ^ { t - 1 } } ^ { \top } ( \nabla _ { l } \ell ( \hat { \mathbf { w } } ^ { t - 1 } ) \oslash \mathbf { d } _ { l } ^ { t - 1 } ) \big ) ^ { 2 } } \end{array}$ is independent of $\alpha _ { l } ^ { t }$ and $\mathbf { b } _ { l } ^ { t }$
|
| 295 |
+
|
| 296 |
+
# A.2 PROOF OF PROPOSITION 3.2
|
| 297 |
+
|
| 298 |
+
To simplify notations, we drop the subscript and superscript. Considering one particular layer, problem (6) is of the form:
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
\begin{array} { r l } { \operatorname* { m i n } _ { \alpha , \mathbf { b } } } & { \displaystyle \frac { 1 } { 2 } \sum _ { i = 1 } ^ { n } d _ { i } ( \alpha b _ { i } - w _ { i } ) ^ { 2 } } \\ { \mathrm { s . t . } \quad } & { \displaystyle \alpha > 0 , b _ { i } \in \{ - 1 , 0 , 1 \} . } \end{array}
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
When $\alpha$ is fixed,
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
b _ { i } = \arg \operatorname* { m i n } _ { b _ { i } } \frac { 1 } { 2 } d _ { i } ( \alpha b _ { i } - w _ { i } ) ^ { 2 } = \frac { 1 } { 2 } d _ { i } \alpha ^ { 2 } ( b _ { i } - w _ { i } / \alpha ) ^ { 2 } = { \bf I } _ { \alpha / 2 } ( w _ { i } ) .
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
When $\mathbf { b }$ is fixed,
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
\begin{array} { r l } { \alpha ~ = } & { \arg \operatorname* { m i n } _ { \alpha } \frac { 1 } { 2 } \displaystyle \sum _ { i = 1 } ^ { n } d _ { i } ( \alpha b _ { i } - w _ { i } ) ^ { 2 } } \\ { = } & { \arg \operatorname* { m i n } _ { \alpha } \frac { 1 } { 2 } \| { \mathbf b } \odot { \mathbf b } \odot { \mathbf d } \| _ { 1 } \alpha ^ { 2 } - \| { \mathbf b } \odot { \mathbf d } \odot { \mathbf w } \| _ { 1 } \alpha + c _ { 2 } , } \\ { = } & { \arg \operatorname* { m i n } _ { \alpha } \frac { 1 } { 2 } \| { \mathbf b } \odot { \mathbf b } \odot { \mathbf d } \| _ { 1 } \left( \alpha - \frac { \| { \mathbf b } \odot { \mathbf d } \odot { \mathbf w } \| _ { 1 } } { \| { \mathbf b } \odot { \mathbf b } \odot { \mathbf d } \| _ { 1 } } \right) ^ { 2 } - \frac { 1 } { 2 } \| { \mathbf b } \odot { \mathbf d } \odot { \mathbf w } \| _ { 1 } ^ { 2 } + c _ { 2 } } \\ { = } & { \frac { \| { \mathbf b } \odot { \mathbf d } \odot { \mathbf w } \| _ { 1 } } { \| { \mathbf b } \odot { \mathbf c } \odot { \mathbf d } \| _ { 1 } } } \\ { = } & { \frac { \| { \mathbf b } \odot { \mathbf d } \odot { \mathbf w } \| _ { 1 } } { \| { \mathbf b } \odot { \mathbf d } \| _ { 1 } } . } \end{array}
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
# A.3 PROOF OF COROLLARY 3.1
|
| 317 |
+
|
| 318 |
+
When $\mathbf { D } _ { l } ^ { t - 1 } = \lambda \mathbf { I }$ , i.e., the curvature is the same for all dimensions in the lth layer, From Proposition 3.2,
|
| 319 |
+
|
| 320 |
+
$$
|
| 321 |
+
\alpha _ { l } ^ { t } = \frac { \| \mathbf { b } \odot \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } \| _ { 1 } } { \| \mathbf { b } \odot \mathbf { d } _ { l } ^ { t - 1 } \| _ { 1 } } = \frac { \| \mathbf { I } _ { \alpha _ { l } ^ { t } / 2 } ( \mathbf { w } _ { l } ^ { t } ) \odot \mathbf { w } _ { l } ^ { t } \| _ { 1 } } { \| \mathbf { I } _ { \alpha _ { l } ^ { t } / 2 } ( \mathbf { w } _ { l } ^ { t } ) \| _ { 1 } } = \frac { 1 } { \| \mathbf { I } _ { \Delta _ { l } ^ { t } } ( \mathbf { w } _ { l } ^ { t } ) \| _ { 1 } } \sum _ { i : [ \mathbf { w } _ { l } ^ { t } ] _ { i } > \Delta _ { l } ^ { t } } | [ \mathbf { w } _ { l } ^ { t } ] _ { i } | ,
|
| 322 |
+
$$
|
| 323 |
+
|
| 324 |
+
$$
|
| 325 |
+
\Delta _ { l } ^ { t } = \frac { 1 } { 2 } \frac { \| \mathbf { I } _ { \alpha _ { l } ^ { t } / 2 } \odot \mathbf { w } _ { l } ^ { t } \| _ { 1 } } { \| \mathbf { I } _ { \alpha _ { l } ^ { t } / 2 } \| _ { 1 } } = \arg \operatorname* { m a x } _ { \Delta > 0 } \frac { 1 } { \| \mathbf { I } _ { \Delta } ( \mathbf { w } _ { l } ^ { t } ) \| _ { 1 } } \left( \sum _ { i : [ \mathbf { w } _ { l } ^ { t } ] _ { i } > \Delta } | [ \mathbf { w } _ { l } ^ { t } ] _ { i } | \right) ^ { 2 } .
|
| 326 |
+
$$
|
| 327 |
+
|
| 328 |
+
This is the same as the TWN solution in (1).
|
| 329 |
+
|
| 330 |
+
# A.4 PROOF OF PROPOSITION 3.3
|
| 331 |
+
|
| 332 |
+
For simplicity of notations, we drop the subscript and superscript. For each layer, we have an optimization problem of the form
|
| 333 |
+
|
| 334 |
+
$$
|
| 335 |
+
\begin{array} { r l } { { \operatorname* { m i n } ( \sqrt { \mathbf { d } } ^ { \top } ( { \boldsymbol { \alpha } } { \mathbf { b } } - { \mathbf { w } } ) ) ^ { 2 } } } \\ { = } & { \ \arg \operatorname* { m i n } _ { \boldsymbol { \alpha } } \| { \mathbf { b } } \odot { \mathbf { b } } \odot { \mathbf { d } } \| _ { 1 } ( { \boldsymbol { \alpha } } - \frac { \| { \mathbf { b } } \odot { \mathbf { d } } \odot { \mathbf { w } } \| _ { 1 } } { \| { \mathbf { b } } \odot { \mathbf { b } } \odot { \mathbf { d } } \| _ { 1 } } ) ^ { 2 } - \frac { \| { \mathbf { b } } \odot { \mathbf { d } } \odot { \mathbf { w } } \| _ { 1 } ^ { 2 } } { \| { \mathbf { b } } \odot { \mathbf { b } } \odot { \mathbf { d } } \| _ { 1 } } } \\ { = } & { \ \arg \operatorname* { m i n } _ { \boldsymbol { \alpha } } \| { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { d } } \| _ { 1 } ( { \boldsymbol { \alpha } } - \frac { \| { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { d } } \odot { \mathbf { w } } \| _ { 1 } } { \| { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { d } } \| _ { 1 } } ) ^ { 2 } - \frac { \| { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \| _ { 1 } } { \| { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \| _ { 1 } } } \\ { = } & \ \arg \operatorname* { m i n } _ { \boldsymbol { \alpha } } - \frac \| { \mathbf { I } } _ { \alpha / 2 } ( { \mathbf { w } } ) \odot { \mathbf { d } } \odot { \mathbf { w } } \| _ { 1 } \end{array}
|
| 336 |
+
$$
|
| 337 |
+
|
| 338 |
+
where the second equality holds as $\mathbf { b } = \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } )$ . From (9), we have
|
| 339 |
+
|
| 340 |
+
$$
|
| 341 |
+
\begin{array} { r l } & { - \frac { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \odot \mathbf { w } \| _ { 1 } ^ { 2 } } { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \| _ { 1 } } } \\ & { \quad = \begin{array} { r l } { \displaystyle - \frac { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \odot \mathbf { w } \| _ { 1 } } { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \| _ { 1 } } . \frac { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \odot \mathbf { w } \| _ { 1 } } { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \| _ { 1 } } . \frac { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \| _ { 1 } } { \| \mathbf { I } _ { \alpha / 2 } ( \mathbf { w } ) \odot \mathbf { d } \| _ { 1 } } . } \end{array} } \\ & { \quad \quad = \begin{array} { r l } { \displaystyle - 2 c _ { j } \cdot [ \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } } ( \mathbf { d } ) ) ] _ { j } } & { } \\ { \quad = } & { \displaystyle - 2 c _ { j } ^ { 2 } \cdot [ \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } } ( \mathbf { d } ) ) ] _ { j } . } \end{array} } \end{array}
|
| 342 |
+
$$
|
| 343 |
+
|
| 344 |
+
# A.5 PROOF FOR PROPOSITION 3.4
|
| 345 |
+
|
| 346 |
+
For simplicity of notations, we drop the subscript and superscript, and consider the optimization problem:
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\operatorname* { m i n } _ { \alpha , \mathbf { b } } \quad \frac { 1 } { 2 } \sum _ { i = 1 } ^ { n } d _ { i } ( \hat { w } _ { i } - w _ { i } ) ^ { 2 }
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
Let $f ( \hat { w } _ { i } ) = ( \hat { w } _ { i } - w _ { i } ) ^ { 2 }$ . Then, $f ( \alpha ) = ( \alpha - w _ { i } ) ^ { 2 } , f ( 0 ) = w _ { i } ^ { 2 }$ , and $f ( - \beta ) = ( \beta + w _ { i } ) ^ { 2 }$ . It is easy to see that (i) if $w _ { i } > \alpha / 2 , f ( \alpha )$ is the smallest; (ii) if $w _ { i } < - \beta / 2 , f ( - 1 )$ is the smallest; (iii) if $- \beta / 2 \le w _ { i } \le \alpha / 2 , f ( 0 )$ is the smallest. In other words, the optimal $\hat { w } _ { i }$ satisfies
|
| 353 |
+
|
| 354 |
+
$$
|
| 355 |
+
\hat { w } _ { i } = \alpha \mathbf { I } _ { \alpha / 2 } ^ { + } ( w _ { i } ) + \beta \mathbf { I } _ { \beta / 2 } ^ { - } ( w _ { i } ) ,
|
| 356 |
+
$$
|
| 357 |
+
|
| 358 |
+
or equivalently, $\hat { \mathbf { w } } = \alpha \mathbf { p } + \beta \mathbf { q }$ , where $\mathbf { p } = \mathbf { I } _ { \alpha / 2 } ^ { + } ( \mathbf { w } )$ , and $\mathbf { q } = \mathbf { I } _ { \beta } ^ { - } ( \mathbf { w } )$
|
| 359 |
+
|
| 360 |
+
Define $\mathbf { w } ^ { + }$ and $\mathbf { w } ^ { - }$ such that $[ \mathbf { w } ^ { + } ] _ { i } = \left\{ \begin{array} { l l } { w _ { i } } & { w _ { i } > 0 } \\ { 0 } & { \mathrm { o t h e r w i s e } , } \end{array} \right. \mathrm { a n d } \ [ \mathbf { w } ^ { - } ] _ { i } = \left\{ \begin{array} { l l } { w _ { i } } & { w _ { i } < 0 } \\ { 0 } & { \mathrm { o t h e r w i s e } . } \end{array} \right.$ Then,
|
| 361 |
+
|
| 362 |
+
$$
|
| 363 |
+
\frac { 1 } { 2 } \sum _ { i = 1 } ^ { n } d _ { i } ( \hat { w } _ { i } - w _ { i } ) ^ { 2 } = \frac { 1 } { 2 } \sum _ { i = 1 } ^ { n } d _ { i } ( \alpha p _ { i } - w _ { i } ^ { + } ) ^ { 2 } + \frac { 1 } { 2 } \sum _ { i = 1 } ^ { n } d _ { i } ( \beta q _ { i } - w _ { i } ^ { - } ) ^ { 2 } .
|
| 364 |
+
$$
|
| 365 |
+
|
| 366 |
+
The objective in (12) has two parts, and each part can be viewed as a special case of the ternarization step in Proposition 3.1 (considering only with positive or negative weights). Similar to the proof for Proposition 3.2, we can obtain that the optimal $\hat { \mathbf { w } } = \alpha \mathbf { p } + \beta \mathbf { q }$ satisfies
|
| 367 |
+
|
| 368 |
+
$$
|
| 369 |
+
\begin{array} { r } { \alpha = \frac { \| \mathbf { p } \odot \mathbf { d } \odot \mathbf { w } \| _ { 1 } } { \| \mathbf { p } \odot \mathbf { d } \| _ { 1 } } , \quad \mathbf { p } = \mathbf { I } _ { \alpha / 2 } ^ { + } ( \mathbf { w } ) , } \\ { \beta = \frac { \| \mathbf { q } \odot \mathbf { d } \odot \mathbf { w } \| _ { 1 } } { \| \mathbf { q } \odot \mathbf { d } \| _ { 1 } } , \quad \mathbf { q } = \mathbf { I } _ { \beta / 2 } ^ { - } ( \mathbf { w } ) . } \end{array}
|
| 370 |
+
$$
|
| 371 |
+
|
| 372 |
+
# A.6 PROOF OF PROPOSITION 3.5
|
| 373 |
+
|
| 374 |
+
For simplicity of notations, we drop the subscript and superscript. Since $\begin{array} { r } { \frac { 1 } { 2 } ( \sqrt { \mathbf { d } } ^ { \top } ( \alpha \mathbf { b } - \mathbf { w } ) ) ^ { 2 } = } \end{array}$ $\textstyle { \frac { 1 } { 2 } } \sum _ { i = 1 } ^ { n } d _ { i } ( \alpha b _ { i } - w _ { i } ) ^ { 2 }$ for each layer, we simply consider the optimization problem:
|
| 375 |
+
|
| 376 |
+
$$
|
| 377 |
+
\begin{array} { r l } { \operatorname* { m i n } _ { \boldsymbol { \alpha } , \mathbf { b } } } & { \displaystyle \frac { 1 } { 2 } \sum _ { i = 1 } ^ { n } d _ { i } ( { \boldsymbol { \alpha } } b _ { i } - w _ { i } ) ^ { 2 } } \\ { \mathrm { s . t . } } & { \boldsymbol { \alpha } > 0 , b _ { i } \in \mathcal { Q } . } \end{array}
|
| 378 |
+
$$
|
| 379 |
+
|
| 380 |
+
When $\alpha$ is fixed,
|
| 381 |
+
|
| 382 |
+
$$
|
| 383 |
+
b _ { i } = \arg \operatorname* { m i n } _ { b _ { i } } \frac { 1 } { 2 } d _ { i } ( \alpha b _ { i } - w _ { i } ) ^ { 2 } = \frac { 1 } { 2 } d _ { i } \alpha ^ { 2 } ( b _ { i } - w _ { i } / \alpha ) ^ { 2 } = \Pi _ { \mathcal { Q } } \left( \frac { w _ { i } } { \alpha } \right) .
|
| 384 |
+
$$
|
| 385 |
+
|
| 386 |
+
When $\mathbf { b }$ is fixed,
|
| 387 |
+
|
| 388 |
+
$$
|
| 389 |
+
{ \begin{array} { r c l } { \alpha } & { = } & { \displaystyle \operatorname { a r g m i n } _ { \alpha } { \frac { 1 } { 2 } } \sum _ { i = 1 } ^ { n } d _ { i } ( \alpha b _ { i } - w _ { i } ) ^ { 2 } } \\ & { = } & { \displaystyle \operatorname { a r g m i n } _ { \alpha } { \frac { 1 } { 2 } } \| \mathbf { b \odot b \odot d } \| _ { 1 } \alpha ^ { 2 } - \| \mathbf { b \odot d \odot w } \| _ { 1 } \alpha + c _ { 2 } } \\ & { = } & { \displaystyle \operatorname { a r g m i n } _ { \alpha } { \frac { 1 } { 2 } } \| \mathbf { b \odot b \odot d } \| _ { 1 } \left( \alpha - { \frac { \| \mathbf { b \odot d \odot w } \| _ { 1 } } { \| \mathbf { b \odot b \odot d } \| _ { 1 } } } \right) ^ { 2 } - { \frac { 1 } { 2 } } { \frac { \| \mathbf { b \odot d \odot w } \| _ { 1 } ^ { 2 } } { \| \mathbf { b \odot b \odot d } \| _ { 1 } } } } \\ & { = } & { \displaystyle { \frac { \| \mathbf { b \odot d \odot w } \| _ { 1 } } { \| \mathbf { b \odot b \odot d } \| _ { 1 } } } } \\ & { = } & { \displaystyle { \frac { \| \mathbf { b \odot d \odot d } \| _ { 1 } } { \| \mathbf { b \odot d } \| _ { 1 } } } . } \end{array} }
|
| 390 |
+
$$
|
| 391 |
+
|
| 392 |
+
# B LOSS-AWARE TERNARIZATION ALGORITHM (LAT)
|
| 393 |
+
|
| 394 |
+
The whole procedure of LAT is shown in Algorithm 3.
|
| 395 |
+
|
| 396 |
+
# C EXACT AND APPROXIMATE SOLUTIONS FOR TERNARIZATION WITH TWO SCALING PARAMETERS
|
| 397 |
+
|
| 398 |
+
Let there be $n _ { 1 }$ positive elements and $n _ { 2 }$ negative elements in $\mathbf { w } _ { l }$ . For a $n$ -dimensional vector $\mathbf { x } = [ x _ { 1 } , x _ { 2 } , \ldots , x _ { n } ]$ , define inverse $\mathbf { \Phi } : ( \mathbf { x } ) = [ x _ { n } , x _ { n - 1 } , \ldots , x _ { 1 } ]$ . As is shown in (12), the objective can be separated into two parts, and each part can be viewed as a special case of ternarization step in Proposition 3.1, dealing only with positive or negative weights. Thus the exact and approximate solutions for $\alpha _ { l } ^ { t }$ and $\beta _ { l } ^ { t }$ can separately be derived in a similar way as that of using one scaling parameter. The exact and approximate solutions for $\alpha _ { l } ^ { t }$ and $\beta _ { l } ^ { t }$ for layer-l at the tth time step are shown in Algorithms 4 and 5.
|
| 399 |
+
|
| 400 |
+
# D EXPERIMENTAL DETAILS
|
| 401 |
+
|
| 402 |
+
# D.1 SETUP FOR FEEDFORWARD NETWORKS
|
| 403 |
+
|
| 404 |
+
The setup for the four data sets are as follows:
|
| 405 |
+
|
| 406 |
+
1. MNIST: This contains $2 8 \times 2 8$ gray images from 10 digit classes. We use 50, 000 images for training, another 10, 000 for validation, and the remaining 10, 000 for testing. We use the 4-layer model:
|
| 407 |
+
|
| 408 |
+
$$
|
| 409 |
+
7 8 4 F C - 2 0 4 8 F C - 2 0 4 8 F C - 2 0 4 8 F C - 1 0 S V M ,
|
| 410 |
+
$$
|
| 411 |
+
|
| 412 |
+
where $F C$ is a fully-connected layer, and $S V M$ is a $\ell _ { 2 }$ -SVM output layer using the square hinge loss. Batch normalization with a minibatch size 100, is used to accelerate learning. The maximum number of epochs is 50. The learning rate starts at 0.01, and decays by a factor of 0.1 at epochs 15 and 25.
|
| 413 |
+
|
| 414 |
+
Algorithm 3 Loss-Aware Ternarization (LAT) for training a feedforward neural network.
|
| 415 |
+
|
| 416 |
+
Input: Minibatch $\{ ( \mathbf { x } _ { 0 } ^ { t } , \mathbf { y } ^ { t } ) \}$ , current full-precision weights $\left\{ \mathbf { w } _ { l } ^ { t } \right\}$ , first moment $\{ \mathbf { m } _ { l } ^ { t - 1 } \}$ , second moment $\{ \mathbf { v } _ { l } ^ { t - 1 } \}$ , and learning rate $\eta ^ { t }$ .
|
| 417 |
+
|
| 418 |
+
1: Forward Propagation
|
| 419 |
+
2: for $l = 1$ to $L$ do
|
| 420 |
+
3: compute $\alpha _ { l } ^ { t }$ and $\mathbf { b } _ { l } ^ { t }$ using Algorithm 1 or 2;
|
| 421 |
+
4: rescale the layer- $\mathbf { \nabla } \cdot \mathbf { \vec { \tau } }$ input: $\tilde { \mathbf { x } } _ { l - 1 } ^ { t } = \alpha _ { l } ^ { t } \mathbf { x } _ { l - 1 } ^ { t }$ ;
|
| 422 |
+
5: compute $\mathbf { z } _ { l } ^ { t }$ with input $\tilde { \mathbf { x } } _ { l - 1 } ^ { t }$ and binary weight $\mathbf { b } _ { l } ^ { t }$ ;
|
| 423 |
+
6: apply batch-normalization and nonlinear activation to $\mathbf { z } _ { l } ^ { t }$ to obtain $\mathbf { x } _ { l } ^ { t }$ ;
|
| 424 |
+
7: end for
|
| 425 |
+
8: compute the loss $\ell$ using $\mathbf { x } _ { L } ^ { t }$ and $\mathbf { y } ^ { t }$ ;
|
| 426 |
+
9: Backward Propagation
|
| 427 |
+
10: initialize output layer’s activation’s gradient $\frac { \partial \ell } { \partial \mathbf { x } _ { L } ^ { t } }$ ;
|
| 428 |
+
11: for $l = L$ to 2 do
|
| 429 |
+
12: compute $\frac { \partial \ell } { \partial \mathbf { x } _ { l - 1 } ^ { t } }$ usin g ∂ \`∂ x t , α tl an d b tl ;
|
| 430 |
+
13: end for
|
| 431 |
+
14: Update parameters using Adam
|
| 432 |
+
15: for $l = 1$ to $L$ do
|
| 433 |
+
16: compute gradients $\nabla _ { l } \ell ( \hat { \mathbf { w } } ^ { t } )$ using $\frac { \partial \ell } { \partial \mathbf { x } _ { l } ^ { t } }$ and $\mathbf { x } _ { l - 1 } ^ { t }$ ;
|
| 434 |
+
17: update first moment $\mathbf { m } _ { l } ^ { t } = \beta _ { 1 } \mathbf { m } _ { l } ^ { t - 1 } + ( 1 - \beta _ { 1 } ) \nabla _ { l } \ell ( \hat { \mathbf { w } } ^ { t } )$ ;
|
| 435 |
+
18: update second moment $\mathbf { v } _ { l } ^ { t } = \beta _ { 2 } \mathbf { v } _ { l } ^ { t - 1 } + ( 1 - \beta _ { 2 } ) ( \nabla _ { l } \ell ( \hat { \mathbf { w } } ^ { t } ) \odot \nabla _ { l } \ell ( \hat { \mathbf { w } } ^ { t } ) ) ;$ ;
|
| 436 |
+
19: compute unbiased first moment $\hat { \mathbf { m } } _ { l } ^ { t } = \mathbf { m } _ { l } ^ { t } / ( 1 - \beta _ { 1 } ^ { t } )$ ;
|
| 437 |
+
20: compute unbiased second moment $\hat { \mathbf { v } } _ { l } ^ { t } = \mathbf { v } _ { l } ^ { t } / ( 1 - \beta _ { 2 } ^ { t } )$ ;
|
| 438 |
+
21: compute current curvature matrix $\begin{array} { r } { \mathbf { d } _ { l } ^ { t } = \frac { 1 } { \eta ^ { t } } \left( \epsilon \mathbf { 1 } + \sqrt { \hat { \mathbf { v } } _ { l } ^ { t } } \right) } \end{array}$ ;
|
| 439 |
+
22: update full-precision weights $\mathbf { w } _ { l } ^ { t + 1 } = \mathbf { w } _ { l } ^ { t } - \hat { \mathbf { m } } _ { l } ^ { t } \oslash \mathbf { d } _ { l } ^ { t }$ ;
|
| 440 |
+
23: update learning rate $\eta ^ { t + 1 } =$ UpdateLearningrate $( \eta ^ { t } , t + 1 )$ ;
|
| 441 |
+
|
| 442 |
+
24: end for
|
| 443 |
+
|
| 444 |
+
Algorithm 4 Exact solver for $\hat { \mathbf { w } } _ { l } ^ { t }$ with two scaling parameters.
|
| 445 |
+
|
| 446 |
+
1: Input: full-precision weight $\mathbf { w } _ { l } ^ { t }$ , diagonal entries of the approximate Hessian $\mathbf { d } _ { l } ^ { t - 1 }$ .
|
| 447 |
+
2: $\mathbf { s } _ { 1 } = \arg \operatorname { s o r t } ( \mathbf { w } _ { l } ^ { t } )$ ;
|
| 448 |
+
3: $\mathbf { c } _ { 1 } = \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } _ { 1 } } ( | \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } | ) ) \oslash \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } _ { 1 } } ( | \mathbf { d } _ { l } ^ { t - 1 } | ) ) \oslash 2 ;$
|
| 449 |
+
4: $\mathfrak { I } _ { 1 } = \mathrm { H n d } [ ( [ \mathrm { p e r m } _ { \mathbf { s } _ { 1 } } ( \mathbf { w } _ { l } ^ { t } ) ] _ { [ 1 : ( n _ { 1 } - 1 ) ] } - [ \mathbf { c } _ { 1 } ] _ { [ 1 : ( n _ { 1 } - 1 ) ] } )$ [perms1 (wtl )][2:n1] − [c1][1:n1−1]) < 0);
|
| 450 |
+
5: $\begin{array} { r } { \alpha _ { l } ^ { t } = 2 \arg \operatorname* { m a x } _ { c _ { i } , i \in \cal S _ { 1 } } [ { \bf c } _ { 1 } ] _ { i } ^ { 2 } \cdot [ { \bf c u m ( p e r m _ { s _ { 1 } } ( | { \bf d } } _ { l } ^ { t - 1 } | ) ) ] _ { i } . } \end{array}$ ;
|
| 451 |
+
6: $\mathbf { p } _ { l } ^ { t } = \mathbf { I } _ { \alpha / 2 } ^ { + } ( \mathbf { w } _ { l } ^ { t } )$ ;
|
| 452 |
+
7: $\mathbf { s } _ { 2 } = \operatorname { i n v e r s e } ( \mathbf { s } _ { 1 } )$ ;
|
| 453 |
+
8: $\begin{array} { r l } & { \mathbf { c } _ { 2 } = \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } _ { 2 } } ( | \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } | ) ) \oslash \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } _ { 2 } } ( | \mathbf { d } _ { l } ^ { t - 1 } | ) ) \oslash 2 ; } \\ & { S _ { 2 } = \mathrm { f u n d } ( ( [ - \mathrm { p e r m } _ { \mathbf { s } _ { 2 } } ( \mathbf { w } _ { l } ^ { t } ) ] [ \mathbf { 1 } _ { : ( n _ { 2 } - 1 ) ] } - [ \mathbf { c } _ { 2 } ] [ \mathbf { 1 } _ { : ( n _ { 2 } - 1 ) ] } ) \odot ( [ - \mathrm { p e r m } _ { \mathbf { s } _ { 2 } } ( \mathbf { w } _ { l } ^ { t } ) ] _ { [ 2 : n _ { 2 } ] } - [ \mathbf { c } _ { 2 } ] _ { [ 1 : n _ { 2 } - 1 ] } ) < } \\ & { 0 ; } \\ & { \beta _ { l } ^ { t } = 2 \mathrm { a r g } \operatorname* { m a x } _ { c _ { i } , i \in S _ { 2 } } [ \mathbf { c } _ { 2 } ] _ { i } ^ { 2 } \odot [ \mathrm { c u m } ( \mathrm { p e r m } _ { \mathbf { s } _ { 2 } } ( | \mathbf { d } _ { l } ^ { t - 1 } | ) ) ] _ { i } ; } \end{array}$
|
| 454 |
+
9:
|
| 455 |
+
10:
|
| 456 |
+
11: $\mathbf { q } _ { l } ^ { t } = \mathbf { I } _ { \beta / 2 } ^ { - } ( \mathbf { w } _ { l } ^ { t } )$ ;
|
| 457 |
+
12: Output: $\hat { \mathbf { w } } _ { l } ^ { t } = \alpha _ { l } ^ { t } \mathbf { p } _ { l } ^ { t } + \beta _ { l } ^ { t } \mathbf { q } _ { l } ^ { t }$ .
|
| 458 |
+
|
| 459 |
+
2. CIFAR-10: This contains $3 2 \times 3 2$ color images from 10 object classes. We use 45, 000 images for training, another $5 , 0 0 0$ for validation, and the remaining $1 0 , 0 0 0$ for testing. The images are preprocessed with global contrast normalization and ZCA whitening. We use the VGG-like architecture:
|
| 460 |
+
|
| 461 |
+
$$
|
| 462 |
+
( 2 \times 1 2 8 C 3 ) - M P 2 - ( 2 \times 2 5 6 C 3 ) - M P 2 - ( 2 \times 5 1 2 C 3 ) - M P 2 - ( 2 \times 1 0 2 4 F C ) - 1 0 S V M ,
|
| 463 |
+
$$
|
| 464 |
+
|
| 465 |
+
where $C 3$ is a $3 \times 3$ ReLU convolution layer, and $M P 2$ is a $2 \times 2$ max-pooling layer. Batch normalization with a minibatch size of 50, is used. The maximum number of epochs
|
| 466 |
+
|
| 467 |
+
Algorithm 5 Approximate solver for $\hat { \mathbf { w } } _ { l } ^ { t }$ with two scaling parameters
|
| 468 |
+
|
| 469 |
+
1: Input: $\mathbf { b } _ { l } ^ { t - 1 }$ , full-precision weight $\mathbf { w } _ { l } ^ { t }$ , and diagonal entries of approximate Hessian $\mathbf { d } _ { l } ^ { t - 1 }$ .
|
| 470 |
+
2: Initialize: $\alpha = 1 . 0 , \alpha _ { \mathrm { o l d } } = 0 . 0 , \beta = 1 . 0 , \beta _ { o } = 0 . 0 , \mathbf { b } = \mathbf { b } _ { l } ^ { t - 1 } , \mathbf { p } = \mathbf { I } _ { 0 } ^ { + } ( \mathbf { b } ) , \mathbf { q } = \mathbf { I } _ { 0 } ^ { - } ( \mathbf { b } ) , \epsilon = 0 .$
|
| 471 |
+
$1 0 ^ { - 6 }$ .
|
| 472 |
+
3: while $| \alpha - \alpha _ { \mathrm { o l d } } | > \epsilon$ and $| \beta - \beta _ { \mathrm { o l d } } | > \epsilon$ do
|
| 473 |
+
4: $\alpha _ { \mathrm { o l d } } = \alpha$ , $\beta _ { \mathrm { o l d } } = \beta$ ;
|
| 474 |
+
5: $\begin{array} { r } { \alpha = \frac { \| \mathbf { p } \odot \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } \| _ { 1 } } { \| \mathbf { p } \odot \mathbf { d } _ { l } ^ { t - 1 } \| _ { 1 } } } \end{array}$ ;
|
| 475 |
+
6: $\mathbf { p } = \mathbf { I } _ { \alpha / 2 } ^ { + } ( \mathbf { w } _ { l } ^ { t } )$ ;
|
| 476 |
+
7: $\begin{array} { r } { \beta = \frac { \| \mathbf { q } \odot \mathbf { d } _ { l } ^ { t - 1 } \odot \mathbf { w } _ { l } ^ { t } \| _ { 1 } } { \| \mathbf { q } \odot \mathbf { d } _ { l } ^ { t - 1 } \| _ { 1 } } } \end{array}$ ;
|
| 477 |
+
8: $\mathbf { q } = \mathbf { I } _ { \beta / 2 } ^ { - } \big ( \mathbf { w } _ { l } ^ { t } \big )$ ;
|
| 478 |
+
9: end while
|
| 479 |
+
10: Output: $\hat { \mathbf { w } } _ { l } ^ { t } = \alpha \mathbf { p } + \beta \mathbf { q }$ .
|
| 480 |
+
|
| 481 |
+
is 200. The learning rate for the weight-binarized network starts at 0.03 while for all the other networks starts at 0.002, and decays by a factor of 0.5 after every 15 epochs.
|
| 482 |
+
|
| 483 |
+
3. CIFAR-100: This contains $3 2 \times 3 2$ color images from 100 object classes. We use 45, 000 images for training, another $5 , 0 0 0$ for validation, and the remaining $1 0 , 0 0 0$ for testing. The images are preprocessed with global contrast normalization and ZCA whitening. We use the VGG-like architecture:
|
| 484 |
+
|
| 485 |
+
$$
|
| 486 |
+
( 2 \times 1 2 8 C 3 ) - M P 2 - ( 2 \times 2 5 6 C 3 ) - M P 2 - ( 2 \times 5 1 2 C 3 ) - M P 2 - ( 2 \times 1 0 2 4 F C ) - 1 0 0 S V M .
|
| 487 |
+
$$
|
| 488 |
+
|
| 489 |
+
Batch normalization with a minibatch size of 100, is used. The maximum number of epochs is 200. The learning rate starts at 0.0005, and decays by a factor of 0.5 after every 15 epochs.
|
| 490 |
+
|
| 491 |
+
4. SVHN: This contains $3 2 \times 3 2$ color images from 10 digit classes. We use 598, 388 images for training, another 6, 000 for validation, and the remaining 26, 032 for testing. The images are preprocessed with global and local contrast normalization. The model used is:
|
| 492 |
+
|
| 493 |
+
$$
|
| 494 |
+
( 2 \times 6 4 C 3 ) - M P 2 - ( 2 \times 1 2 8 C 3 ) - M P 2 - ( 2 \times 2 5 6 C 3 ) - M P 2 - ( 2 \times 1 0 2 4 F C ) - 1 0 S V M .
|
| 495 |
+
$$
|
| 496 |
+
|
| 497 |
+
Batch normalization with a minibatch size of 50, is used. The maximum number of epochs is 50. The learning rate starts at 0.001 for the weight-binarized network, and 0.0005 for the other networks. It then decays by a factor of 0.1 at epochs 15 and 25.
|
| 498 |
+
|
| 499 |
+
# D.2 SETUP FOR RECURRENT NETWORKS
|
| 500 |
+
|
| 501 |
+
The setup for the three data sets are as follows:
|
| 502 |
+
|
| 503 |
+
1. Leo Tolstoy’s War and Peace: It consists of 3258K characters of almost entirely English text with minimal markup and a vocabulary size of 87. We use the same training/validation/test set split as in (Karpathy et al., 2016; Hou et al., 2017).
|
| 504 |
+
2. The source code of the Linux Kernel: This consists of 621K characters and a vocabulary size of 101. We use the same training/validation/test set split as in (Karpathy et al., 2016; Hou et al., 2017).
|
| 505 |
+
3. The Penn Treebank data set (Taylor et al., 2003): This has been frequently used for language modeling. It contains 50 different characters, including English characters, numbers, and punctuations. We follow the setting in (Mikolov & Zweig, 2012), with 5,017K characters for training, 393K for validation, and 442K characters for testing.
|
| 506 |
+
|
| 507 |
+
We use a one-layer LSTM with 512 cells. The maximum number of epochs is 200, and the number of time steps is 100. The initial learning rate is 0.002. After 10 epochs, it is decayed by a factor of 0.98 after each epoch. The weights are initialized uniformly in [0.08, 0.08]. After each iteration, the gradients are clipped to the range $[ - 5 , 5 ]$ . All the updated weights are clipped to $[ - 1 , 1 ]$ for binarization and ternarization methods, but not for $m$ -bit (where $m > 2$ ) quantization methods.
|
md/train/BydjJte0-/BydjJte0-.md
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TOWARDS REVERSE-ENGINEERING BLACK-BOX NEURAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Seong Joon Oh, Max Augustin, Bernt Schiele, Mario Fritz
|
| 4 |
+
Max-Planck Institute for Informatics, Saarland Informatics Campus, Saarbrucken, Germany ¨
|
| 5 |
+
{joon,maxaug,schiele,mfritz}@mpi-inf.mpg.de
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Many deployed learned models are black boxes: given input, returns output. Internal information about the model, such as the architecture, optimisation procedure, or training data, is not disclosed explicitly as it might contain proprietary information or make the system more vulnerable. This work shows that such attributes of neural networks can be exposed from a sequence of queries. This has multiple implications. On the one hand, our work exposes the vulnerability of black-box neural networks to different types of attacks – we show that the revealed internal information helps generate more effective adversarial examples against the black box model. On the other hand, this technique can be used for better protection of private content from automatic recognition models using adversarial examples. Our paper suggests that it is actually hard to draw a line between white box and black box models. The code is available at goo.gl/MbYfsv.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Black-box models take a sequence of query inputs, and return corresponding outputs, while keeping internal states such as model architecture hidden. They are deployed as black boxes usually on purpose – for protecting intellectual properties or privacy-sensitive training data. Our work aims at inferring information about the internals of black box models – ultimately turning them into white box models. Such a reverse-engineering of a black box model has many implications. On the one hand, it has legal implications to intellectual properties (IP) involving neural networks – internal information about the model can be proprietary and a key IP, and the training data may be privacy sensitive. Disclosing hidden details may also render the model more susceptible to attacks from adversaries. On the other hand, gaining information about a black-box model can be useful in other scenarios. E.g. there has been work on utilising adversarial examples for protecting private regions (e.g. faces) in photographs from automatic recognisers (Oh et al., 2017). In such scenarios, gaining more knowledge on the recognisers will increase the chance of protecting one’s privacy. Either way, it is a crucial research topic to investigate the type and amount of information that can be gained from a black-box access to a model. We make a first step towards understanding the connection between white box and black box approaches – which were previously thought of as distinct classes.
|
| 14 |
+
|
| 15 |
+
We introduce the term “model attributes” to refer to various types of information about a trained neural network model. We group them into three types: (1) architecture (e.g. type of non-linear activation), (2) optimisation process (e.g. SGD or ADAM?), and (3) training data (e.g. which dataset?). We approach the problem as a standard supervised learning task applied over models. First, collect a diverse set of white-box models (“meta-training set”) that are expected to be similar to the target black box at least to a certain extent. Then, over the collected meta-training set, train another model (“metamodel”) that takes a model as input and returns the corresponding model attributes as output. Importantly, since we want to predict attributes at test time for black-box models, the only information available for attribute prediction is the query input-output pairs. As we will see in the experiments, such input-output pairs allow to predict model attributes surprisingly well.
|
| 16 |
+
|
| 17 |
+
In summary, we contribute: (1) Investigation of the type and amount of internal information about the black-box model that can be extracted from querying; (2) Novel metamodel methods that not only reason over outputs from static query inputs, but also actively optimise query inputs that can extract more information; (3) Study of factors like size of the meta-training set, quantity and quality of queries, and the dissimilarity between the meta-training models and the test black box (generalisability); (4) Empirical verification that revealed information leads to greater susceptibility of a black-box model to an adversarial example based attack.
|
| 18 |
+
|
| 19 |
+
# 2 RELATED WORK
|
| 20 |
+
|
| 21 |
+
There has been a line of work on extracting and exploiting information from black-box learned models. We first describe papers on extracting information (model extraction and membership inference attacks), and then discuss ones on attacking the network using the extracted information (adversarial image perturbations $( A I P )$ ).
|
| 22 |
+
|
| 23 |
+
Model extraction attacks either reconstruct the exact model parameters or build an avatar model that maximises the likelihood of the query input-output pairs from the target model (Tramer et al., 2016; Papernot et al., 2017). Tramer et al. (2016) have shown the efficacy of equation solving attacks and the avatar method in retrieving internal parameters of non-neural network models. Papernot et al. (2017) have also used the avatar approach with the end goal of generating adversarial examples. While the avatar approach first assumes model hyperparameters like model family (architecture) and training data, we discriminatively train a metamodel to predict those hyperparameters themselves. As such, our approach is complementary to the avatar approach.
|
| 24 |
+
|
| 25 |
+
Membership inference attacks determine if a given data sample has been included in the training data (Ateniese et al., 2015; Shokri et al., 2017). In particular, Ateniese et al. (2015) also trains a decision tree metamodel over a set of classifiers trained on different datasets. This work goes far beyond only inferring the training data by showing that even the model architecture and optimisation process can be inferred.
|
| 26 |
+
|
| 27 |
+
Using the obtained cues, one can launch more effective, focused attacks on the black box. We use adversarial image perturbations (AIPs) as an example of such attack. AIPs are small perturbations over the input such that the network is mislead. Research on this topic has flourished recently after it was shown that the needed amount of perturbation to completely mislead an image classifier is nearly invisible (Szegedy et al., 2014; Goodfellow et al., 2015; Moosavi-Dezfooli et al., 2017).
|
| 28 |
+
|
| 29 |
+
Most effective AIPs require gradients of the target network. Some papers proposed different ways to attack black boxes. They can be grouped into three approaches. (1) Approximate gradients by numerical gradients (Narodytska & Kasiviswanathan, 2017; Chen et al., 2017). The caveat is that thousands and millions of queries are needed to compute a single AIP, depending on the image size. (2) Use the avatar approach to train a white box network that is supposedly similar to the target (Papernot et al., 2016b;a; Hayes & Danezis, 2017). We note again that our metamodel is complementary to the avatar approach – the avatar network hyperparemters can be determined by the metamodel. (3) Exploit transferability of adversarial examples; it has been shown that AIPs generated against one network can also fool other networks (Moosavi-Dezfooli et al., 2017; Liu et al., 2017). Liu et al. (2017) in particular have shown that generating AIPs against an ensemble of networks make it more transferable. We show in this work that the AIPs transfer better within an architecture family (e.g. ResNet or DenseNet) than across, and that such a property can be exploited by our metamodel for generating more targetted AIPs.
|
| 30 |
+
|
| 31 |
+
# 3 METAMODELS
|
| 32 |
+
|
| 33 |
+
We want to find out the type and amount of internal information about a black-box model that can be revealed from a sequence of queries. We approach this by first building metamodels for predicting model attributes, and then evaluating their performance on black-box models. Our
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
Figure 1: Overview of our approach.
|
| 37 |
+
|
| 38 |
+
main approach, metamodel, is described in figure 1. In a nutshell, the metamodel is a classifier of classifiers. Specifically, The metamodel submits $n$ query inputs $\left[ x ^ { i } \right] _ { i = 1 } ^ { n }$ to a black box model $f$ ; the metamodel takes corresponding model outputs $\left[ f ( x ^ { i } ) \right] _ { i = 1 } ^ { n }$ as an input, and returns predicted model attributes as output. As we will describe in detail, the metamodel not only learns to infer model attributes from query outputs from a static set of inputs, but also searches for query inputs that are designed to extract greater amount of information from the target models.
|
| 39 |
+
|
| 40 |
+
In this section, our main methods are introduced in the context of MNIST digit classifiers. While MNIST classifiers are not fully representative of generic learned models, they have a computational edge: it takes only five minutes to train each of them with reasonable performance. We could thus prepare a diverse set of 11k MNIST classifiers within 40 GPU days for the meta-training and evaluation of our metamodels. We stress, however, that the proposed approach is generic with respect to the task, data, and the type of models. We also focus on 12 model attributes (table 1) that cover hyperparameters for common neural network MNIST classifiers, but again the range of predictable attributes are not confined to this list.
|
| 41 |
+
|
| 42 |
+
# 3.1 COLLECTING A DATASET OF CLASSIFIERS
|
| 43 |
+
|
| 44 |
+
We need a dataset of classifiers to train and evaluate metamodels. We explain how MNIST-NETS has been constructed, a dataset of 11k MNIST digit classifiers; the procedure is task and data generic.
|
| 45 |
+
|
| 46 |
+
# BASE NETWORK SKELETON
|
| 47 |
+
|
| 48 |
+
Every model in MNIST-NETS shares the same convnet skeleton architecture: “ $N$ conv blocks $M$ fc blocks $ ~ 1$ linear classifier”. Each conv block has the following structure: “ks $\times$ ks convolution optional $2 \times 2$ max-pooling non-linear activation”, where ks (kernel size) and the activation type are to be chosen. Each fc block has the structure: “00linear mapping non-linear activation optional dropout” This convnet structure already covers many LeNet (LeCun et al., 1998) variants, one of the best performing architectures on MNIST1.
|
| 49 |
+
|
| 50 |
+
# INCREASING DIVERSITY
|
| 51 |
+
|
| 52 |
+
In order to learn generalisable features, the metamodel needs to be trained over a diverse set of models. The base architecture described above already has several free parameters like the number of layers ( $N$ and $M ,$ ), the existence of dropout or maxpooling layers, or the type of nonlinear activation.
|
| 53 |
+
|
| 54 |
+
Table 1: MNIST classifier attributes. Italicised attributes are derived from other attributes.
|
| 55 |
+
|
| 56 |
+
<table><tr><td></td><td>Code</td><td>Attribute</td><td>Values</td></tr><tr><td>AAieeiteee</td><td>act drop pool ks #conv #fc</td><td>Activation Dropout Max pooling Conv ker. size #Conv layers #FC layers</td><td>ReLU,PReLU,ELU,Tanh Yes,No Yes,No 3,5 2,3,4 2,3,4</td></tr><tr><td>0</td><td>#par ens alg</td><td>#Parameters Ensemble Algorithm</td><td>214, : 221 Yes,No SGD,ADAM,RMSprop</td></tr><tr><td>0</td><td>bs split size</td><td>Batch size Data split Data size</td><td>64,128,256 Allo,Halfo/1, Quarter0/1/2/3 All, Half, Quarter</td></tr></table>
|
| 57 |
+
|
| 58 |
+
Apart from the architectural hyperparameters, we increase diversity along two more axes – optimisation process and the training data. Along the optimisation axis, we vary optimisation algorithm (SGD, ADAM, or
|
| 59 |
+
|
| 60 |
+
RMSprop) and the training batch size (64, 128, 256). We also consider training MNIST classifiers on either on the entire MNIST training set $( \mathrm { A l l } _ { 0 }$ , 60k), one of the two disjoint halves $\mathrm { ( H a l f _ { 0 / 1 } }$ , 30k), or one of the four disjoint quarters (Quarte $\Gamma _ { 0 / 1 / 2 / 3 }$ , $1 5 \mathrm { k } )$ ).
|
| 61 |
+
|
| 62 |
+
See table 1 for the comprehensive list of 12 model attributes altered in MNIST-NETS. The number of trainable parameters (#par) and the training data size (size) are not directly controlled but derived from the other attributes. We also augment MNIST-NETS with ensembles of classifiers (ens), whose procedure will be described later.
|
| 63 |
+
|
| 64 |
+
# SAMPLING AND TRAINING
|
| 65 |
+
|
| 66 |
+
The number of all possible combinations of controllable options in table 1 is 18, 144. We also select random seeds that control the initialisation and training data shuffling from $\{ 0 , \cdots , 9 9 9 \}$ , resulting in 18, 144, 000 unique models. Training such a large number of models is intractable; we have sampled (without replacement) and trained 10, 000 of them. All the models have been trained with learning rate 0.1 and momentum 0.5 for 100 epochs. It takes around 5 minutes to train each model on a GPU machine (GeForce GTX TITAN); training of 10k classifiers has taken 40 GPU days.
|
| 67 |
+
|
| 68 |
+
# PRUNING AND AUGMENTING
|
| 69 |
+
|
| 70 |
+
In order to make sure that MNIST-NETS realistically represents commonly used MNIST classifiers, we have pruned low-performance classifiers (validation accuracy $< 9 8 \%$ ), resulting in 8, 582 classifiers. Ensembles of trained classifiers have been constructed by grouping the identical classifiers (modulo random seed). Given $t$ identical ones, we have augmented MNIST-NETS with 2, · · · , $t$ combinations. The ensemble augmentation has resulted in 11, 282 final models. See appendix table 6 for statistics of attributes – due to large sample size all the attributes are evenly covered.
|
| 71 |
+
|
| 72 |
+
# TRAIN-EVAL SPLITS
|
| 73 |
+
|
| 74 |
+
Attribute prediction can get arbitrarily easy by including the black-box model (or similar ones) in the meta-training set. We introduce multiple splits of MNIST-NETS with varying requirements on generalization. Unless stated otherwise, every split has 5, 000 training (meta-training), 1, 000 testing (black box), and 5, 282 leftover models.
|
| 75 |
+
|
| 76 |
+
The Random (R) split randomly (uniform weights) assigns training and test splits, respectively. Under the R split, the training and test models come from the same distribution. We introduce harder Extrapolation (E) splits. We separate a few attributes between the training and test splits. They are designed to simulate more difficult domain gaps when the meta-training models are significantly different from the black box. Specific examples of E splits will be shown in $\ S 4$ .
|
| 77 |
+
|
| 78 |
+
# 3.2 METAMODEL METHODS
|
| 79 |
+
|
| 80 |
+
The metamodel predicts the attribute of a black-box model $g$ in the test split by submitting $n$ query inputs and observing the outputs. It is trained over meta-training models $f$ in the training split $( f \sim \mathcal { F } )$ . We propose three approaches for the metamodels – we collectively name them kennen2. See figure 2 for an overview.
|
| 81 |
+
|
| 82 |
+
# K E N N E N-O: REASON OVER OUTPUT
|
| 83 |
+
|
| 84 |
+
kennen-o first selects a fixed set of queries $[ x ^ { i } ] _ { i = 1 \cdots n }$ from a dataset. Both during training and testing, always these queries are submitted. kennen $\scriptscriptstyle - \bigcirc$ learns a classifier $m _ { \theta }$ to map from the order-sensitively concatenated $n$ query outputs, $[ f ( x ^ { i } ) ] _ { i = 1 \cdots n }$ $( n \times 1 0$ dim for MNIST), to the simultaneous prediction of 12 attributes in $f$ . The training objective is:
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\operatorname* { m i n } _ { \theta } { } _ { f \sim \mathcal { F } } \left[ \sum _ { a = 1 } ^ { 1 2 } \mathcal { L } \left( m _ { \theta } ^ { a } \left( [ f ( x ^ { i } ) ] _ { i = 1 } ^ { n } \right) , y ^ { a } \right) \right]
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 2: Training procedure for metamodels kennen-o (top) and kennen-i (bottom).
|
| 92 |
+
|
| 93 |
+
where $\mathcal { F }$ is the distribution of meta-training models, $y ^ { a }$ is the ground truth label of attribute $a$ , and $\mathcal { L }$ is the cross-entropy loss. With the learned parameter $\tilde { \theta }$ $m _ { \tilde { \theta } } ^ { a } \left( [ g ( x ^ { i } ) ] _ { i = 1 } ^ { n } \right)$ gives the prediction of attribute $a$ for the black box $g$ .
|
| 94 |
+
|
| 95 |
+
In our experiments, we model the classifier $m _ { \theta }$ via multilayer perceptron (MLP) with two hidden layers with 1000 hidden units. The last layer consists of 12 parallel linear layers for a simultaneous prediction of the attributes. In our preliminary experiments, MLP has performed better than the linear classifiers. The optimisation problem in equation 1 is solved via SGD by approximating the expectation over $f \sim \mathbb { F }$ by an empirical sum over the training split classifiers for 200 epochs.
|
| 96 |
+
|
| 97 |
+
For query inputs, we have used a random subset of $n$ images from the validation set (both for MNIST and ImageNet experiments). The performance is not sensitive to the choice of queries (see appendix $\ S C _ { \iota }$ ). Next methods $( \mathrm { k e n n e n - i } / \mathrm { i } \circ )$ describe how to actively craft query inputs, potentially outside the natural image distribution.
|
| 98 |
+
|
| 99 |
+
Note that kennen $- \bigcirc$ can be applied to any type of model (e.g. non-neural networks) with any output structure, as long as the output can be embedded in an Euclidean space. We will show that this method can effectively extract information from $f$ even if the output is a top-k ranking.
|
| 100 |
+
|
| 101 |
+
# K E N N E N-I: CRAFT INPUT
|
| 102 |
+
|
| 103 |
+
kennen $- \dot { \beth }$ crafts a single query input $\tilde { x }$ over the meta-training models that is trained to repurpose a digit classifier $f$ into a model attribute classifier for a single attribute $a$ . The crafted input drives the classifier to leak internal information via digit prediction. The learned input is submitted to the test black-box model $g$ , and the attribute is predicted by reading off its digit prediction $g ( \tilde { x } )$ . For example, kennen $- \dot { \mathtt { 1 } }$ for max-pooling layer prediction crafts an input $x$ that is predicted as “1” for generic MNIST digit classifiers with max-pooling layers and $ { { } ^ { 6 } } { 0 ^ { 9 } }$ for ones without. See figure 3 for visual examples.
|
| 104 |
+
|
| 105 |
+
We describe in detail how kennen-i learns this input. The training objective is:
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\operatorname* { m i n } _ { x : { \mathrm { i m a g e } } } \ { \underset { f \sim { \mathcal F } } { \mathbb E } } \left[ { \mathcal { L } } \left( f ( x ) , y ^ { a } \right) \right]
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
where $f ( x )$ is the 10-dimensional output of the digit classifier $f$ . The condition $x :$ image ensures the input stays a valid image $x \in [ \breve { 0 } , 1 ] ^ { D }$ with image dimension $D$ . The loss $\mathcal { L }$ , together with the attribute label $y ^ { a }$ of $f$ , guides the digit prediction $f ( x )$ to reveal the attribute $a$ instead. Note that the optimisation problem is identical
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 3: Inputs designed to extract internal details from MNIST digit classifiers. E.g. feeding the middle image reveals the existence of a maxpooling layer with $9 4 . 8 \%$ chance.
|
| 115 |
+
|
| 116 |
+
to the training of digit classifiers except that the ground truth is the attribute label rather than the digit label, that the loss is averaged over the models instead of the images, and that the input $x$ instead of the model $f$ is optimised. With the learned query input $\tilde { x }$ , the attribute for the black box $g$ is predicted by $g ( \tilde { x } )$ . In particular, we do not use gradient information from $g$ .
|
| 117 |
+
|
| 118 |
+
We initialise $x$ with a random sample from the MNIST validation set (random noise or uniform gray initialisation gives similar performances), and run SGD for 200 epochs. For each iteration $x$ is truncated back to $[ \bar { 0 } , 1 ] ^ { D }$ to enforce the constraint.
|
| 119 |
+
|
| 120 |
+
While being simple and effective, kennen-i can only predict a single attribute at a time, and cannot predict attributes with more than 10 classes (for digit classifiers). kennen-io introduced below overcomes these limitations. kennen $- \dot { \beth }$ may also be unrealistic when the exploration needs to be stealthy: it submits unnatural images to the system. Also unlike kennen-o, kennen $^ { - \dot { 1 } }$ requires end-to-end differentiability of the training models $f \sim \mathcal { F }$ , although it still requires only black-box access to test models $g$ .
|
| 121 |
+
|
| 122 |
+
# K E N N E N-I O: COMBINED APPROACH
|
| 123 |
+
|
| 124 |
+
We overcome the drawbacks of kennen-i that it can only predict one attribute at a time and that the number of predictable classes by attaching an additional interpretation module on top of the output. Our final method kennen-io combines kennen-i and kennen-o approaches: both input generator and output interpreters are used. Being able to reason over multiple query outputs via MLP layers, kennen-io supports the optimisation of multiple query inputs as well.
|
| 125 |
+
|
| 126 |
+
Specifically, the kennen-io training objective is given by:
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
\operatorname* { m i n } _ { [ x ^ { i } ] _ { i = 1 } ^ { n } : \mathrm { i m a g e s } } \operatorname* { m i n } _ { \theta } \underset { f \sim \mathcal { F } } { \mathbb { E } } \left[ \sum _ { a = 1 } ^ { 1 2 } \mathcal { L } \left( m _ { \theta } ^ { a } \left( [ f ( x ^ { i } ) ] _ { i = 1 } ^ { n } \right) , y ^ { a } \right) \right] .
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
Note that the formulation is identical to that for kennen $- \bigcirc$ (equation 1), except that the second minimisation problem regarding the query inputs is added. With learned parameters $\tilde { \theta }$ and $[ \tilde { x } ^ { i } ] _ { i = 1 } ^ { n }$ ,
|
| 133 |
+
|
| 134 |
+
Table 2: Comparison of metamodel methods. See table 1 for the full names of attributes. 100 queries are used for every method below, except for kennen-i which uses a single query. The “Output” column shows the output representation: “prob” (vector of probabilities for each digit class), “ranking” (a sorted list of digits according to their likelihood), “top-1” (most likely digit), or “bottom-1” (least likely digit).
|
| 135 |
+
|
| 136 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2"> Output</td><td colspan="8">architecture</td><td colspan="2">optim</td><td colspan="2">data</td></tr><tr><td>act</td><td>drop</td><td>pool</td><td>ks</td><td>#conv</td><td></td><td></td><td>#fc #par ens</td><td>algbs</td><td></td><td>size split</td><td>avg</td></tr><tr><td>Chance</td><td>-</td><td>25.0</td><td>50.0</td><td>50.0</td><td>50.0</td><td>33.3</td><td>33.3</td><td>12.5 50.0</td><td></td><td>33.3 33.3</td><td></td><td>33.3 14.3</td><td>34.9</td></tr><tr><td>kennen-o</td><td>prob</td><td>80.6</td><td>94.6</td><td>94.9</td><td>84.6</td><td>67.1</td><td>77.3</td><td>41.7 54.0</td><td></td><td>71.8 50.4</td><td></td><td>73.8 90.0</td><td>73.4</td></tr><tr><td>kennen-o</td><td>ranking</td><td>63.7</td><td>93.8</td><td>90.8</td><td>80.0</td><td>63.0</td><td>73.7</td><td>44.1</td><td>62.4</td><td>65.3 47.0</td><td>66.2</td><td>86.6</td><td>69.7</td></tr><tr><td>kennen-o</td><td>bottom-1</td><td>48.6</td><td>80.0</td><td>73.6</td><td>64.0</td><td>48.9</td><td>63.1</td><td></td><td>28.7 52.8</td><td>53.6 41.9</td><td></td><td>45.9 51.4</td><td>54.4</td></tr><tr><td>kennen-o</td><td>top-1</td><td>31.2</td><td>56.9</td><td>58.8</td><td>49.9</td><td>38.9</td><td>33.7</td><td>19.6</td><td>50.0</td><td>36.1 35.3</td><td>33.3</td><td>30.7</td><td>39.5</td></tr><tr><td>kennen-i</td><td>top-1</td><td>43.5</td><td>77.0</td><td>94.8</td><td>88.5</td><td>54.5</td><td>41.0</td><td>32.3</td><td>46.5</td><td>45.7 37.0</td><td></td><td>42.6 29.3</td><td>52.7</td></tr><tr><td>kennen-io</td><td>score</td><td>88.4 95.8</td><td></td><td></td><td>99.5 97.7</td><td>80.3</td><td>80.2</td><td>45.2</td><td>60.2</td><td>79.3 54.3</td><td></td><td>84.8 95.6</td><td>80.1</td></tr></table>
|
| 137 |
+
|
| 138 |
+
the attribute $a$ for the black box $g$ is predicted by $m _ { \tilde { \theta } } ^ { a } \ : \left( [ g ( \tilde { x } ^ { i } ) ] _ { i = 1 } ^ { n } \right)$ . Again, we require end-to-end differentiability of meta-training models $f$ , but only the black-box access for the test model $g$ .
|
| 139 |
+
|
| 140 |
+
To improve stability against covariate shift, we initialise $m _ { \theta }$ with kennen-o for 200 epochs. Afterwards, gradient updates of $[ x ^ { i } ] _ { i = 1 } ^ { n }$ and $\theta$ alternate every 50 epochs, for 200 additional epochs.
|
| 141 |
+
|
| 142 |
+
# 4 REVERSE-ENGINEERING BLACK-BOX MNIST DIGIT CLASSIFIERS
|
| 143 |
+
|
| 144 |
+
We have introduced a procedure for constructing a dataset of classifiers (MNIST-NETS) as well as novel metamodels (kennen variants) that learn to extract information from black-box classifiers. In this section, we evaluate the ability of kennen to extract information from black-box MNIST digit classifiers. We measure the class-balanced attribute prediction accuracy for each attribute $a$ in the list of 12 attributes in table 1.
|
| 145 |
+
|
| 146 |
+
# ATTRIBUTE PREDICTION
|
| 147 |
+
|
| 148 |
+
See table 2 for the main results of our metamodels, kennen-o/i/io, on the Random split. Unless stated otherwise, metamodels are trained with 5, 000 training split classifiers.
|
| 149 |
+
|
| 150 |
+
Given $n = 1 0 0$ queries with probability output, kennen-o already performs far above the random chance in predicting 12 diverse attributes ( $7 3 . 4 \%$ versus $3 4 . 9 \%$ on average); neural network output indeed contains rich information about the black box. In particular, the presence of dropout $( 9 4 . 6 \% )$ or max-pooling $( 9 4 . 9 \% )$ has been predicted with high precision. As we will see in $\ S 4 . 3$ , outputs of networks trained with dropout layers form clusters, explaining the good prediction performance.
|
| 151 |
+
|
| 152 |
+
It is surprising that optimisation details like algorithm $( 7 1 . 8 \% )$ and batch size $( 5 0 . 4 \% )$ can also be predicted well above the random chance $3 3 . 3 \%$ for both). We observe that the training data attributes are also predicted with high accuracy $( 7 1 . 8 \%$ and $9 0 . 0 \%$ for size and split).
|
| 153 |
+
|
| 154 |
+
# COMPARING METHODS K E N N E N-O/I/I O
|
| 155 |
+
|
| 156 |
+
Table 2 shows the comparison of kennen-o/i/io. kennen $- \dot { \mathtt { 1 } }$ has a relatively low performance (average $5 2 . 7 \% )$ ), but kennen-i relies on a cheap resource: 1 query with single-label output. kennen-i is also performant at predicting the kernel size $( 8 8 . 5 \% )$ and pooling $( 9 4 . 8 \% )$ , attributes that are closely linked to spatial structure of the input. We conjecture kennen-i is relatively effective for such attributes. kennen-io is superior to kennen $- \phantom { } _ { \mathsf { O } } / \mathrm { i }$ for all the attributes with average accuracy $8 0 . 1 \%$ .
|
| 157 |
+
|
| 158 |
+
# 4.1 FACTOR ANALYSIS
|
| 159 |
+
|
| 160 |
+
We examine potential factors that contribute to the successful prediction of black box internal attributes. We measure the prediction accuracy of our metamodels as we vary (1) the number of meta-training models, (2) the number of queries, and (3) the quality of query output.
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 4: kennen $- \bigcirc$ performance of against the size of meta-training set (left), number of queries (middle), and quality of queries (right). Unless stated otherwise, we use 100 probability outputs and 5k models to train kennen-o. Each curve is linearly scaled such that random chance (0 training data, 0 query, or top-0) performs $0 \%$ , and the perfect predictor performs $100 \%$ .
|
| 164 |
+
|
| 165 |
+
# NUMBER OF TRAINING MODELS
|
| 166 |
+
|
| 167 |
+
We have trained kennen $- \bigcirc$ with different number of the meta-training classifiers, ranging from 100 to 5, 000. See figure 4 (left) for the trend. We observe a diminishing return, but also that the performance has not saturated – collecting larger meta-training set will improve the performance.
|
| 168 |
+
|
| 169 |
+
# NUMBER OF QUERIES
|
| 170 |
+
|
| 171 |
+
See figure 4 (middle) for the kennen-o performance against the number of queries with probability output. The average performance saturates after $\sim 5 0 0$ queries. On the other hand, with only $\sim 1 0 0$ queries, we already retrieve ample information about the neural network.
|
| 172 |
+
|
| 173 |
+
# QUALITY OF OUTPUT
|
| 174 |
+
|
| 175 |
+
Many black-box models return top- $\mathbf { \nabla } \cdot \mathbf { k }$ ranking (e.g. Facebook face recogniser), or single-label output. We represent top- $\mathbf { \nabla } \cdot \mathbf { k }$ ranking outputs by assigning exponentially decaying probabilities up to $k$ digits and a small probability $\epsilon$ to the remaining.
|
| 176 |
+
|
| 177 |
+
See table 2 for the kennen $- \bigcirc$ performance comparison among 100 probability, top-10 ranking, bottom-1, and top-1 outputs, with average accuracies $7 3 . 4 \%$ , $6 9 . 7 \%$ , $5 4 . 4 \%$ , and $3 9 . 5 \%$ , respectively. While performance drops with coarser outputs, when compared to random chance $( 3 4 . 9 \% )$ , 100 single-label bottom-1 outputs already leak a great amount of information about the black box $( 5 4 . 4 \% )$ . It is also notable that bottom-1 outputs contain much more information than do the top1 outputs; note that for high-performance classifiers top-1 predictions are rather uniform across models and thus have much less freedom to leak auxiliary information. Figure 4 (right) shows the interpolation from top-1 to top-10 (i.e. top-9) ranking. We observe from the jump at $k = 2$ that the second likely predictions (top-2) contain far more information than the most likely ones (top-1). For $k \geq 3$ , each additional output label exhibits a diminishing return.
|
| 178 |
+
|
| 179 |
+
# 4.2 WHAT IF THE BLACK-BOX IS QUITE DIFFERENT FROM META-TRAINING MODELS?
|
| 180 |
+
|
| 181 |
+
So far we have seen results on the Random (R) split. In realistic scenarios, the meta-training model distribution may not be fully covering possible black box models. We show how damaging such a scenario is through Extrapolation (E) split experiments.
|
| 182 |
+
|
| 183 |
+
# EVALUATION
|
| 184 |
+
|
| 185 |
+
E-splits split the training and testing models based on one or more attributes (§3.1). For example, we may assign shallower models (#layers $\leq 1 0$ ) to the training split and deeper ones (#layers $\it { i } ^ { \scriptsize { 1 0 } \mathrm { ) } }$ to the testing split. In this example, we refer to #layers as the splitting attribute. Since for an E-split, some classes of the splitting attributes have zero training examples, we only evaluate the prediction accuracies over the non-splitting attributes. When the set of splitting attributes is $\tilde { A }$ , a subset of the entire attribute set $A$ , we define $E$ -split accuracy or $\operatorname { E . A c c } ( { \tilde { A } } )$ to be the mean prediction accuracy over the non-splitting attributes $A \setminus { \tilde { A } }$ . For easier comparison, we report the normalised accuracy (N.Acc) that shows the how much percentage of the R-split accuracy is achieved in the E-split setup on the non-splitting attributes $A \setminus { \tilde { A } }$ . Specifically:
|
| 186 |
+
|
| 187 |
+
$$
|
| 188 |
+
\mathrm { N . A c c } ( \tilde { A } ) = \frac { \mathrm { E . A c c } ( \tilde { A } ) - \mathrm { C h a n c e } ( \tilde { A } ) } { \mathrm { R . A c c } ( \tilde { A } ) - \mathrm { C h a n c e } ( \tilde { A } ) } \times 1 0 0 \%
|
| 189 |
+
$$
|
| 190 |
+
|
| 191 |
+
where ${ \mathrm { R . A c c } } ( { \tilde { A } } )$ and Chance $( { \tilde { A } } )$ are the means of the R-split and Chance-level accuracies over $A \setminus { \tilde { A } }$ . Note that N.Acc is $100 \%$ if the E-split performance is at the level of R-split and $0 \%$ if it is at chance level.
|
| 192 |
+
|
| 193 |
+
# RESULTS
|
| 194 |
+
|
| 195 |
+
The normalised accuracies for R-split and multiple E-splits are presented in table 3. We consider three axes of choices of splitting attributes for the E-split: architecture (#conv and #fc), optimisation (alg and bs), and data (size). For example, “E-#conv-#fc” row presents results when metamodel is trained on shallower nets (2 or 3 conv/fc layers each) compared to the test black box model (4 conv and fc layers each).
|
| 196 |
+
|
| 197 |
+
Not surprisingly, E-split performances are lower than R-split ones $( \mathrm { N . A c c } < 1 0 0 \% )$ ; it is advisable to cover all the expected black-box attributes during meta-training. Nonetheless, E-split performances of kennen-io are still far above the chance level $( \mathrm { N . A c c } \ge 7 0 \% \gg$ $0 \%$ ); failing to cover a few attributes during meta-training is not too damaging.
|
| 198 |
+
|
| 199 |
+
Table 3: Normalised accuracies (see text) of kennen-o and kennen-io on R and E splits. We denote E-split with splitting attributes attr1 and attr2 as “E-attr1-attr2”. Splitting criteria are also shown. When there are two splitting attributes, the first attribute inherits the previous row criteria.
|
| 200 |
+
|
| 201 |
+
<table><tr><td rowspan=2 colspan=9>kennen-Split Train Test 。 ioR = 100 100</td></tr><tr><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td></tr><tr><td rowspan=1 colspan=1>E-#conv</td><td></td><td rowspan=1 colspan=1>2.3</td><td></td><td rowspan=1 colspan=1>4</td><td></td><td rowspan=1 colspan=1>87.5</td><td></td><td rowspan=1 colspan=1>92.0</td></tr><tr><td rowspan=1 colspan=1>E-#conv-#fc</td><td></td><td rowspan=1 colspan=1>2.3</td><td></td><td rowspan=1 colspan=1>4</td><td></td><td rowspan=1 colspan=1>77.1</td><td></td><td rowspan=1 colspan=1>80.7</td></tr><tr><td rowspan=1 colspan=1>E-alg</td><td></td><td rowspan=1 colspan=1>SGD,ADAM</td><td></td><td rowspan=1 colspan=1>RMSprop</td><td></td><td rowspan=1 colspan=1>83.0</td><td></td><td rowspan=1 colspan=1>88.5</td></tr><tr><td rowspan=1 colspan=1>E-alg-bs</td><td></td><td rowspan=1 colspan=1>64,128</td><td></td><td rowspan=1 colspan=1>256</td><td></td><td rowspan=1 colspan=1>64.2</td><td></td><td rowspan=1 colspan=1>70.0</td></tr><tr><td rowspan=1 colspan=1>E-split</td><td></td><td rowspan=1 colspan=1>Quartero/1</td><td></td><td rowspan=1 colspan=1>Quarter2/3</td><td></td><td rowspan=1 colspan=1>83.5</td><td></td><td rowspan=1 colspan=1>89.3</td></tr><tr><td rowspan=1 colspan=1>E-size</td><td></td><td rowspan=1 colspan=1>Quarter</td><td></td><td rowspan=1 colspan=1>Half,All</td><td></td><td rowspan=1 colspan=1>81.7</td><td></td><td rowspan=1 colspan=1>86.8</td></tr><tr><td rowspan=1 colspan=1>Chance</td><td></td><td rowspan=1 colspan=1></td><td></td><td rowspan=1 colspan=1></td><td></td><td rowspan=1 colspan=1>0.0</td><td></td><td rowspan=1 colspan=1>0.0</td></tr></table>
|
| 202 |
+
|
| 203 |
+
Comparing kennen-o and kennen-io for their generalisability, we observe that kennen-io consistently outperforms kennen-o under severe extrapolation (around $5 ~ { \mathsf { p p } }$ better N.Acc). It is left as a future work to investigate the intriguing fact that utilising out-of-domain query inputs improves the generalisation of metamodel.
|
| 204 |
+
|
| 205 |
+
# 4.3 WHY AND HOW DOES METAMODEL WORK?
|
| 206 |
+
|
| 207 |
+
It is surprising that metamodels can extract inner details with great precision and generalisability. This section provides a glimpse of why and how this is possible via metamodel input and output analyses. Full answers to those questions is beyond the scope of the paper.
|
| 208 |
+
|
| 209 |
+
# METAMODEL INPUT (T-SNE)
|
| 210 |
+
|
| 211 |
+
We analyse the inputs to our metamodels (i.e. query outputs from black-box models) to convince ourselves that the inputs do contain discriminative features for model attributes. As the input is high dimensional (1000 when the number of queries is $n = 1 0 0 ,$ ), we use the t-SNE (van der Maaten & Hinton, Nov 2008) visualisation method. Roughly speaking, t-SNE embeds high dimensional data points onto the 2-dimensional plane such that the pairwise distances are best respected. We then colour-code the embedded data points according to the model attributes. Clusters of same-coloured points indicate highly discriminative features.
|
| 212 |
+
|
| 213 |
+
The visualisation of input data points are shown in Appendix figures 9 and 10 for kennen-o and kennen-io, respectively. For experimental details, see Appendix $\ S _ { \mathrm { D } }$ . In the case of kennen-o, we observe that some attributes form clear clusters in the input space – e.g. Tanh in act, binary dropout attribute, and RMSprop in alg. For the other attributes, however, it seems that the clusters are too complicated to be represented in a 2-dimensional space. For kennen-io (figure 10), we observe improved clusters for pool and ks. By submitting crafted query inputs, kennen-io induces query outputs to be better clustered, increasing the chance of successful prediction.
|
| 214 |
+
|
| 215 |
+
METAMODEL OUTPUT (CONFUSION MATRIX)
|
| 216 |
+
|
| 217 |
+
We show confusion matrices of kennen-o/io to analyse the failure modes. See Appendix figures 11 and 12. For kennen-o and kennen-io alike, we observe that the confusion occurs more frequently with similar classes. For attributes #conv and #fc, more confusion occurs between $( 2 , 3 )$ or $( 3 , 4 )$ than between $( 2 , 4 )$ . A similar trend is observed for #par and bs. This is a strong indication that (1) there exists semantic attribute information in the neural network outputs (e.g. number of layers, parameters, or size of training batch) and (2) the metamodels learn semantic information that can generalise, as opposed to merely relying on artifacts. This observation agrees with a conclusion of the extrapolation experiments in $\ S 4 . 2$ : the metamodels generalise.
|
| 218 |
+
|
| 219 |
+
Compared to those of kennen $- \bigcirc$ , kennen $- \dot { \beth } \bigcirc$ confusion matrices exhibit greater concentration of masses both on the correct class (diagonals) and among similar attribute classes (1-off diagonals for #conv, #fc, #par, bs, and size). The former re-confirms the greater accuracy, while the latter indicates the improved ability to extract more semantic and generalisable features from the query outputs. This, again, agrees with $\ S 4 . 2$ : kennen-io generalises better than kennen $- \bigcirc$ .
|
| 220 |
+
|
| 221 |
+
# 4.4 DISCUSSION
|
| 222 |
+
|
| 223 |
+
We have verified through our novel kennen metamodels that black-box access to a neural network exposes much internal information. We have shown that only 100 single-label outputs already reveals a great deal about a black box. When the black-box classifier is quite different from the metatraining classifiers, the performance of our best metamodel – kennen-io– decreases; however, the prediction accuracy for black box internal information is still surprisingly high.
|
| 224 |
+
|
| 225 |
+
# 5 REVERSE-ENGINEERING AND ATTACKING IMAGENET CLASSIFIERS
|
| 226 |
+
|
| 227 |
+
While MNIST experiments are computationally cheap and a massive number of controlled experiments is possible, we provide additional ImageNet experiments for practical implications on realistic image classifiers. In this section, we use kennen $- \circ$ introduced in $\ S 3$ to predict a single attribute of black-box ImageNet classifiers – the architecture family (e.g. ResNet or VGG?). In this section, we go a step further to use the extracted information to attack black boxes with adversarial examples.
|
| 228 |
+
|
| 229 |
+
# 5.1 DATASET OF IMAGENET CLASSIFIERS
|
| 230 |
+
|
| 231 |
+
It is computationally prohibitive to train $O ( 1 0 k )$ ImageNet classifiers from scratch as in the previous section. We have resorted to 19 PyTorch3 pretrained ImageNet classifiers. The 19 classifiers come from five families: Squeezenet, VGG, VGG-BatchNorm, ResNet, and DenseNet, each with 2, 4, 4, 5, and 4 variants, respectively (Iandola et al., 2016; Simonyan & Zisserman, 2015; Ioffe & Szegedy, 2015; He et al., 2016; Huang et al., 2017). See Appendix table 7 for the the summary of the 19 classifiers. We observe both large intra-family diversity and small inter-family separability in terms of #layers, #parameters, and performances. The family prediction task is not as trivial as e.g. simply inferring the performance.
|
| 232 |
+
|
| 233 |
+
# 5.2 CLASSIFIER FAMILY PREDICTION
|
| 234 |
+
|
| 235 |
+
We predict the classifier family (S, V, B, R, D) from the black-box query output, using the method kennen-o, with the same MLP architecture (§3). kennen-i and kennen-io have not been used for computational reasons, but can also be used in principle. We conduct 10 cross validations (random sampling of single test network from each family) for evaluation. We also perform 10 random sampling of the queries from ImageNet validation set. In total 100 random tries are averaged.
|
| 236 |
+
|
| 237 |
+
Results: compared to the random chance $( 2 0 . 0 \% )$ , 100 queries result in high kennen $- \bigcirc$ performance $( 9 0 . 4 \% )$ . With 1, 000 queries, the prediction performance is even $9 4 . 8 \%$ .
|
| 238 |
+
|
| 239 |
+
# 5.3 ATTACKING IMAGENET CLASSIFIERS
|
| 240 |
+
|
| 241 |
+
In this section we attack ImageNet classifiers with adversarial image perturbations (AIPs). We show that the knowledge about the black box architecture family makes the attack more effective.
|
| 242 |
+
|
| 243 |
+
# ADVERSARIAL IMAGE PERTURBATION (AIP)
|
| 244 |
+
|
| 245 |
+
AIPs are carefully crafted additive perturbations on the input image for the purpose of misleading the target model to predict wrong labels (Goodfellow et al., 2015). Among variants of AIPs, we use efficient and robust GAMAN (Oh et al., 2017). See appendix figure 7 for examples of AIPs; the perturbation is nearly invisible.
|
| 246 |
+
|
| 247 |
+
# TRANSFERABILITY OF AIPS
|
| 248 |
+
|
| 249 |
+
Typical AIP algorithms require gradients from the target network, which is not available for a black box. Mainly three approaches for generating AIPs against black boxes have been proposed: (1) numerical gradient, (2) avatar network, or (3) transferability. We show that our metamodel strengthens the transferability based attack.
|
| 250 |
+
|
| 251 |
+
Table 4: Transferability of adversarial examples within and across families. We report misclassification rates.
|
| 252 |
+
|
| 253 |
+
<table><tr><td rowspan=2 colspan=7>Target familyGen S V B R DClean 3832283029</td></tr><tr><td rowspan=1 colspan=1>38</td><td rowspan=1 colspan=1>32</td><td rowspan=1 colspan=1>28</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>29</td></tr><tr><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>49</td><td rowspan=1 colspan=1>45</td><td rowspan=1 colspan=1>39</td><td rowspan=1 colspan=1>35</td></tr><tr><td rowspan=1 colspan=1>V</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>62</td><td rowspan=1 colspan=1>96</td><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>57</td><td rowspan=1 colspan=1>52</td></tr><tr><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>85</td><td rowspan=1 colspan=1>95</td><td rowspan=1 colspan=1>47</td><td rowspan=1 colspan=1>44</td></tr><tr><td rowspan=1 colspan=1>R</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>72</td><td rowspan=1 colspan=1>78</td><td rowspan=1 colspan=1>87</td><td rowspan=1 colspan=1>77</td></tr><tr><td rowspan=1 colspan=1>D</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>58</td><td rowspan=1 colspan=1>63</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>76</td><td rowspan=1 colspan=1>90</td></tr><tr><td rowspan=1 colspan=1>Ens</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>93</td><td rowspan=1 colspan=1>93</td><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>80</td></tr></table>
|
| 254 |
+
|
| 255 |
+
We hypothesize and empirically show that AIPs transfer better within the architecture family than across. Using this property, we first predict the family of the black box (e.g. ResNet), and then generate AIPs against a few instances in the family (e.g. ResNet101, ResNet152). The generation of AIPs against multiple targets has been proposed by Liu et al. (2017), but we are the first to systemically show that AIPs generalise better within a family when they are generated against multiple instances from the same family.
|
| 256 |
+
|
| 257 |
+
We first verify our hypothesis that AIPs transfer better within a family. Within-family: we do a leave-one-out cross validation – generate AIPs using all but one instances of the family and test on the holdout. Not using the exact test black box, this gives a lower bound on the within-family performance. Across-family: still leave out one random instance from the generating family to match the generating set size with the within-family cases. We also include the use-all case (Ens): generate AIPs with one network from each family.
|
| 258 |
+
|
| 259 |
+
See table 4 for the results. We report the misclassification rate, defined as 100−top-1 accuracy, on 100 random ImageNet validation images. We observe that the within-family performances dominate the across-family ones (diagonal entries versus the others in each row); if the target black box family is identified, one can generate more effective AIPs. Finally, trying to target all network (“Ens”) is not as effective as focusing resources (diagonal entries).
|
| 260 |
+
|
| 261 |
+
# METAMODEL ENABLES MORE EFFECTIVE ATTACKS
|
| 262 |
+
|
| 263 |
+
We empirically show that the reverse-engineering enables more effective attacks. We consider multiple scenarios. “White box” means the target model is fully known, and the AIP is generated specifically for this model. “Black box” means the exact target is unknown, but we make a distinction when the family is known (“Family black box”).
|
| 264 |
+
|
| 265 |
+
See table 5 for the misclassification rates (MC) in different scenarios. When the target is fully specified (white box), MC is $100 \%$ . When neither the exact target nor the family is known, AIPs are generated against multiple families $( 8 2 . 2 \% )$ . When the reverse-engineering takes place, and AIPs are generated over the predicted family, attacks become more effective $( 8 5 . 7 \% )$ . We almost reach the family-oracle case $( 8 6 . 2 \% )$ .
|
| 266 |
+
|
| 267 |
+
Table 5: Black-box ImageNet classifier misclassification rates (MC) for different approaches.
|
| 268 |
+
|
| 269 |
+
<table><tr><td>Scenario</td><td>Generating nets</td><td>MC(%)</td></tr><tr><td>White box</td><td>Single white box</td><td>100.0</td></tr><tr><td>Family black box</td><td>GT family</td><td>86.2</td></tr><tr><td>Black box whitened</td><td>Predicted family</td><td>85.7</td></tr><tr><td>Black box</td><td>Multiple families</td><td>82.2</td></tr></table>
|
| 270 |
+
|
| 271 |
+
# 5.4 DISCUSSION
|
| 272 |
+
|
| 273 |
+
Our metamodel can predict architecture families for ImageNet classifiers with high accuracy. We additionally show that this reverse-engineering enables more focused attack on black-boxes.
|
| 274 |
+
|
| 275 |
+
# 6 CONCLUSION
|
| 276 |
+
|
| 277 |
+
We have presented first results on the inference of diverse neural network attributes from a sequence of input-output queries. Our novel metamodel methods, kennen, can successfully predict attributes related not only to the architecture but also to training hyperparameters (optimisation algorithm and dataset) even in difficult scenarios (e.g. single-label output, or a distribution gap between the metatraining models and the target black box). We have additionally shown in ImageNet experiments that reverse-engineering a black box makes it more vulnerable to adversarial examples.
|
| 278 |
+
|
| 279 |
+
# ACKNOWLEDGMENTS
|
| 280 |
+
|
| 281 |
+
This research was supported by the German Research Foundation (DFG CRC 1223). We thank Seong Ah Choi for her help with the method names, graphics, and colour palettes.
|
| 282 |
+
|
| 283 |
+
# REFERENCES
|
| 284 |
+
|
| 285 |
+
Giuseppe Ateniese, Giovanni Felici, Liugi V. Mancini, Angelo Spognardi, Antonio Villani, and Domenico Vitali. Hacking smart machines with smarter ones: How to extract meaningful data from machine learning classifiers. In IJSN, 2015.
|
| 286 |
+
|
| 287 |
+
Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In ACMCCS-W, 2017.
|
| 288 |
+
|
| 289 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2015.
|
| 290 |
+
|
| 291 |
+
Jamie Hayes and George Danezis. Machine learning as an adversarial service: Learning black-box adversarial examples. 2017.
|
| 292 |
+
|
| 293 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
|
| 294 |
+
|
| 295 |
+
Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017.
|
| 296 |
+
|
| 297 |
+
Forrest N. Iandola, Song Han, Matthew W. Moskewicz, Khalid Ashraf, William J. Dally, and Kurt Keutzer. Squeezenet: Alexnet-level accuracy with $5 0 \mathrm { x }$ fewer parameters and ${ < } 0 . 5 \mathrm { m b }$ model size. arXiv, 2016.
|
| 298 |
+
|
| 299 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
|
| 300 |
+
|
| 301 |
+
Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 1998.
|
| 302 |
+
|
| 303 |
+
Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In ICLR, 2017.
|
| 304 |
+
|
| 305 |
+
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. In CVPR, 2017.
|
| 306 |
+
|
| 307 |
+
Nina Narodytska and Shiva Prasad Kasiviswanathan. Simple black-box adversarial perturbations for deep networks. In CVPRW, 2017.
|
| 308 |
+
|
| 309 |
+
S. J. Oh, Mario Fritz, and Bernt Schiele. Adversarial image perturbation for privacy protection a game theory perspective. In ICCV, 2017.
|
| 310 |
+
|
| 311 |
+
Nicolas Papernot, Patrick McDaniel, and Ian Goodfellow. Transferability in machine learning: from phenomena to black-box attacks using adversarial samples. arXiv, 2016a.
|
| 312 |
+
|
| 313 |
+
Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z. Berkay Celik, and Anathram Swami. Practical black-box attacks against deep learning systems using adversarial examples. 2016b.
|
| 314 |
+
|
| 315 |
+
Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against deep learning systems using adversarial examples. In ASIACCS, 2017.
|
| 316 |
+
|
| 317 |
+
Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In SP, 2017.
|
| 318 |
+
|
| 319 |
+
K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
|
| 320 |
+
|
| 321 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2014.
|
| 322 |
+
|
| 323 |
+
Florian Tramer, Fan Zhang, Ari Juels, Michael K. Reiter, and Thomas Ristenpart. Stealing machine learning models via prediction apis. In USENIX, 2016.
|
| 324 |
+
|
| 325 |
+
L.J.P van der Maaten and G.E. Hinton. Visualizing high-dimensional data using t-sne. Journal of Machine Learning Research, 9: 25792605, Nov 2008.
|
| 326 |
+
|
| 327 |
+
APPENDIX
|
| 328 |
+
|
| 329 |
+
A MNIST-NETS STATISTICS
|
| 330 |
+
|
| 331 |
+
We show the statistics of MNIST-NETS, our dataset of MNIST classifiers, in table 6.
|
| 332 |
+
|
| 333 |
+
B MORE K E N N E N-I O RESULTS
|
| 334 |
+
|
| 335 |
+
We complement the kennen-o results in the main paper (figure 4) with kennen-io results. See figure 5. Similarly for kennen-o, kennen-io shows a diminishing return as the number of training models and the number of queries increase. While the performance saturates with $1 , 0 0 0$ queries, it does not fully saturate with 5, 000 training samples.
|
| 336 |
+
|
| 337 |
+
# C ON FINDING THE OPTIMAL SET OF QUERIES
|
| 338 |
+
|
| 339 |
+
kennen-o selects a random set of queries from MNIST validation set (§3.2). We measure the sensitivity of kennen-o performance with respect to the choice of queries, and discuss the possibility to optimise the set of queries.
|
| 340 |
+
|
| 341 |
+
With 1, 10, or 100 queries, we have trained kennen-o with 100 independent samples of query sets. The mean and standard deviations are shown in figure 6. The sensitivity is greater for smaller number of queries, but still minute ${ \mathrm { ( 1 . 2 p p } }$ standard deviation).
|
| 342 |
+
|
| 343 |
+
Instead of solving the combinatorial problem of finding the optimal set of query inputs from a dataset, we have proposed kennen-io that efficiently solves a continuous optimisation problem to find a set of query inputs from the entire input space. We have compared kennen-io against kennen-o with multiple query samples in figure 6. We observe that kennen-io is better than kennen-o with all 100 query set samples at each level.
|
| 344 |
+
|
| 345 |
+
We remark that there exists a trade-off between detectability and effectiveness of exploration. While kennen-io extracts information from target model more effectively, it increases the detectability of attack by submitting out-of-domain inputs. If it is possible to optimise or sample the set of natural queries from a dataset or distribution of natural inputs, it will be a strong attack; developing such a method would be an interesting future work.
|
| 346 |
+
|
| 347 |
+
# D T-SNE VISUALISATION OF METAMODEL INPUTS
|
| 348 |
+
|
| 349 |
+
We describe the detailed procedure for the metamodel input visualisation experiment (discussed in $\ S 4 . 3 )$ . First, 1000 test-split (Random split) black-box models are collected. For each model, 100 query images are passed (sampled at random from MNIST validation set), resulting in $1 0 0 \times 1 0$ dimensional input data points. We have used t-SNE(van der Maaten & Hinton, Nov 2008) to embed the data points onto the 2-dimensional plane. Each data point is coloured according to each attribute class. The results for kennen-o and kennen-io are shown in figures 9 and 10. Since t-SNE is sensitive to initialisation, we have run the embedding ten times with different random initialisations; the qualitative observations are largely identical.
|
| 350 |
+
|
| 351 |
+
# E VISUAL EXAMPLES OF AIPS
|
| 352 |
+
|
| 353 |
+
In this section, we show examples of AIPs. See figure 7 for the examples of AIPs and the perturbed images. The perturbation is nearly invisible to human eyes. We have also generated AIPs with respect to a diverse set of architecture families (S, V, B, R, D, SVBRD) at multiple $L _ { 2 }$ norm levels. See figure 8; the same image results in a diverse set of patterns depending on the architecture family.
|
| 354 |
+
|
| 355 |
+
Table 6: Distribution of attributes in MNIST-NETS, and attribute-wise classification performance (on MNIST validation set). Observe that the attributes are evenly distributed and the corresponding classification accuracies also do not correlate much with the attributes. We thus make sure that the classification accuracy alone cannot be a strong cue for predicting attributes.
|
| 356 |
+
|
| 357 |
+
<table><tr><td rowspan="2"></td><td colspan="4">arch/act</td><td colspan="2">arch/drop</td><td colspan="2">arch/pool</td><td colspan="2">arch/ks</td><td colspan="3">arch/#conv</td><td colspan="3">arch/#fc</td></tr><tr><td>Tanh PReLU</td><td></td><td>ReLU</td><td>ELU</td><td>YesNo</td><td></td><td>YesNo</td><td></td><td>5</td><td>3</td><td>2</td><td>3</td><td>4</td><td>2</td><td>3</td><td>4</td></tr><tr><td>Ratio</td><td>24.8</td><td>24.9</td><td>25.3</td><td>25.1</td><td>49.8 50.3</td><td></td><td>49.9 50.2</td><td></td><td>50.3 49.7</td><td></td><td></td><td></td><td>34.0 33.4 32.7</td><td></td><td>33.1 33.5 33.4</td><td></td></tr><tr><td>max</td><td>99.4</td><td>99.4</td><td>99.5</td><td>99.4</td><td>99.5 99.4</td><td></td><td>99.4 99.5</td><td></td><td>99.5 99.4</td><td></td><td>99.4 99.4 99.5</td><td></td><td></td><td></td><td>99.4 99.4 99.5</td><td></td></tr><tr><td>median</td><td>98.6</td><td>98.7</td><td>98.7</td><td>98.7</td><td>98.7 98.6</td><td></td><td>98.7 98.5</td><td></td><td>98.7 98.6</td><td></td><td>98.6 98.7 98.7</td><td></td><td></td><td></td><td>98.7 98.6 98.6</td><td></td></tr><tr><td>mean</td><td>98.6</td><td>98.7</td><td>98.7</td><td>98.7</td><td>98.7 98.6</td><td></td><td>98.7 98.6</td><td></td><td>98.7 98.6</td><td></td><td>98.6 98.7 98.7</td><td></td><td></td><td></td><td>98.7 98.6 98.6</td><td></td></tr><tr><td>min</td><td>98.0</td><td>98.0</td><td>98.0</td><td>98.0</td><td>98.0 98.0</td><td></td><td>98.0 98.0</td><td></td><td>98.0 98.0</td><td></td><td>98.098.0 98.0</td><td></td><td></td><td></td><td>98.0 98.0 98.0</td><td></td></tr><tr><td colspan="3" rowspan="8"></td><td rowspan="8"></td><td colspan="3">opt/alg</td><td colspan="3"></td><td colspan="2"></td><td colspan="3"></td><td colspan="3"></td></tr><tr><td colspan="3"></td><td colspan="3">ADAM SGD</td><td colspan="3">opt/bs 64 128 256</td><td colspan="3">data/size all half</td><td colspan="3"></td></tr><tr><td colspan="3"></td><td colspan="3">RMSprop</td><td colspan="3"></td><td colspan="3"></td><td colspan="3">quarter</td></tr><tr><td colspan="3">Ratio</td><td colspan="3">33.8 32.5</td><td colspan="3">33.7 32.9 33.6</td><td colspan="3">533.7 14.8 28.5</td><td colspan="3">56.8</td></tr><tr><td colspan="3">max</td><td colspan="3">99.2 99.4</td><td colspan="3">99.5 99.399.4 99.5</td><td colspan="3">99.5 99.3</td><td colspan="3">99.1</td></tr><tr><td colspan="3">median</td><td colspan="3">98.6 98.7</td><td colspan="3">98.7 98.6 98.7</td><td colspan="3">98.7 99.0 98.8</td><td colspan="3">98.5</td></tr><tr><td colspan="3">mean</td><td colspan="3">98.6 98.7 98.0</td><td colspan="3">98.6 98.7 98.6</td><td colspan="3">98.9 98.8</td><td colspan="3">98.5</td></tr><tr><td colspan="3">min</td><td colspan="3">98.0</td><td colspan="3">98.7 98.0</td><td colspan="2">98.0 98.0 98.0</td><td colspan="3">98.098.0 98.0</td><td colspan="3"></td></tr></table>
|
| 358 |
+
|
| 359 |
+

|
| 360 |
+
Figure 5: Performance of kennen $- \dot { \textrm { \scriptsize 1 0 } }$ with different number of queries (Left) and size of training set (Right). The curves are linearly scaled per attribute such that random chance performs $0 \%$ , and perfect predictor performs $100 \%$ .
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 6: kennen $- \mathrm { { O } / \ i \mathrm { { O } } }$ performance at different number of queries. kennen $- \bigcirc$ is shown with 100 independent query samples per level (black dots) – the dots are spread horizontally for visualisation purpose. Their mean (curve) and $\pm 2$ standard deviations (error bars) are also shown.
|
| 364 |
+
|
| 365 |
+
Table 7: Details of ImageNet classifiers. We describe each family Squeezenet, VGG, VGGBatchNorm, ResNet, and DenseNet verbally, and show key model statistics for each member in the family. We observe intra-family diversity (e.g. R) and inter-family similarity (e.g. between V and B) in terms of the top-5 validation error and the number of trainable parameters.
|
| 366 |
+
|
| 367 |
+
<table><tr><td></td><td colspan="2">S (2016)</td><td colspan="4">V (2014)</td><td colspan="4">B (2015)</td><td colspan="4">R (2015)</td><td colspan="4">D (2016)</td></tr><tr><td>Description</td><td colspan="2">Lightweight convnet</td><td colspan="4">Conv layers followed by fc layers</td><td colspan="4">VGG with batch normalisation</td><td colspan="4">Very deep convnet with residual connections</td><td colspan="4">ResNet with dense residual connections</td></tr><tr><td>Members</td><td>v1.0</td><td>v1.1</td><td>11</td><td>13</td><td>16</td><td>19</td><td>11</td><td>13</td><td>16 19</td><td>18</td><td>34</td><td>50</td><td>101</td><td>152</td><td>121</td><td>161</td><td>169</td><td>201</td></tr><tr><td>#layers</td><td>26</td><td>26</td><td>11</td><td>13</td><td>16</td><td>19</td><td>11</td><td>13</td><td>19</td><td>21</td><td>37</td><td>54</td><td>105</td><td>156</td><td>121</td><td>161</td><td>169</td><td>201</td></tr><tr><td>log10 #params</td><td>6.1</td><td>6.1</td><td>8.1</td><td>8.1</td><td>8.1</td><td>8.2</td><td>8.1 8.1</td><td>16 8.1</td><td>8.2</td><td>7.1</td><td>7.3</td><td>7.4</td><td>7.6</td><td>7.8</td><td>6.9</td><td>7.3</td><td>7.5</td><td>7.2</td></tr><tr><td>Top-1 error</td><td>41.9</td><td>41.8</td><td>31.0</td><td>30.1</td><td>28.4</td><td>27.6</td><td>29.6 28.5</td><td>26.6</td><td>25.8</td><td>30.2</td><td>26.7</td><td>23.9</td><td>22.6</td><td>21.7</td><td>25.4</td><td>24.0</td><td>22.8</td><td>22.4</td></tr><tr><td>Top-5 error</td><td>19.6</td><td>19.4</td><td>11.4</td><td>10.8</td><td>9.6</td><td>9.1</td><td>10.2</td><td>9.6 8.5</td><td>8.2</td><td>10.9</td><td>8.6</td><td>7.1</td><td>6.4</td><td>5.9</td><td>7.8</td><td>6.2</td><td>7.0</td><td>6.4</td></tr></table>
|
| 368 |
+
|
| 369 |
+

|
| 370 |
+
Figure 7: AIP for an ImageNet classifier. The perturbations are generated at $L _ { 2 } = 1 \times 1 0 ^ { - 4 }$ .
|
| 371 |
+
|
| 372 |
+

|
| 373 |
+
Figure 8: Adversarial perturbations for the same input image (top) generated with diverse ImageNet classifier families (S, V, B, R, D, SVBRD) at different norm constraints. The perturbation images are normalised at the maximal perturbation for visualisation. We observe diverse patterns across classifier families within the same $L _ { 2 }$ ball.
|
| 374 |
+
|
| 375 |
+

|
| 376 |
+
Figure 9: Probability query output embedded into 2-D plane via t-SNE. The same embedding is shown with different colour-coding for each attribute. These are the inputs to the kennen-o metamodel.
|
| 377 |
+
|
| 378 |
+

|
| 379 |
+
Figure 10: Probability query output embedded into 2-D plane via t-SNE. The same embedding is shown with different colour-coding for each attribute. These are the inputs to the kennen-io metamodel.
|
| 380 |
+
|
| 381 |
+

|
| 382 |
+
Figure 11: Confusion matrices for kennen-o.
|
| 383 |
+
|
| 384 |
+

|
| 385 |
+
Figure 12: Confusion matrices for kennen-io.
|
md/train/ChWy1anEuow/ChWy1anEuow.md
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Risk Bounds for Over-parameterized Maximum Margin Classification on Sub-Gaussian Mixtures
|
| 2 |
+
|
| 3 |
+
Yuan Cao Department of Statistics & Actuarial Science Department of Mathematics The University of Hong Kong yuancao@hku.hk
|
| 4 |
+
|
| 5 |
+
Quanquan Gu Department of Computer Science University of California, Los Angeles Los Angeles, CA 90095, USA qgu@cs.ucla.edu
|
| 6 |
+
|
| 7 |
+
# Mikhail Belkin
|
| 8 |
+
|
| 9 |
+
Halicioglu Data Science Institute ˘
|
| 10 |
+
University of California San Diego La Jolla, CA 92093, USA mbelkin@ucsd.edu
|
| 11 |
+
|
| 12 |
+
# Abstract
|
| 13 |
+
|
| 14 |
+
Modern machine learning systems such as deep neural networks are often highly over-parameterized so that they can fit the noisy training data exactly, yet they can still achieve small test errors in practice. In this paper, we study this “benign overfitting” phenomenon of the maximum margin classifier for linear classification problems. Specifically, we consider data generated from sub-Gaussian mixtures, and provide a tight risk bound for the maximum margin linear classifier in the over-parameterized setting. Our results precisely characterize the condition under which benign overfitting can occur in linear classification problems, and improve on previous work. They also have direct implications for over-parameterized logistic regression.
|
| 15 |
+
|
| 16 |
+
# 1 Introduction
|
| 17 |
+
|
| 18 |
+
In modern machine learning, complex models such as deep neural networks have become increasingly popular. These complicated models are capable of fitting noisy training data sets, while at the same time achieving small test errors. In fact, this benign overfitting phenomenon is not a unique feature of deep learning. Even for kernel methods and linear models, [5] demonstrated that interpolators on the noisy training data can still perform near optimally on the test data. A series of recent works [4, 20, 11, 2] theoretically studied how over-parameterization can achieve small population risk.
|
| 19 |
+
|
| 20 |
+
In particular in [2] the authors considered the setting where the data are generated from a ground-truth linear model with noise, and established a tight population risk bound for the minimum norm linear interpolator with a matching lower bound. More recently, [23] further studied benign overfitting in ridge regression, and established non-asymptotic generalization bounds for over-parametrized ridge regression. They showed that those bounds are tight for a range of regularization parameter values. Notably, these results cover arbitrary covariance structure of the data, and give a nice characterization of how the spectrum of the data covariance matrix affects the population risk in the over-parameterized regime.
|
| 21 |
+
|
| 22 |
+
Very recently, benign overfitting has also been studied in the setting of linear classification [6, 19, 25]. Specifically, [19] studied the setting where the data inputs are Gaussian and the labels are generated from a ground truth linear model with label flipping noise, and showed equivalence between the hardmargin support vector machine (SVM) solution and the minimum norm interpolator to study benign overfitting. [6, 25] studied the benign overfitting phenomenon in sub-Gaussian/Gaussian mixture models and established population risk bounds for the maximum margin classifier. [6] leveraged the implicit bias of gradient descent for logistic regression [22] to establish the risk bound. [25] established an equivalence result between classification and regression for isotropic Gaussian mixture models. While these results have offered valuable insights into the benign overfitting phenomenon for (sub-)Gaussian mixture classification, they still have certain limitations. Unlike the results in the regression setting where the eigenvalues of the data covariance matrix play a key role, the current results for Gaussian/sub-Gaussian mixture models do not show the impact of the spectrum of the data covariance matrix on the risk.
|
| 23 |
+
|
| 24 |
+
In this paper, we study the benign overfitting phenomenon in a general sub-Gaussian mixture model that covers both the isotropic and anisotropic settings, where the $d$ -dimensional features from two classes have the same covariance matrix $\pmb { \Sigma }$ but have different means $\pmb { \mu }$ and $- \pmb { \mu }$ respectively. We consider the over-parameterized setting where $d$ is larger than the sample size $n$ , and prove a risk bound for the maximum margin classifier. We show that under certain conditions on eigenvalues of $\pmb { \Sigma }$ , the mean vector $\pmb { \mu }$ and the sample size $n$ , the maximum margin classifier for this problem is identical to the minimum norm interpolator. We then utilize this result to establish a tight population risk bound of the maximum margin classifier. Our result reveals how the eigenvalues of the covariance matrix $\pmb { \Sigma }$ affect the benign property of the classification problem, and is tighter and more general than existing results on sub-Gaussian/Gaussian mixture models. The contributions of this paper are as follows:
|
| 25 |
+
|
| 26 |
+
• We establish a tight population risk bound for the maximum margin classifier. Our bound works for both the isotropic and anisotropic settings, which is more general than existing results in [6, 25]. When reducing our bound to the setting studied in [6], our result gives a bound $\exp ( - \Omega ( n | | \pmb { \mu } | | _ { 2 } ^ { 4 } / d ) )$ , where $n$ is the training sample size. Our bound is tighter than the risk bound $\exp ( - \Omega ( \| \pmb { \mu } \| _ { 2 } ^ { 4 } / d ) )$ in [6] by a factor of $n$ in the exponent. Our result also gives a tighter risk bound than that in [25]1 in the so-called “low SNR setting”: our result suggests that $\| \pmb { \mu } \| _ { 2 } ^ { 4 } = \omega ( d / n )$ suffices to ensure an $o ( 1 )$ population risk, while [25] requires $\| \pmb { \mu } \| _ { 2 } ^ { 4 } = \omega ( ( d / n ) ^ { 3 / 2 } )$ .
|
| 27 |
+
|
| 28 |
+
• We establish population risk lower bounds achieved by the maximum margin classifier under two different settings. In both settings, the lower bounds match our population risk upper bound up to some absolute constants. This suggests that our population risk bound is tight.
|
| 29 |
+
|
| 30 |
+
• Our analysis reveals that for a class of high-dimensional anisotropic sub-Gaussian mixture models, the maximum margin linear classifier on the training data can achieve small population risk under mild assumptions on the sample size $n$ and mean vector $\pmb { \mu }$ . Specifically, suppose that the eigenvalues of $\pmb { \Sigma }$ are $\{ \lambda _ { k } = k ^ { - \alpha } \} _ { k = 1 } ^ { d }$ for some parameter $\alpha \in [ 0 , 1 )$ , and treat the sample size $n$ as a constant. Then our result shows that to achieve $o ( 1 )$ population risk, the following conditions on $\| \pmb { \mu } \| _ { 2 }$ suffice:
|
| 31 |
+
|
| 32 |
+
$$
|
| 33 |
+
\| \pmb { \mu } \| _ { 2 } = \left\{ \begin{array} { l l } { \omega ( d ^ { 1 / 4 - \alpha / 2 } ) , } & { \mathrm { ~ i f ~ } \alpha \in [ 0 , 1 / 2 ) , } \\ { \omega ( ( \log ( d ) ) ^ { 1 / 4 } ) , } & { \mathrm { ~ i f ~ } \alpha = 1 / 2 , } \\ { \omega ( 1 ) . } & { \mathrm { ~ i f ~ } \alpha \in ( 1 / 2 , 1 ) . } \end{array} \right.
|
| 34 |
+
$$
|
| 35 |
+
|
| 36 |
+
More specifically, when $\alpha = 1 / 2$ , the condition on the mean vector $\pmb { \mu }$ only has a logarithmic dependency on the dimension $d$ , and when $\alpha \in ( 1 / 2 , 1 )$ , the condition on $\pmb { \mu }$ for benign overfitting is dimension free.
|
| 37 |
+
|
| 38 |
+
• Our proof of the population risk bound introduces some tight intermediate results, which may be of independent interest. Specifically, our proof utilizes the polarization identity to establish equivalence between the maximum margin classifier and the minimum norm interpolator. This is, to the best of our knowledge, the first equivalence result between classification and regression for anisotropic sub-Gaussian mixture models.
|
| 39 |
+
|
| 40 |
+
Additional Related Work Our study is closely related to the phenomenon of double descent studied in recent works. [3, 4] showed experimental results and provided theoretical analyses on some specific models to demonstrate that the risk curve versus over-parameterization has a double descent shape. These results can therefore indicate that over-parameterization can be beneficial to achieve small test risk. [11, 26] studied the double descent phenomenon in linear regression under the setting where the dimension $d$ and sample size $n$ can grow simultaneously but have a fixed ratio, and showed that the population risk exhibits a double descent curve with respect to the ratio. More recently, [17, 15, 18] further extended the setting to random feature models and studied double descent when the sample size, data dimension and the number of random features have fixed ratios.
|
| 41 |
+
|
| 42 |
+
Our work is also related to the studies of implicit bias, which analyze the impact of training algorithms when the over-parameterized models have multiple global minima. Specifically, [22] showed that if the training data are linearly separable, then gradient descent on unregularized logistic regression converges directionally to the maximum margin linear classifier on the training data set. [13] further studied the implicit bias of gradient descent for logistic regression on non-separable data. [9] studied the implicit bias of various optimization methods for generic objective functions. [10, 1] established implicit bias results for matrix factorization problems. More recently, [16] showed that gradient flow for learning homogeneous neural networks with logistic loss maximizes the normalized margin on the training data set. These studies of implicit bias offer a handle for us to connect the over-parameterized logistic regression with the maximum margin classifiers for linear models.
|
| 43 |
+
|
| 44 |
+
# 2 Problem Setting and Notation
|
| 45 |
+
|
| 46 |
+
Notations. We use lower case letters to denote scalars, and use lower/upper case bold face letters to denote vectors/matrices respectively. For a vector $\mathbf { v }$ , we denote by $\| \mathbf { v } \| _ { 2 }$ the $\ell _ { 2 }$ -norm of v. For a matrix $\mathbf { A }$ , we use $\| \mathbf { A } \| _ { 2 } , \| \bar { \mathbf { A } } \| _ { F }$ to denote its spectral norm and Frobinuous norm respectively, and use $\operatorname { t r } ( \mathbf { A } )$ to denote its trace. For a vector $\mathbf { v } \in \mathbb { R } ^ { d }$ and a positive definite matrix A, we define $\| \mathbf { v } \| _ { \mathbf { A } } = \sqrt { \mathbf { v } ^ { \top } \mathbf { A } \mathbf { v } }$ . For an integer $n$ , we denote $[ n ] = \{ 1 , 2 , \dots , n \}$ .
|
| 47 |
+
|
| 48 |
+
We also use standard asymptotic notations $O ( \cdot ) , \Omega ( \cdot ) , o ( \cdot )$ , and $\omega ( \cdot )$ . Let $\left\{ a _ { n } \right\}$ and $\left\{ b _ { n } \right\}$ be two sequences. If there exists a constant $C > 0$ such that $| a _ { n } | \leq C | b _ { n } |$ for all large enough $n$ , then we denote $a _ { n } = O ( b _ { n } )$ . We denote $a _ { n } = \Omega ( b _ { n } )$ if $b _ { n } = O ( a _ { n } )$ . Moreover, we write $a _ { n } = o ( b _ { n } )$ if $\operatorname* { l i m } | a _ { n } / b _ { n } | = 0$ and $a _ { n } = \omega ( b _ { n } )$ if $\operatorname* { l i m } | a _ { n } / b _ { n } | = \infty$ . We also use ${ \widetilde { O } } ( \cdot )$ and $\widetilde { \Omega } ( \cdot )$ to hide some logarithmic terms in Big-O and Big-Omega notations.
|
| 49 |
+
|
| 50 |
+
At last, for a random variable $Z$ , we denote by $\| Z \| _ { \psi _ { 2 } }$ and $\| Z \| _ { \psi _ { 1 } }$ the sub-Gaussian and subexponential norms of $Z$ respectively.
|
| 51 |
+
|
| 52 |
+
Sub-Gaussian Mixture Model. We consider a model where the feature vectors are generated from a mixture of two sub-Gaussian distributions with means $\pmb { \mu }$ and $- \pmb { \mu }$ and the same covariance matrix $\pmb { \Sigma }$ . We assume that each data pair $\left( \mathbf { x } , y \right)$ are generated independently from the following procedure:
|
| 53 |
+
|
| 54 |
+
1. The label $y \in \{ + 1 , - 1 \}$ is generated as a Rademacher random variable.
|
| 55 |
+
|
| 56 |
+
2. A random vector $\mathbf { u } \in \mathbb { R } ^ { d }$ is generated from a distribution such that the entries of $\mathbf { u }$ are independent sub-Gaussian random variables with $\mathbb { E } [ u _ { j } ] = 0$ , $\mathbb { E } [ u _ { j } ^ { 2 } ] = 1$ and $\| u _ { j } \| _ { \psi _ { 2 } } \leq \sigma _ { u }$ for all $j \in [ d ]$ .
|
| 57 |
+
|
| 58 |
+
3. Let $\pmb { \Sigma }$ be a positive definite matrix with eigenvalue decomposition $\pmb { \Sigma } = \mathbf { V } \pmb { \Lambda } \mathbf { V } ^ { \top }$ , where $\Lambda =$ $\mathrm { d i a g } \{ \lambda _ { 1 } , \ldots , \lambda _ { d } \}$ and $\mathbf { V }$ is an orthonormal matrix consisting of the eigenvectors of $\pmb { \Sigma }$ . We calculate the random vector $\mathbf { q }$ based on u as $\mathbf { q } = \mathbf { V } \pmb { \Lambda } ^ { 1 / 2 } \mathbf { u }$ . This ensures that $\mathbf { q }$ has mean zero and a covariance matrix $\pmb { \Sigma }$ .
|
| 59 |
+
|
| 60 |
+
4. The feature is given as $\mathbf { x } = y \cdot \pmb { \mu } + \mathbf { q } .$ , where $\pmb { \mu } \in \mathbb { R } ^ { d }$ is a vector. Clearly, the mean of $\mathbf { x }$ is $\pmb { \mu }$ when $y = 1$ and is $- \pmb { \mu }$ when $y = - 1$ .
|
| 61 |
+
|
| 62 |
+
We consider $n$ training data points $\left( \mathbf { x } _ { i } , y _ { i } \right)$ generated independently from the above procedure, and denote
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\mathbf { X } = \mathbf { y } \pmb { \mu } ^ { \top } + \mathbf { Q } ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $\mathbf { X } = [ \mathbf { x } _ { 1 } , \hdots , \mathbf { x } _ { n } ] ^ { \top } , \mathbf { Q } = [ \mathbf { q } _ { 1 } , \hdots , \mathbf { q } _ { n } ] ^ { \top } \in \mathbb { R } ^ { n \times d }$ , and $\mathbf { y } = [ y _ { 1 } , \dots , y _ { n } ] ^ { \top } \in \{ \pm 1 \} ^ { n }$ . For any $\pmb \theta \in \mathbb { R } ^ { d }$ , the population risk of the linear classifier ${ \bf x } \langle \pmb { \theta } , \mathbf { x } \rangle$ is defined as:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
R ( \pmb \theta ) = \mathbb P \big ( \ b y \cdot \langle \pmb \theta , \mathbf x \rangle < 0 \big ) .
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
In this paper, we consider the maximum margin linear classifier $\widehat { \theta } _ { \mathrm { S V M } }$ , i.e., the solution to the hard-margin support vector machine:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\widehat { \pmb { \theta } } _ { \mathrm { S V M } } = \operatorname { a r g m i n } \| \pmb { \theta } \| _ { 2 } ^ { 2 } , ~ \mathrm { s u b j e c t } ~ \mathrm { t o } ~ y _ { i } \cdot \langle \pmb { \theta } , \mathbf { x } _ { i } \rangle \geq 1 , i \in [ n ] ,
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
and study its population risk $R ( \widehat { \pmb \theta } _ { \mathrm { S V M } } )$
|
| 81 |
+
|
| 82 |
+
A recent work [6] has studied a similar sub-Gaussian mixture model under an assumption that $\operatorname { t r } ( \Sigma ) = \Omega ( d )$ , and considered additional label flipping noises. In this paper, we do not introduce the label flipping noises for simplicity, but we consider a general covariance matrix $\pmb { \Sigma }$ to cover the general anisotropic setting. It is worth noting that although our model is not exactly the same as [6] because we don’t have additional label flipping noise, there is still noise in our model because of the nature of sub-Gaussian mixture model. For example, consider a mixture of two Gaussian distributions. The two Gaussian clusters have non-trivial overlap, and the Bayes optimal classifier has non-zero Bayes risk as long as $\| \mu \| _ { 2 } < \infty$ . Therefore, the Bayes optimal classifier and the interpolating classifier are generally quite different. In general, a model is appropriate for the study of benign overfitting whenever the optimal classifier has non-zero Bayes risk.
|
| 83 |
+
|
| 84 |
+
Our model is rather general and covers the following examples.
|
| 85 |
+
|
| 86 |
+
Example 2.1 (Gaussian mixture model). The most straight-forward example is when the data are generated from Gaussian mixtures $N ( \pmb { \mu } , \pmb { \Sigma } )$ and $N ( - { \boldsymbol { \mu } } , { \dot { \Sigma } } )$ . This is covered by our model when the sub-Gaussian vector $\mathbf { u }$ is a standard Gaussian random vector.
|
| 87 |
+
|
| 88 |
+
Example 2.2 (Rare/weak feature model). The rare-weak model is a special case of the Gaussian mixture model where $\pmb { \Sigma } = \mathbf { I }$ and $\pmb { \mu }$ is a sparse vector with $s$ non-zero entries equaling $\gamma$ .
|
| 89 |
+
|
| 90 |
+
The rare/weak feature model was originally investigated by [8, 14], and was recently studied by [6].
|
| 91 |
+
|
| 92 |
+
Connection to Over-parameterized Logistic Regression. Our study of the maximum margin classifier is closely related to over-parameterized logistic regression. In logistic regression, we consider the following empirical loss minimization problem:
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\operatorname* { m i n } _ { \pmb { \theta } \in \mathbb { R } ^ { d } } L ( \pmb { \theta } ) : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \log [ 1 + \exp ( - y _ { i } \cdot \langle \pmb { \theta } , \mathbf { x } _ { i } \rangle ) ] .
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
We solve the above optimization problem with gradient descent
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\pmb { \theta } ^ { ( t + 1 ) } = \pmb { \theta } ^ { ( t ) } - \eta \cdot \nabla L ( \pmb { \theta } ^ { ( t ) } ) ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $\eta > 0$ is the learning rate.
|
| 105 |
+
|
| 106 |
+
In the over-parameterized setting where $d \gg n$ , it is evident that the training data points are linearly separable with high probability (for example, $\mathbf { \mathbf { X X } ^ { \top } }$ is invertible with high probability and the minimum norm interpolator $\widehat { \pmb { \theta } } _ { \mathrm { L S } } = \mathbf { X } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { y }$ separates the training data.). For linearly separable data, a series of recent works have studied the implicit bias of (stochastic) gradient descent for logistic regression [22, 13, 21]. These results demonstrate that among all linear classifiers that can classify the training data correctly, gradient descent will converge to the one that maximizes the $\ell _ { 2 }$ margin. Such an implicit bias result is summarized in the following lemma.
|
| 107 |
+
|
| 108 |
+
Lemma 2.3 (Theorem 3 in [22]). Suppose that the training data set $\left\{ \left( \mathbf { x } _ { i } , y _ { i } \right) \right\}$ is linearly separable. Then as long as $\eta > 0$ is small enough, the gradient descent iterates ${ \pmb \theta } ^ { ( t ) }$ for logistic regression defined in (2.1) has the following direction limit:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\operatorname* { l i m } _ { t \infty } \frac { \pmb { \theta } ^ { ( t ) } } { \lVert \pmb { \theta } ^ { ( t ) } \rVert _ { 2 } } = \frac { \widehat { \pmb { \theta } } _ { \mathrm { S V M } } } { \lVert \widehat { \pmb { \theta } } _ { \mathrm { S V M } } \rVert _ { 2 } } ,
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
where $\widehat { \pmb { \theta } } _ { \mathrm { S V M } }$ is the maximum margin classifier.
|
| 115 |
+
|
| 116 |
+
Lemma 2.3 suggests that our risk bound of the maximum margin classifier $\widehat { \theta } _ { \mathrm { S V M } }$ directly implies a risk bound for the over-parameterized logistic regression trained by gradient descent.
|
| 117 |
+
|
| 118 |
+
# 3 Main Results
|
| 119 |
+
|
| 120 |
+
In this section, we present our main result on the population risk bound of the maximum margin classifier, and then give a lower bound result to demonstrate the tightness of our upper bounds. We also showcase the application of our results to isotropic and anisotropic sub-Gaussian mixture models to study the conditions under which benign overfitting occurs.
|
| 121 |
+
|
| 122 |
+
The main result of this paper is given in the following theorem, where we establish the population risk bound for the maximum margin classifier $R ( \widehat { \pmb \theta } _ { \mathrm { S V M } } )$ .
|
| 123 |
+
|
| 124 |
+
Theorem 3.1. Suppose that $\mathrm { t r } ( \pmb { \Sigma } ) \geq C \operatorname* { m a x } \left\{ n ^ { 3 / 2 } \| \pmb { \Sigma } \| _ { 2 } , n \| \pmb { \Sigma } \| _ { F } , n \sqrt { \log ( n ) } \cdot \| \pmb { \mu } \| _ { \pmb { \Sigma } } \right\}$ and $\| \mu \| _ { 2 } ^ { 2 } \geq$ $C \| \pmb { \mu } \| _ { \pmb { \Sigma } }$ for some absolute constant $C$ . Then with probability at least $1 - n ^ { - 1 }$ , the maximum margin classifier $\widehat { \theta } _ { \mathrm { S V M } }$ has the following risk bound
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
R ( \widehat \theta _ { \mathrm { S V M } } ) \leq \exp \bigg ( \frac { - C ^ { \prime } n \| \pmb \mu \| _ { 2 } ^ { 4 } } { n \| \pmb \mu \| _ { \Sigma } ^ { 2 } + \| \pmb \Sigma \| _ { F } ^ { 2 } + n \| \pmb \Sigma \| _ { 2 } ^ { 2 } } \bigg ) ,
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
where $C ^ { \prime }$ is an absolute constant.
|
| 131 |
+
|
| 132 |
+
Theorem 3.1 gives the population risk bound of the maximum margin classifier $\widehat { \pmb { \theta } } _ { \mathrm { S V M } }$ . Based on the implicit bias of gradient descent for over-parameterized logistic regression (Lemma 2.3), we have that the gradient descent iterates $\pmb \theta ^ { ( t ) }$ satisfy that
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\operatorname* { l i m } _ { t \to \infty } R ( \pmb { \theta } ^ { ( t ) } ) = \operatorname* { l i m } _ { t \to \infty } R ( \pmb { \theta } ^ { ( t ) } / \| \pmb { \theta } ^ { ( t ) } \| _ { 2 } ) = R ( \widehat { \pmb { \theta } } _ { \mathrm { S V M } } / \| \widehat { \pmb { \theta } } _ { \mathrm { S V M } } \| _ { 2 } ) = R ( \widehat { \pmb { \theta } } _ { \mathrm { S V M } } ) .
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
Therefore, the same risk bound in Theorem 3.1 also applies to the over-parameterized logistic regression trained by gradient descent.
|
| 139 |
+
|
| 140 |
+
Population Risk Lower Bound We further present lower bounds on the population risk achieved by the maximum margin classifier, which demonstrate that our population risk upper bound in Theorem 3.1 is tight. We have the following theorem.
|
| 141 |
+
|
| 142 |
+
Theorem 3.2. Consider Gaussian mixture model with covariance matrix $\pmb { \Sigma }$ and mean vectors $\pmb { \mu }$ and $- \pmb { \mu }$ . Suppose that $\mathrm { t r } ( \pmb { \Sigma } ) \geq C \operatorname* { m a x } \left\{ n ^ { 3 / 2 } \| \pmb { \Sigma } \| _ { 2 } , n \| \pmb { \Sigma } \| _ { F } , n \sqrt { \log ( n ) } \cdot \| \pmb { \mu } \| _ { \pmb { \Sigma } } \right\}$ , and $\| \pmb { \mu } \| _ { 2 } ^ { 2 } \geq C \| \pmb { \mu } \| _ { \Sigma }$ for some constant $C$ . Then there exist absolute constants $C ^ { \prime } , C ^ { \prime \prime }$ , such that the following results hold:
|
| 143 |
+
|
| 144 |
+
1. If $n \| \pmb { \mu } \| _ { \pmb { \Sigma } } ^ { 2 } \geq C ( \| \pmb { \Sigma } \| _ { F } ^ { 2 } + n \| \pmb { \Sigma } \| _ { 2 } ^ { 2 } )$ , then with probability at least $1 - n ^ { - 1 }$ ,
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
R ( \widehat { \pmb { \theta } } _ { \mathrm { S V M } } ) \geq C ^ { \prime \prime } \exp \big ( - C ^ { \prime } \| \pmb { \mu } \| _ { 2 } ^ { 4 } / \| \pmb { \mu } \| _ { \Sigma } ^ { 2 } \big ) .
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
2. If $\| \pmb { \Sigma } \| _ { F } ^ { 2 } \geq C n ( \| \pmb { \mu } \| _ { \pmb { \Sigma } } ^ { 2 } + \| \pmb { \Sigma } \| _ { 2 } ^ { 2 } )$ , then with probability at least $1 - n ^ { - 1 }$ ,
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
R ( \widehat { \pmb { \theta } } _ { \mathrm { S V M } } ) \geq C ^ { \prime \prime } \exp \big ( - C ^ { \prime } n \| \pmb { \mu } \| _ { 2 } ^ { 4 } / \| \pmb { \Sigma } \| _ { F } ^ { 2 } \big ) .
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+
Theorem 3.2 gives lower bounds for the population risk in two settings: (i) $n \| \pmb { \mu } \| _ { \pmb { \Sigma } } ^ { 2 } \ge C ( \| \pmb { \Sigma } \| _ { F } ^ { 2 } +$ $n \| \pmb { \Sigma } \| _ { 2 } ^ { 2 } )$ ; and (ii) $\| \pmb { \Sigma } \| _ { F } ^ { 2 } \geq C n ( \| \pmb { \mu } \| _ { \pmb { \Sigma } } ^ { 2 } + \| \bar { \pmb { \Sigma } } \| _ { 2 } ^ { 2 } )$ . Note that in the population risk upper bound in Theorem 3.1, there are three terms in the denominator of the exponent: $\| \mu \| _ { \Sigma } ^ { 2 } , \| \Sigma \| _ { F } ^ { 2 }$ , and $n \| \pmb { \Sigma } \| _ { 2 } ^ { 2 }$ . Therefore, setting (i) and setting (ii) in Theorem 3.2 correspond to the cases when the first or the second term is the leading term, respectively. Moreover, it is also easy to check that under both settings, our lower bound in Theorem 3.2 matches the upper bound in Theorem 3.1. This suggests that our population risk bound in Theorem 3.1 is tight.
|
| 157 |
+
|
| 158 |
+
Implications for Specific Examples. Theorem 3.1 holds for general covariance matrices $\pmb { \Sigma }$ , and illustrates how the spectrum of $\pmb { \Sigma }$ affects the population risk of the maximum margin classifier. This makes our result more general than the recent results in [6, 25], where the population risk bounds are given only in terms of the sample size $n$ , dimension $d$ and the norm of the mean vector $\| \pmb { \mu } \| _ { 2 }$ . In fact, when we specialize our general result to the isotropic setting, our result also provides a tighter risk bound than these existing results. Specifically, our population risk bound for the isotropic setting is given in the following corollary.
|
| 159 |
+
|
| 160 |
+
Corollary 3.3 (Isotropic sub-Gaussian mixtures). Consider the setting where $\pmb { \Sigma } = \mathbf { I }$ . Suppose that $d \geq C \operatorname* { m a x } \left\{ n ^ { 2 } , n { \sqrt { \log ( n ) } } \cdot \| \mu \| _ { 2 } \right\}$ and $\| \pmb { \mu } \| _ { 2 } \geq C$ for some absolute constant $C$ . Then with probability at least $1 - n ^ { - 1 }$ , the maximum margin classifier $\widehat { \theta } _ { \mathrm { S V M } }$ has the following risk bound
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
R ( \widehat { \pmb { \theta } } _ { \mathrm { S V M } } ) \leq \exp \bigg ( - \frac { C ^ { \prime } n \| \pmb { \mu } \| _ { 2 } ^ { 4 } } { n \| \pmb { \mu } \| _ { 2 } ^ { 2 } + d } \bigg ) ,
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
where $C ^ { \prime }$ is an absolute constant.
|
| 167 |
+
|
| 168 |
+
Remark 3.4. [6] recently gave a risk bound of order $\exp ( - \Omega ( \| \pmb { \mu } \| _ { 2 } ^ { 4 } / d ) )$ for sub-Gaussian mixture models under the condition that $d = \Omega ( \operatorname* { m a x } \{ n ^ { 2 } \log ( n ) , \bar { n } \| \pmb { \mu } \| _ { 2 } ^ { 2 } \} )$ . In comparison, our result in Corollary 3.3 only requires the condition $d = \Omega ( \operatorname* { m a x } \{ n ^ { 2 } , n { \sqrt { \log ( n ) } } \cdot \| \pmb { \mu } \| _ { 2 } \} )$ , which is milder. Moreover, when the stronger condition $d = \Omega ( n | | \pmb { \mu } | | _ { 2 } ^ { 2 } )$ holds, our risk bound becomes $\exp ( - \Omega ( n | | \pmb { \mu } | | _ { 2 } ^ { 4 } / d ) )$ , which is better than the result of [6] by a factor of $n$ in the exponent.
|
| 169 |
+
|
| 170 |
+
Besides being tighter than previous results when reduced to the isotropic setting, Theorem 3.1 covers both the isotropic and anisotropic settings. In the following, we provide some case studies under the anisotropic setting and show how the decay rate of the eigenvalues of the covariance matrix $\pmb { \Sigma }$ affects the population risk.
|
| 171 |
+
|
| 172 |
+
It is worth noting that the assumption of Theorem 3.1 requires that $\operatorname { t r } ( \Sigma )$ is large enough, while the risk bound in Theorem 3.1 only depends on $\| \pmb { \Sigma } \| _ { F }$ and $\| \pmb { \Sigma } \| _ { 2 }$ . In the over-parameterized setting where the dimension $d$ is large, it is possible that for certain covariance matrices $\pmb { \Sigma }$ with appropriate eigenvalue decay rates, $\operatorname { t r } ( \Sigma ) \ \gg \ 1$ while $\| { \boldsymbol { \Sigma } } \| _ { F } , \| { \boldsymbol { \Sigma } } \| _ { 2 } = O ( 1 )$ . This implies that for many anisotropic sub-Gaussian mixture models, the assumptions in Theorem 3.1 can be easily satisfied, while the risk bound can be small at the same time. Following this intuition, we study the conditions under which the the maximum margin interpolator $\widehat { \theta } _ { \mathrm { S V M } }$ achieves $o ( 1 )$ population risk. We denote by $\lambda _ { k }$ the $k$ -th largest eigenvalue of $\pmb { \Sigma }$ , and consider a polynomial decay spectrum $\{ \lambda _ { k } = k ^ { - \alpha } \} _ { k = 1 } ^ { d }$ , where we introduce a parameter $\alpha$ to control the eigenvalue decay rate. We have the following corollary.
|
| 173 |
+
|
| 174 |
+
Corollary 3.5 (Anisotripic sub-Gaussian mixtures with polynomial spectrum decay). Suppose that $\lambda _ { k } = k ^ { - \alpha }$ , $n$ is a large enough constant, and one of the following conditions hold:
|
| 175 |
+
|
| 176 |
+
1. $\alpha \in [ 0 , 1 / 2 )$ , $d = \widetilde { \Omega } ( ( \| \pmb { \mu } \| _ { \Sigma } ) ^ { \frac { 1 } { 1 - \alpha } } )$ , and $\| \pmb { \mu } \| _ { 2 } = \omega ( 1 + d ^ { 1 / 4 - \alpha / 2 } )$ .
|
| 177 |
+
|
| 178 |
+
2. $\alpha = 1 / 2$ , $d = \widetilde { \Omega } ( \| \pmb { \mu } \| _ { \pmb { \Sigma } } ^ { 2 } )$ , and $\| \pmb { \mu } \| _ { 2 } = \omega ( ( \log ( d ) ) ^ { 1 / 4 } )$ .
|
| 179 |
+
|
| 180 |
+
3. $\alpha \in ( 1 / 2 , 1 )$ , $d = \widetilde { \Omega } ( ( \| \pmb { \mu } \| _ { \Sigma } ) ^ { \frac { 1 } { 1 - \alpha } } )$ , and $\| \pmb { \mu } \| _ { 2 } = \omega ( 1 )$ .
|
| 181 |
+
|
| 182 |
+
Then with probability at least $1 - n ^ { - 1 }$ , the population risk of the maximum margin classifier satisfies $R ( \widehat \theta _ { \mathrm { S V M } } ) = o ( 1 )$ .
|
| 183 |
+
|
| 184 |
+
Corollary 3.5 follows by alculating the orders of $\begin{array} { r } { \mathrm { t r } ( \Sigma ) = \sum _ { k = 1 } ^ { d } \lambda _ { k } } \end{array}$ and $\begin{array} { r } { \| \pmb { \Sigma } \| _ { F } ^ { 2 } = \sum _ { k = 1 } ^ { d } \lambda _ { k } ^ { 2 } } \end{array}$ . Here $n$
|
| 185 |
+
dependency on $n$ is given as Corollary C.1 in Appendix C together with the proof. Intuitively, when $\lVert \bar { \boldsymbol { \mu } _ { \mathrm { - } } } \rVert _ { 2 }$ is large, the two classes are far away from each other and therefore linear classifiers can achieve small population risk. From Corollary 3.5, we can see that the decay rate of the eigenvalues of the covariance matrix $\pmb { \Sigma }$ determines how large $\| \pmb { \mu } \| _ { 2 }$ needs to be to ensure small population risk: when the $\left\{ \lambda _ { k } \right\}$ decays faster (i.e., when $\alpha$ is larger), the maximum margin classifier can achieve $o ( 1 )$ population risk with a smaller $\| \pmb { \mu } \| _ { 2 }$ .
|
| 186 |
+
|
| 187 |
+
Corollary 3.5 also exhibits a certain “phase transition” regarding the eigenvalue decay rate and the conditions on $\| \pmb { \mu } \| _ { 2 }$ . We can see that the eigenvalue decay rate can be divided into three regimes $\alpha \in [ 0 , 1 / 2 )$ , $\alpha = 1 / 2$ and $\alpha \in ( 1 / 2 , 1 )$ . Under the condition that $d = \widetilde { \Omega } ( ( \left| \left| \pmb { \mu } \right| \right| _ { \Sigma } ) ^ { \frac { 1 } { 1 - \alpha } } )$ , achieving $o ( 1 )$ risk in each of these regimes requires $\| \pmb { \mu } \| _ { 2 } = \omega ( d ^ { 1 / 4 } )$ , $\| \pmb { \mu } \| _ { 2 } = \omega ( [ \log ( d ) ] ^ { 1 / 4 } )$ , and $\| \pmb { \mu } \| _ { 2 } = \omega ( 1 )$ respectively. Specifically, when $\alpha \in ( 1 / 2 , 1 )$ , the condition on $\pmb { \mu }$ is independent of the dimension $d$ . This means that when $\alpha \in ( 1 / 2 , 1 )$ , for any $\epsilon > 0$ , as long as $\| \pmb { \mu } \| _ { 2 } = \Omega ( \sqrt { \log ( \epsilon ) } )$ , we have
|
| 188 |
+
|
| 189 |
+
$$
|
| 190 |
+
\operatorname* { l i m } _ { d \to \infty } R ( \widehat { \pmb \theta } _ { \mathrm { S V M } } ) \leq \epsilon .
|
| 191 |
+
$$
|
| 192 |
+
|
| 193 |
+
Therefore, our result covers the infinite dimensional setting when the eigenvalues of the covariance matrix $\pmb { \Sigma }$ have an appropriate decay rate, i.e., $\alpha \in ( 1 / 2 , 1 )$ .
|
| 194 |
+
|
| 195 |
+
Another interesting observation in Theorem 3.1 is that it uses both $\| \pmb { \mu } \| _ { \pmb { \Sigma } }$ and $\| \pmb { \mu } \| _ { 2 }$ , and therefore the alignment between $\pmb { \mu }$ and the eigenvectors of $\pmb { \Sigma }$ can affect the population risk bound. In our discussion above, we have mainly focused on the worst case scenario where the direction of $\pmb { \mu }$ aligns with the first eigenvector of $\pmb { \Sigma }$ . In the following corollary, we discuss the case where $\pmb { \mu }$ is parallel to the eigenvector of $\pmb { \Sigma }$ corresponding to the eigenvalue $\lambda _ { k }$ .
|
| 196 |
+
|
| 197 |
+
Corollary 3.6 (Risk bounds for $\pmb { \mu }$ along different directions). Suppose that $\Sigma \mu = \lambda _ { k } \mu$ for some $k \in [ d ] , \operatorname { t r } ( \Sigma ) \geq C \operatorname* { m a x } \big \{ n ^ { 3 / 2 } \| \Sigma \| _ { 2 } , n \| \Sigma \| _ { F } , n \sqrt { \lambda _ { k } \log ( n ) } \cdot \| \mu \| _ { 2 } \big \}$ and $\| \pmb { \mu } \| _ { 2 } ^ { 2 } \geq C \lambda _ { k }$ for some absolute constant $C$ . Then with probability at least $1 - n ^ { - 1 }$ , the maximum margin classifier $\widehat { \theta } _ { \mathrm { S V M } }$ has the following risk bound
|
| 198 |
+
|
| 199 |
+
$$
|
| 200 |
+
R ( \widehat \theta _ { \mathrm { S V M } } ) \mathop { \leq } \exp \Bigg ( \frac { - C ^ { \prime } n \| \mu \| _ { 2 } ^ { 4 } } { n \lambda _ { k } \cdot \| \mu \| _ { 2 } ^ { 2 } + \| \Sigma \| _ { F } ^ { 2 } + n \| \Sigma \| _ { 2 } ^ { 2 } } \Bigg ) ,
|
| 201 |
+
$$
|
| 202 |
+
|
| 203 |
+
where $C ^ { \prime }$ is an absolute constant.
|
| 204 |
+
|
| 205 |
+
We can see that, when $\pmb { \mu }$ aligns with the eigendirections corresponding to a smaller eigenvalue of $\pmb { \Sigma }$ , then Corollary 3.6 holds under milder conditions on $\operatorname { t r } ( \Sigma )$ and $\| \pmb { \mu } \| _ { 2 }$ , and the population risk achieved by the maximum margin solution is also better. This phenomenon perfectly matches the geometric intuition of sub-Gaussian mixture classifications, as is illustrated in Figure 1.
|
| 206 |
+
|
| 207 |
+

|
| 208 |
+
Figure 1: A 2-dimensional illustration of sub-Gausisan mixture classification problems with different directions of $\pmb { \mu }$ . We consider the setting where $ { \Sigma } \in { \mathbb { R } } ^ { 2 \times 2 }$ has two eigenvalues $\lambda _ { 1 } > \lambda _ { 2 }$ with the corresponding eigenvectors $\mathbf { v } _ { 1 } , \mathbf { v } _ { 2 }$ . (a) shows the setting where $\pmb { \mu }$ aligns with $\mathbf { v } _ { 2 }$ . (b) shows the setting where $\pmb { \mu }$ points at a random direction. (c) is for the case when $\pmb { \mu }$ aligns with $\mathbf { v } _ { 1 }$ . These figures clearly show that (a) is the easiest case for classification and (c) is the hardest case. This matches the result in Corollary 3.6.
|
| 209 |
+
|
| 210 |
+
At last, we can also apply our risk bound to the rare/weak feature model defined in Example 2.2. We have the following corollary.
|
| 211 |
+
|
| 212 |
+
Corollary 3.7 (Rare/weak feature model). Consider the rare/weak feature model (Example 2.2). Suppose that $d \geq C \operatorname* { m a x } \{ n ^ { 2 } , \gamma n { \sqrt { s \log ( n ) } } \}$ and $\gamma { \sqrt { s } } \geq C$ for some large enough absolute constant $C$ . Then when $n$ is large enough, with probability at least $1 - n ^ { - 1 }$ , the maximum margin classifier $\widehat { \theta } _ { \mathrm { S V M } }$ has the following risk bound
|
| 213 |
+
|
| 214 |
+
$$
|
| 215 |
+
R ( \widehat { \pmb { \theta } } _ { \mathrm { S V M } } ) \leq \exp \bigg ( - \frac { C ^ { \prime } n \gamma ^ { 4 } s ^ { 2 } } { n \gamma ^ { 2 } s + d } \bigg ) ,
|
| 216 |
+
$$
|
| 217 |
+
|
| 218 |
+
where $C ^ { \prime }$ is an absolute constant.
|
| 219 |
+
|
| 220 |
+
By Corollary 3.7, we can see that our bound is tighter by a factor of $n$ in the exponent compared with the risk bound in [6] for the rare/weak feature model. Under the setting where $n$ and $\gamma$ are fixed constants, our bound can also be compared with the negative result in [14], which showed that achieving a small population risk is impossible when $s = \operatorname { \bar { \rho } } ( d ^ { 2 } )$ . Our result, on the other hand, demonstrates that when $s = \omega ( d ^ { 2 } )$ , $o ( 1 ) { \big | }$ population risk is achievable.
|
| 221 |
+
|
| 222 |
+
# 4 Proof of the Main Results
|
| 223 |
+
|
| 224 |
+
In this section, we explain how we establish the population risk bound of the maximum margin classifier, and give the proof of Theorem 3.1.
|
| 225 |
+
|
| 226 |
+
For classification problems, one of the key challenges is that the maximum margin classifier usually does not have an explicit form solution. To overcome this difficulty, [6] utilized the implicit bias results (Lemma 2.3) to get a handle on the relationship between the maximum margin classifier and the training data. More recently, [25] showed that for isotropic Gaussian mixture models, an explicit form of $\widehat { \theta } _ { \mathrm { { S V M } } }$ can be calculated by the equivalence between hard-margin support vector machine and minimum norm least square regression. Notably, it was shown that such an equivalence result holds under the assumptions of [6] and no any additional assumptions are needed. In this paper, we also study the equivalence between classification and regression as a first step. However, our proof works for a more general setting that covers both isotropic and anisotropic sub-Gaussian mixtures, and introduces a novel proof technique based on the polarization identity that leads to a tighter bound. We present this result in Section 4.
|
| 227 |
+
|
| 228 |
+
Step 1. Equivalence Between Classification and Regression. Here we establish an equivalence guarantee for the maximum margin classifier and the minimum norm interpolator. Note that the definitions of the minimum norm interpolator $\widehat { \theta } _ { \mathrm { L S } }$ and the maximum margin classifier $\widehat { \pmb { \theta } } _ { \mathrm { S V M } }$ are as follows:
|
| 229 |
+
|
| 230 |
+
$$
|
| 231 |
+
\begin{array} { r l } & { \widehat { \theta } _ { \mathrm { L S } } : = \operatorname * { a r g m i n } \| \pmb \theta \| _ { 2 } ^ { 2 } , \operatorname { s u b j e c t } \mathrm { t o } y _ { i } \cdot \langle \pmb \theta , \mathbf x _ { i } \rangle = 1 , i \in [ n ] , } \\ & { \widehat { \theta } _ { \mathrm { S V M } } = \operatorname * { a r g m i n } \| \pmb \theta \| _ { 2 } ^ { 2 } , \operatorname { s u b j e c t } \mathrm { t o } y _ { i } \cdot \langle \pmb \theta , \mathbf x _ { i } \rangle \geq 1 , i \in [ n ] . } \end{array}
|
| 232 |
+
$$
|
| 233 |
+
|
| 234 |
+
We can see that the two optimization problems have the same solution when all the training data are support vectors, i.e., all the inequalities become equalities in the constraints [19, 12]. Here we derive such an equivalence result for sub-Gaussian mixture models. The result is as follows.
|
| 235 |
+
|
| 236 |
+
Proposition 4.1. Suppose that $\mathrm { t r } ( \pmb { \Sigma } ) \geq C \operatorname* { m a x } \{ n ^ { 3 / 2 } \| \pmb { \Sigma } \| _ { 2 } , n \| \pmb { \Sigma } \| _ { F } , n \sqrt { \log ( n ) } \cdot \| \pmb { \mu } \| _ { \pmb { \Sigma } } \}$ for some absolute constant $C$ . Then with probability at least $1 - O ( n ^ { - 2 } )$ , $\widehat { \pmb { \theta } } _ { \mathrm { S V M } } = \widehat { \pmb { \theta } } _ { \mathrm { L S } }$ .
|
| 237 |
+
|
| 238 |
+
The proof of Proposition 4.1 utilizes an argument based on the polarization identity to give a tight bound, which may be of independent interest. The details are given in Appendix 4.1.
|
| 239 |
+
|
| 240 |
+
Step 2. Population Risk of the Maximum Margin Classifier. We derive the population risk bound for the maximum margin classifier and provide the proof of Theorem 3.1. We first present the following lemma on the risk bound of linear classifiers for sub-Gaussian mixture models.
|
| 241 |
+
|
| 242 |
+
Lemma 4.2. There exists an absolute constant $C$ such that, for any $\pmb \theta \in \mathbb { R } ^ { d }$ , the following risk bound holds:
|
| 243 |
+
|
| 244 |
+
$$
|
| 245 |
+
R ( \pmb \theta ) \leq \exp \bigg ( - \frac { C ( \pmb \theta ^ { \top } \pmb \mu ) ^ { 2 } } { \| \pmb \theta \| _ { \Sigma } ^ { 2 } } \bigg ) .
|
| 246 |
+
$$
|
| 247 |
+
|
| 248 |
+
A similar result is given in [6] where $\pmb { \Sigma }$ is replaced by $\mathbf { I }$ . Our result here depends on the full spectrum of the covariance matrix and is sharper than [6] when $\pmb { \Sigma }$ has decaying eigenvalues.
|
| 249 |
+
|
| 250 |
+
The proof of Lemma 4.2 is given in Appendix A.2. In addition to this risk bound for general vector $\pmb \theta$ , we also have the following explicit calculation for $\widehat { \theta } _ { \mathrm { S V M } }$ thanks to our analysis in Section 4. This is because the minimum norm interpolator $\widehat { \pmb { \theta } } _ { \mathrm { L S } }$ has the explicit form $\widehat { \pmb { \theta } } _ { \mathrm { L S } } = \mathbf { X } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { y }$ . Therefore by Proposition 4.1, we also have $\widehat { \pmb { \theta } } _ { \mathrm { S V M } } = \mathbf { X } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { y }$ . Plugging this calculation into the risk bound in Lemma 4.2 and utilizing the model definition $\mathbf X = \mathbf y \pmb \mu ^ { \top } + \mathbf Q$ , we are able to show the following risk bound for $\widehat { \theta } _ { \mathrm { { S V M } } }$ .
|
| 251 |
+
|
| 252 |
+
Lemma 4.3. Suppose that $\mathrm { t r } ( \pmb { \Sigma } ) \geq C \operatorname* { m a x } \{ n \sqrt { \log ( n ) } , n ^ { 3 / 2 } \| \pmb { \Sigma } \| _ { 2 } , n \| \pmb { \Sigma } \| _ { F } , n \| \pmb { \mu } \| _ { \pmb { \Sigma } } \}$ for some absolute constant $C$ . Then with probability at least $1 - O ( n ^ { - 2 } )$ ,
|
| 253 |
+
|
| 254 |
+
$$
|
| 255 |
+
R ( \widehat \theta _ { \mathrm { S V M } } ) \leq \exp \bigg \{ \frac { - C ^ { \prime } \cdot \big [ \mathbf { y } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { X } \pmb \mu ] ^ { 2 } } { ( \mathbf { y } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { y } ) ^ { 2 } \| \pmb \mu \| _ { \Sigma } ^ { 2 } + \| \mathbf { Q } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { y } \| _ { \Sigma } ^ { 2 } } \bigg \} ,
|
| 256 |
+
$$
|
| 257 |
+
|
| 258 |
+
where $C ^ { \prime }$ is an absolute constant.
|
| 259 |
+
|
| 260 |
+
Lemma 4.3 utilizes the structure of the model to divide the denominator in the exponent into two terms. Motivated by this result, we define
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
I _ { 1 } = [ { \bf y ^ { \top } } ( { \bf X } { \bf X ^ { \top } } ) ^ { - 1 } { \bf X } \mu ] ^ { 2 } , I _ { 2 } = ( { \bf y ^ { \top } } ( { \bf X } { \bf X ^ { \top } } ) ^ { - 1 } { \bf y } ) ^ { 2 } \cdot \| \mu \| _ { \Sigma } ^ { 2 } , I _ { 3 } = \| { \bf Q ^ { \top } } ( { \bf X } { \bf X ^ { \top } } ) ^ { - 1 } { \bf y } \| _ { \Sigma } ^ { 2 } .
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
This leads to our analysis in the next step.
|
| 267 |
+
|
| 268 |
+
Step 3. Bounds for $I _ { 1 } , I _ { 2 }$ and $I _ { 3 }$ . In the following, we develop a lower bound for $I _ { 1 }$ and upper bounds for $I _ { 2 }$ and $I _ { 3 }$ respectively. The following lemma summarizes the bounds.
|
| 269 |
+
|
| 270 |
+
Lemma 4.4. Suppose that $\mathrm { t r } ( \Sigma ) \geq C \operatorname* { m a x } \{ n , n \| \Sigma \| _ { 2 } , \sqrt { n } \| \Sigma \| _ { F } , n \| \mu \| _ { \Sigma } \}$ and $\| \pmb { \mu } \| _ { 2 } ^ { 2 } \geq C \| \pmb { \mu } \| _ { \Sigma }$ for some absolute constant $C$ . Then when $n$ is large enough, with probability at least $1 - O ( n ^ { - 2 } ) ,$ ,
|
| 271 |
+
|
| 272 |
+
$$
|
| 273 |
+
\begin{array} { r l } & { I _ { 1 } \geq C ^ { \prime - 1 } H ( \mu , \mathbf { Q } , \mathbf { y } , \pmb { \Sigma } ) \cdot n ^ { 2 } \cdot \| \pmb { \mu } \| _ { 2 } ^ { 4 } , } \\ & { I _ { 2 } \leq C ^ { \prime } H ( \mu , \mathbf { Q } , \mathbf { y } , \pmb { \Sigma } ) \cdot n ^ { 2 } \cdot \| \pmb { \mu } \| _ { \pmb { \Sigma } } ^ { 2 } , } \\ & { I _ { 3 } \leq C ^ { \prime } H ( \mu , \mathbf { Q } , \mathbf { y } , \pmb { \Sigma } ) \cdot ( n \cdot \| \pmb { \Sigma } \| _ { F } ^ { 2 } + n ^ { 2 } \cdot \| \pmb { \Sigma } \| _ { 2 } ^ { 2 } ) , } \end{array}
|
| 274 |
+
$$
|
| 275 |
+
|
| 276 |
+
where $H ( \pmb { \mu } , \mathbf { Q } , \mathbf { y } , \pmb { \Sigma } ) > 0$ is a strictly positive coefficient, and $C ^ { \prime } > 0$ is an absolute constant.
|
| 277 |
+
|
| 278 |
+
The proof of Lemma 4.4 is given in Appendix A.2. To illustrate the key idea in the proof of Lemma 4.4, we take $I _ { 3 }$ as an example. Based on our model in Section 2, we have $\mathbf { Q } = \mathbf { Z } \bar { \mathbf {Lambda } } ^ { 1 / 2 } \mathbf { V } ^ { \top }$ , where $\mathbf { Z } \in \mathbb { R } ^ { n \times d }$ is a random matrix with independent sub-Gaussian entries, and $\pmb { \Lambda }$ , $\mathbf { V }$ are defined based on the eigenvalue decomposition $\pmb { \Sigma } = \dot { \mathbf { V } } \pmb { \Lambda } \mathbf { V } ^ { \top }$ . By some linear algebra calculation (see the proof of Lemma 4.4 in Appendix A.2 for more details), we have
|
| 279 |
+
|
| 280 |
+
$$
|
| 281 |
+
I _ { 3 } = { \bf { a } } ^ { \top } ( { \bf { Z } } { \bf { A } } { \bf { Z } } ^ { \top } ) ^ { - 1 } { \bf { Z } } { \bf { \Lambda } } ^ { 2 } { \bf { Z } } ^ { \top } ( { \bf { Z } } { \bf { \Lambda } } { \bf { Z } } ^ { \top } ) ^ { - 1 } { \bf { a } } ,
|
| 282 |
+
$$
|
| 283 |
+
|
| 284 |
+
where $\| \mathbf { a } \| _ { 2 } ^ { 2 } = O ( D ^ { - 2 } n )$ with
|
| 285 |
+
|
| 286 |
+
$$
|
| 287 |
+
D = \mathbf { y } ^ { \top } ( \mathbf { Q Q } ^ { \top } ) ^ { - 1 } \mathbf { y } \cdot ( \lVert \boldsymbol { \mu } \rVert _ { 2 } ^ { 2 } - \boldsymbol { \mu } ^ { \top } \mathbf { Q } ^ { \top } ( \mathbf { Q Q } ^ { \top } ) ^ { - 1 } \mathbf { Q } \boldsymbol { \mu } ) + ( 1 + \mathbf { y } ^ { \top } ( \mathbf { Q Q } ^ { \top } ) ^ { - 1 } \mathbf { Q } \boldsymbol { \mu } ) ^ { 2 } .
|
| 288 |
+
$$
|
| 289 |
+
|
| 290 |
+
The key observation here is that while the term $D$ above has a very complicated form, it is not necessary to bound it. This is because $D ^ { - 2 }$ is a common term that appears in all $I _ { 1 } , I _ { 2 }$ and $I _ { 3 }$ and therefore can be canceled out when calculating the ratio $I _ { 1 } / ( I _ { 2 } + I _ { 3 } )$ . With the calculation in (4.1), we are able to invoke the following eigenvalue concentration inequalities (see Lemma A.4 and Lemma A.7 for more details) to give upper and lower bounds regarding the matrices $\mathbf { Z } \mathbf { { \boldsymbol { \Lambda } } ^ { 2 } \mathbf { Z } ^ { \top } }$ and $\mathbf { Z } \mathbf { \Lambda } \mathbf { Z } ^ { \top }$ respectively:
|
| 291 |
+
|
| 292 |
+
$$
|
| 293 |
+
\begin{array} { r l } & { \left\| \mathbf { Z } \mathbf { \Lambda } \mathbf { Z } ^ { \top } - \operatorname { t r } ( \Sigma ) \cdot \mathbf { I } \right\| _ { 2 } \leq c _ { 1 } \cdot \big ( n \| \Sigma \| _ { 2 } + \sqrt { n } \| \Sigma \| _ { F } \big ) , } \\ & { \left\| \mathbf { Z } \mathbf { \Lambda } ^ { 2 } \mathbf { Z } ^ { \top } - \| \Sigma \| _ { F } ^ { 2 } \cdot \mathbf { I } \right\| _ { 2 } \leq c _ { 1 } \cdot \big ( n \| \Sigma \| _ { 2 } ^ { 2 } + \sqrt { n } \| \Sigma ^ { 2 } \| _ { F } \big ) , } \end{array}
|
| 294 |
+
$$
|
| 295 |
+
|
| 296 |
+
where $c _ { 1 }$ is an absolute constant. Plugging the above inequalities and the bound $\| \mathbf { a } \| _ { 2 } ^ { 2 } = O ( D ^ { - 2 } n )$ into (4.1), we obtain with some calculation that
|
| 297 |
+
|
| 298 |
+
$$
|
| 299 |
+
I _ { 3 } \leq c _ { 2 } H ( \pmb { \mu } , \mathbf { Q } , \mathbf { y } , \pmb { \Sigma } ) \cdot ( \pmb { n } \cdot \| \pmb { \Sigma } \| _ { F } ^ { 2 } + { n } ^ { 2 } \cdot \| \pmb { \Sigma } \| _ { 2 } ^ { 2 } )
|
| 300 |
+
$$
|
| 301 |
+
|
| 302 |
+
with $H ( \pmb { \mu } , \mathbf { Q } , \mathbf { y } , \pmb { \Sigma } ) = [ \pmb { \cal D } \cdot \mathrm { t r } ( \pmb { \Sigma } ) ] ^ { - 2 }$ , where $c _ { 2 }$ is an absolute constant. This gives the bound of $I _ { 3 }$
|
| 303 |
+
|
| 304 |
+
Lemma 4.4 is significant in three-fold. First of all, the result does not have an explicit dependency on $d$ , which makes it applicable to infinite dimensional data. Second, Lemma 4.4 gives bounds with great simplicity, and shows that the three bounds share a same strictly positive factor $H ( \mu , { \bf Q } , { \bf y } , { \pmb { \Sigma } } )$ , which can be canceled out since our final goal is to bound the ratio $I _ { 1 } / ( I _ { 2 } + I _ { 3 } )$ . Lastly, Lemma 4.4 reveals the fact that the risk bound only depends on $\| \pmb { \Sigma } \| _ { F }$ and $\| \pmb { \Sigma } \| _ { 2 }$ , which can be small even though the assumption requires $\operatorname { t r } ( \Sigma )$ to be large.
|
| 305 |
+
|
| 306 |
+
We are now ready to present the proof of Theorem 3.1.
|
| 307 |
+
|
| 308 |
+
Proof of Theorem 3.1. Clearly, under the assumptions of Theorem 3.1, the conditions in Lemma 4.3 and Lemma 4.4 are both satisfied. By Lemma 4.4, we have
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
\frac { [ \mathbf { y } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { X } \pmb { \mu } ] ^ { 2 } } { ( \mathbf { y } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { y } ) ^ { 2 } \| \pmb { \mu } \| _ { \Sigma } ^ { 2 } + \| \mathbf { Q } ^ { \top } ( \mathbf { X } \mathbf { X } ^ { \top } ) ^ { - 1 } \mathbf { y } \| _ { \Sigma } ^ { 2 } } \geq c _ { 1 } \cdot \frac { n ^ { 2 } \| \pmb { \mu } \| _ { 2 } ^ { 4 } } { n ^ { 2 } \| \pmb { \mu } \| _ { \Sigma } ^ { 2 } + n \cdot \| \pmb { \Sigma } \| _ { F } ^ { 2 } + n ^ { 2 } \cdot \| \pmb { \Sigma } \| _ { 2 } ^ { 2 } } ,
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
where $c _ { 1 }$ is an absolute constant. Therefore by Lemma 4.3 we have
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
R ( \widehat \theta _ { \mathrm { S V M } } ) \leq \exp \left( \frac { - c _ { 2 } n \| \pmb \mu \| _ { 2 } ^ { 4 } } { n \| \pmb \mu \| _ { \Sigma } ^ { 2 } + \| \pmb \Sigma \| _ { F } ^ { 2 } + n \| \pmb \Sigma \| _ { 2 } ^ { 2 } } \right)
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
for some absolute constant $c _ { 2 }$ . Note that by union bound, the above inequality holds with probability at least $1 - O ( n ^ { - 2 } ) \geq 1 - n ^ { - 1 }$ when $n$ is large enough. This completes the proof. □
|
| 321 |
+
|
| 322 |
+
# 5 Conclusion and Future Work
|
| 323 |
+
|
| 324 |
+
We have studied the benign overfitting phenomenon for sub-Gaussian mxiture models, and established a population risk bound for the maximum margin classifier. Our population risk bound is general and covers both the isotropic and anisotropic settings. When reduced to the isotropic setting, our bound is tighter than existing results. We have also studied a class of non-isotropic models which can be benign even for infinite-dimensional data.
|
| 325 |
+
|
| 326 |
+
An interesting future work direction is to study the relation between the dimension and the population risk and verify the double descent phenomenon. Studying benign overfitting for more complicated learning models such as neural networks is another important future work direction.
|
| 327 |
+
|
| 328 |
+
# Acknowledgments and Disclosure of Funding
|
| 329 |
+
|
| 330 |
+
We thank the anonymous reviewers for their helpful comments. This work was done when YC was a postdoctoral researcher at UCLA. YC and QG are partially supported by the National Science Foundation award IIS-1903202 and IIS-2008981. MB acknowledges support from NSF IIS-1815697 and the support of the NSF and the Simons Foundation for the Collaboration on the Theoretical Foundations of Deep Learning through awards DMS-2031883 and #814639. The views and conclusions contained in this paper are those of the authors and should not be interpreted as representing any funding agencies.
|
| 331 |
+
|
| 332 |
+
# References
|
| 333 |
+
|
| 334 |
+
[1] ARORA, S., COHEN, N., HU, W. and LUO, Y. (2019). Implicit regularization in deep matrix factorization. Advances in Neural Information Processing Systems 32.
|
| 335 |
+
[2] BARTLETT, P. L., LONG, P. M., LUGOSI, G. and TSIGLER, A. (2020). Benign overfitting in linear regression. Proceedings of the National Academy of Sciences .
|
| 336 |
+
[3] BELKIN, M., HSU, D., MA, S. and MANDAL, S. (2019). Reconciling modern machine-learning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences 116 15849–15854.
|
| 337 |
+
[4] BELKIN, M., HSU, D. and XU, J. (2019). Two models of double descent for weak features. arXiv preprint arXiv:1903.07571 .
|
| 338 |
+
[5] BELKIN, M., MA, S. and MANDAL, S. (2018). To understand deep learning we need to understand kernel learning. In International Conference on Machine Learning. PMLR.
|
| 339 |
+
[6] CHATTERJI, N. S. and LONG, P. M. (2020). Finite-sample analysis of interpolating linear classifiers in the overparameterized regime. arXiv preprint arXiv:2004.12019 .
|
| 340 |
+
[7] CÔTÉ, F. D., PSAROMILIGKOS, I. N. and GROSS, W. J. (2012). A chernoff-type lower bound for the gaussian q-function. arXiv preprint arXiv:1202.6483 .
|
| 341 |
+
[8] DONOHO, D. and JIN, J. (2008). Higher criticism thresholding: Optimal feature selection when useful features are rare and weak. Proceedings of the National Academy of Sciences 105 14790–14795.
|
| 342 |
+
[9] GUNASEKAR, S., LEE, J., SOUDRY, D. and SREBRO, N. (2018). Characterizing implicit bias in terms of optimization geometry. In International Conference on Machine Learning.
|
| 343 |
+
[10] GUNASEKAR, S., WOODWORTH, B. E., BHOJANAPALLI, S., NEYSHABUR, B. and SREBRO, N. (2017). Implicit regularization in matrix factorization. In Advances in Neural Information Processing Systems.
|
| 344 |
+
[11] HASTIE, T., MONTANARI, A., ROSSET, S. and TIBSHIRANI, R. J. (2019). Surprises in high-dimensional ridgeless least squares interpolation. arXiv preprint arXiv:1903.08560 .
|
| 345 |
+
[12] HSU, D., MUTHUKUMAR, V. and XU, J. (2020). On the proliferation of support vectors in high dimensions. arXiv preprint arXiv:2009.10670 .
|
| 346 |
+
[13] JI, Z. and TELGARSKY, M. (2019). The implicit bias of gradient descent on nonseparable data. In Conference on Learning Theory.
|
| 347 |
+
|
| 348 |
+
[14] JIN, J. (2009). Impossibility of successful classification when useful features are rare and weak. Proceedings of the National Academy of Sciences 106 8859–8864.
|
| 349 |
+
|
| 350 |
+
[15] LIAO, Z., COUILLET, R. and MAHONEY, M. (2020). A random matrix analysis of random fourier features: beyond the gaussian kernel, a precise phase transition, and the corresponding double descent. In 34th Conference on Neural Information Processing Systems (NeurIPS 2020).
|
| 351 |
+
[16] LYU, K. and LI, J. (2019). Gradient descent maximizes the margin of homogeneous neural networks. arXiv preprint arXiv:1906.05890 .
|
| 352 |
+
[17] MEI, S. and MONTANARI, A. (2019). The generalization error of random features regression: Precise asymptotics and double descent curve. arXiv preprint arXiv:1908.05355 .
|
| 353 |
+
[18] MONTANARI, A. and ZHONG, Y. (2020). The interpolation phase transition in neural networks: Memorization and generalization under lazy training. arXiv preprint arXiv:2007.12826 .
|
| 354 |
+
[19] MUTHUKUMAR, V., NARANG, A., SUBRAMANIAN, V., BELKIN, M., HSU, D. and SAHAI, A. (2020). Classification vs regression in overparameterized regimes: Does the loss function matter? arXiv preprint arXiv:2005.08054 .
|
| 355 |
+
[20] MUTHUKUMAR, V., VODRAHALLI, K., SUBRAMANIAN, V. and SAHAI, A. (2020). Harmless interpolation of noisy data in regression. IEEE Journal on Selected Areas in Information Theory 1 67–83.
|
| 356 |
+
[21] NACSON, M. S., SREBRO, N. and SOUDRY, D. (2019). Stochastic gradient descent on separable data: Exact convergence with a fixed learning rate. In The 22nd International Conference on Artificial Intelligence and Statistics.
|
| 357 |
+
[22] SOUDRY, D., HOFFER, E., NACSON, M. S., GUNASEKAR, S. and SREBRO, N. (2018). The implicit bias of gradient descent on separable data. The Journal of Machine Learning Research 19 2822–2878.
|
| 358 |
+
[23] TSIGLER, A. and BARTLETT, P. L. (2020). Benign overfitting in ridge regression. arXiv preprint arXiv:2009.14286 .
|
| 359 |
+
[24] VERSHYNIN, R. (2010). Introduction to the non-asymptotic analysis of random matrices. arXiv preprint arXiv:1011.3027 .
|
| 360 |
+
[25] WANG, K. and THRAMPOULIDIS, C. (2020). Benign overfitting in binary classification of gaussian mixtures. arXiv preprint arXiv:2011.09148 .
|
| 361 |
+
[26] WU, D. and XU, J. (2020). On the optimal weighted $\ell _ { 2 }$ regularization in overparameterized linear regression. Advances in Neural Information Processing Systems 33.
|
| 362 |
+
|
| 363 |
+
# Checklist
|
| 364 |
+
|
| 365 |
+
1. For all authors...
|
| 366 |
+
|
| 367 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 368 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 369 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A] The focus of this paper is on theoretical analysis. The results do not have any negative social impact.
|
| 370 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 371 |
+
|
| 372 |
+
2. If you are including theoretical results...
|
| 373 |
+
|
| 374 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
|
| 375 |
+
|
| 376 |
+
3. If you ran experiments...
|
| 377 |
+
|
| 378 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
|
| 379 |
+
|
| 380 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 381 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] The experiments are to verify high-probability guarantees on synthetic data.
|
| 382 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] This paper does not focus on computing cost. All experiments can be run very efficiently on a standard PC.
|
| 383 |
+
|
| 384 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 385 |
+
|
| 386 |
+
(a) If your work uses existing assets, did you cite the creators? [N/A]
|
| 387 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 388 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 389 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 390 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 391 |
+
|
| 392 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 393 |
+
|
| 394 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 395 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 396 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/GWRkOYr4jxQ/GWRkOYr4jxQ.md
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Luna: Linear Unified Nested Attention
|
| 2 |
+
|
| 3 |
+
Xuezhe Ma∗ ISI, USC xuezhema@isi.edu
|
| 4 |
+
|
| 5 |
+
Xiang Kong∗ LTI, CMU xiangk@cs.cmu.edu
|
| 6 |
+
|
| 7 |
+
Sinong Wang∗ Facebook AI sinongwang@fb.com
|
| 8 |
+
|
| 9 |
+
Chunting Zhou LTI, CMU chuntinz@cs.cmu.edu
|
| 10 |
+
|
| 11 |
+
Jonathan May ISI, USC jonmay@isi.edu
|
| 12 |
+
|
| 13 |
+
Hao Ma, Luke Zettlemoyer Facebook AI {haom, lsz}@fb.com
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
The quadratic computational and memory complexities of the Transformer’s attention mechanism have limited its scalability for modeling long sequences. In this paper, we propose Luna, a linear unified nested attention mechanism that approximates softmax attention with two nested linear attention functions, yielding only linear (as opposed to quadratic) time and space complexity. As compared to a more traditional attention mechanism, Luna introduces an additional sequence with a fixed length as input and an additional corresponding output, which allows Luna to perform attention operation linearly, while also storing adequate contextual information. We perform extensive evaluations on three benchmarks of sequence modeling tasks: long-context sequence modeling, neural machine translation and masked language modeling for large-scale pretraining. Competitive or even better experimental results demonstrate both the effectiveness and efficiency of Luna compared to a variety of strong baseline methods including the full-rank attention and other efficient sparse and dense attention methods. The implementation of our model is available at https://github.com/XuezheMax/fairseq-apollo.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
Transformers (Vaswani et al., 2017) are surprisingly versatile models that preform well on a wide range of language and vision tasks, including machine translation (Vaswani et al., 2017; Ott et al., 2018), language understanding (Devlin et al., 2019), image recognition (Dosovitskiy et al., 2020) and bioinformatics (Madani et al., 2020). Attention (Bahdanau et al., 2015) provides the key mechanism that captures contextual information from the entire sequence by modeling pairwise interactions between the inputs at every timestep. However, a common weakness of Transformers is their quadratic time and memory complexity within the attention mechanism w.r.t the length of the input sequence, which prohibitively restricts their potential application to tasks requiring longer input sequences.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: Trade-off between accuracy (y-axis), speed (x-axis) and memory (cir-radius) on LRA.
|
| 25 |
+
|
| 26 |
+
A number of techniques have been recently introduced to improve the time and memory efficiency of Transformer models (‘xformers’) (Tay et al., 2020b, 2021). One popular technique is using sparsity to restrict the attention field range, such as local attention (Parmar et al., 2018), blockwise attention (Qiu et al., 2019), strided attention patterns (Child et al., 2019; Beltagy et al., 2020), compressed attention (Liu et al., 2018), and attention with learnable patterns (Kitaev et al., 2020; Tay et al., 2020a; Roy et al., 2021). Another emerging approach is to improve efficiency by leveraging low-rank approximations of the attention matrix. Linformer (Wang et al., 2020), for example, projects the length dimension of key and value matrices to a fixed-dimensional representation by assuming low-rank structure in the full-rank attention matrix. Recently, some kernel-based methods, such as Linear Transformer (Katharopoulos et al., 2020), Performer (Choromanski et al., 2020) and Random Feature Attention (Peng et al., 2021), attempt to efficiently approximate regular (softmax) full-rank attention through kernelization. Although these models demonstrate better asymptotic complexity for long sequences, their efficiency gains are less prominent for moderate length sequences and their performance remains behind Transformers with regular attention.
|
| 27 |
+
|
| 28 |
+
In this work, we propose a linear unified nested attention mechanism (Luna), which uses two nested attention functions to approximate the regular softmax attention in Transformer (§2). Specifically, with the first attention function, Luna packs the input sequence into a sequence of fixed length. Then, the packed sequence is unpacked using the second attention function (§3.1). As compared to a more traditional attention mechanism, Luna introduces an additional sequence with a fixed length as input and an additional corresponding output. Importantly, the extra input allows Luna to perform attention operation linearly as efficiently as Linformer (Wang et al., 2020), while also storing adequate contextual information. Unlike Linformer, Luna is capable of modeling variable-length sequences and autoregressive (causal) attention (§3.4). We perform extensive experiments on three sequence modeling tasks, including long-context sequence modeling, neural machine translation, and masked language modeling for large-scale pretraining and downstream task finetuning. Compared to a variety of strong baseline models, Luna achieves competitive or even better performance, while acquiring prominent gains of efficiency in both speed and memory (see Figure 1). More importantly, Luna manages to obtain superior performance with small projection lengths such as 16 (§4).
|
| 29 |
+
|
| 30 |
+
# 2 Background
|
| 31 |
+
|
| 32 |
+
# 2.1 Attention
|
| 33 |
+
|
| 34 |
+
The traditional attention mechanism is a function:
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
Y = \mathrm { A t t n } ( X , C ) = \omega \left( { \frac { X W _ { Q } ( C W _ { K } ) ^ { T } } { \sqrt { d } } } \right) C W _ { V }
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
where the attention function Attn $\colon \mathbb { R } ^ { n \times d } \times \mathbb { R } ^ { m \times d } \to \mathbb { R } ^ { n \times d }$ takes as inputs two sequences: the query sequence $\ b { X } \in \mathbb { R } ^ { n \times d }$ with length $n$ and the context sequence $C \in \mathbb { R } ^ { m \times d }$ with length $m$ , and output one sequence $Y \in \mathbb { R } ^ { n \times d }$ with the same length $n$ as the query $X$ . $d$ is the embedding dimension, and $W _ { Q }$ , $W _ { K }$ , $W _ { V } \in \mathbb { R } ^ { d \times d }$ are three learnable parameters that project the input sequences into the space of query, key and value matrices: $Q = X \bar { W } _ { Q } , K = C \bar { W _ { K } } , \bar { V } = C \bar { W _ { V } } . c$ $\omega$ is an activation function, e.g. the softmax function in regular attention. Note that the formulation in (1) is applicable to both cross-attention where $C$ and $X$ are the representations from Transformer encoder and decoder, respectively, and self-attention where $X$ and $C$ are the same sequence $X = C$ ). In practice, the multi-head variant of attention (Vaswani et al., 2017), which performs the attention function $h$ times in parallel, is commonly used. Throughout this paper, we omit $h$ for simplicity.
|
| 41 |
+
|
| 42 |
+
In particular, the matrix $\begin{array} { r } { A = \omega ( \frac { Q K ^ { T } } { \sqrt { d _ { k } } } ) \in \mathbb { R } ^ { n \times m } } \end{array}$ in (1) is called the attention matrix which specifies the alignment scores between every pair of tokens in sequences of queries $X$ and contexts $C$ Calculating $A$ takes $O ( n m )$ time and space, which is quadratic with respect to the sequence length and becomes a significant bottleneck when processing long sequences.
|
| 43 |
+
|
| 44 |
+
# 2.2 Transformer Layers
|
| 45 |
+
|
| 46 |
+
The other two key components of Transformer, besides attention, are position-wise feed-forward networks (FFN) and layer normalization (Ba et al., 2016). Technically, the position-wise feedforward layer operates on each position independently and layer normalization plays a crucial role in controlling the gradient scales (Xiong et al., 2020). Each Transformer layer can be expressed as:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\begin{array} { r } { \begin{array} { r c l } { X _ { A } } & { = } & { \mathrm { L a y e r N o r m } ( \mathrm { A t t n } ( X , C ) + X ) } \\ { X ^ { \prime } } & { = } & { \mathrm { L a y e r N o r m } ( \mathrm { F F N } ( X _ { A } ) + X _ { A } ) } \end{array} } \end{array}
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where $X$ and $C$ are the two input sequences and $X ^ { \prime }$ is the output of the Transformer layer. The Transformer layer in (2) adopts the original post-layer normalization architecture (Vaswani et al., 2017; Devlin et al., 2019) that places layer normalization after residual connection, rather than pre-layer normalization (Vaswani et al., 2018; Wang et al., 2019).
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
Figure 2: Illustration of the architecture of one Transformer encoder layer (left) versus one Luna encoder layer (right).
|
| 56 |
+
|
| 57 |
+
# 3 Linear Unified Nested Attention (Luna)
|
| 58 |
+
|
| 59 |
+
Our goal is to design an efficient attention mechanism to solve the quadratic complexity problem of full attention. We first introduce the proposed linear unified nested attention mechanism, named Luna attention (§3.1), and the architecture of each Luna layer (§3.2). Then, we present the variant of Luna for causal attention, named Luna causal attention (§3.3). Finally, we discuss the differences between Luna and three closely related models: Linformer (Wang et al., 2019), Set Transformer (Lee et al., 2019) (§3.4) and Shared Workspace (Goyal et al., 2021).
|
| 60 |
+
|
| 61 |
+
# 3.1 Pack and Unpack Attention
|
| 62 |
+
|
| 63 |
+
The key idea behind Luna is to decouple the regular attention function in (1) into two nested attention operations, both of which have linear efficiency. To achieve this, besides the original query and context input sequences, Luna introduces an extra input that is a sequence with fixed (constant) length. With this extra input as the query sequence, Luna uses its first attention, named pack attention, to pack the context sequence into a fixed-length sequence. Formally, let $P \in \mathbb { R } ^ { l \times d }$ denote the extra input sequence with fixed length $l$ . The pack attention first packs $C$ to $Y _ { P }$ with $P$ as the query sequence:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
Y _ { P } = \mathrm { A t t n } ( P , C )
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where $\mathrm { A t t n } ( \cdot , \cdot )$ is the regular attention function in (1), $C \in \mathbb { R } ^ { m \times d }$ is the context sequence, and $Y _ { P } \in \mathbb { R } ^ { l \times d }$ is the output of the pack attention, which is named the packed context. Since the length of $P$ is a constant $l$ , the complexity of pack attention is $O ( l m )$ , which is linear with respect to $m$ .
|
| 70 |
+
|
| 71 |
+
To unpack the sequence back to the length of the original query sequence $X$ , Luna leverages its second attention, named unpack attention:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
Y _ { X } = \mathrm { A t t n } ( X , Y _ { P } )
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $\ b { X } \in \mathbb { R } ^ { n \times d }$ is the original query sequence. Similar to pack attention, the complexity of unpack attention is $O ( l n )$ , which is also linear with repect to $n$ .
|
| 78 |
+
|
| 79 |
+
Encoding Contextual Information in $P$ . The next question is where the extra input sequence $P$ comes from. One straightforward choice is to format $P$ as a learnable parameter of each Luna layer. One obvious drawback of this method, however, is that $P$ would not capture any contextual information. To enhance the capacity of the Luna model, we propose to formulate $Y _ { P }$ as an additional output of each Luna layer, corresponding to $P$ . Formally, the Luna attention function LunaAttn $( \cdot , \cdot , \cdot )$ takes three sequences as input and generates two sequence as output:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
Y _ { X } , Y _ { P } = \operatorname { L u n a A t t n } ( X , P , C )
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where the computation of $Y _ { P }$ and $Y _ { X }$ is in (3) and (4). By stacking multiple layers of Luna attention, the output $Y _ { P }$ from the previous layer, which captures contextual information of $C$ , is employed as the input $P$ of the next layer. For the first layer of Luna, we formulate $P$ as learnable positional embeddings2 (Vaswani et al., 2017).
|
| 86 |
+
|
| 87 |
+
Reducing the Number of Parameters. Due to the two nested attention operations, there are two sets of parameters $( W _ { Q }$ , $W _ { K }$ , $W _ { V } )$ ) in a single Luna attention function. There are several techniques to reduce the number of parameters, such as parameter sharing (Xia et al., 2019). In this work, we follow Wang et al. (2020) to share $W _ { K }$ and $W _ { Q }$ in each layer, and conduct experiments to analyze performance decline against Luna with full sets of parameters (§4.2).
|
| 88 |
+
|
| 89 |
+
# 3.2 Luna Layers
|
| 90 |
+
|
| 91 |
+
The Luna attention is used as a drop-in-replacement for the regular attention. We incorporate the position-wise feed-forward network and layer normalization into Luna layers. Concretely, layer normalization is applied to both $Y _ { X }$ and $Y _ { P }$ , while FFN only to $Y _ { X }$ :
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\begin{array} { r c l } { Y _ { X } , Y _ { P } } & { = } & { \operatorname { L u n a A t t n } ( X , P , C ) } \\ { X _ { A } , P _ { A } } & { = } & { \operatorname { L a y e r N o r m } ( Y _ { X } + X ) , \operatorname { L a y e r N o r m } ( Y _ { P } + P ) } \\ { X ^ { \prime } , P ^ { \prime } } & { = } & { \operatorname { L a y e r N o r m } ( \operatorname { F F N } ( X _ { A } ) + X _ { A } ) , P _ { A } } \end{array}
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $X ^ { \prime }$ and $P ^ { \prime }$ are the two outputs of the Luna layer. The graphical specification of one Luna layer is illustrated in Figure 2.
|
| 98 |
+
|
| 99 |
+
# 3.3 Luna Causal Attention
|
| 100 |
+
|
| 101 |
+
As discussed in Tay et al. (2020b), the ability to support causal autoregressive decoding, i.e. attending solely to the past and current tokens, is required when designing efficient self-attention mechanisms. However, due to the pack attention that packs the long sequence $X$ into a fixed (shorter) length, it is not straight-forward to support causal attention in Luna.
|
| 102 |
+
|
| 103 |
+
To design causal attention in Luna, we need to assume that the input $P$ contains no information of $X$ , i.e. $P$ will not leak any future information of $X$ to the history. Before we describe the Luna causal attention mechanism, we first define a causal function $f : \mathbb { R } ^ { n \times d _ { 1 } } \times \mathbb { R } ^ { n \times d _ { 1 } } \times \mathbb { R } ^ { n \times d _ { 2 } } \to \mathbb { R } ^ { n \times d _ { 2 } }$ :
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
F \triangleq f ( X , Y , Z ) , { \mathrm { ~ w h e r e ~ } } F _ { t } = { \frac { 1 } { t } } X _ { t } \sum _ { j = 1 } ^ { t } Y _ { j } ^ { T } Z _ { j }
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
where $F \in \mathbb { R } ^ { n \times d _ { 2 } }$ and $F _ { t }$ denotes the $t { \cdot }$ -th row of $F$ . From the definition of $f$ in (7), we see that $F _ { t }$ can only access the information of the past and present row of $X$ , $Y$ and $Z$ .
|
| 110 |
+
|
| 111 |
+
To perform Luna causal attention, we first compute the attention matrix of the pack attention: $A _ { p a c k } = \omega ( P X ^ { T } / \sqrt { d } )$ . For simplicity, we omit the learnable parameters, e.g. $W _ { Q } , \ W _ { K } , \ W _ { V }$ in (1). Note that for $A _ { p a c k }$ , we cannot use the softmax function for $\omega$ , as the normalization term in softmax leaks future information of $X$ to the history. Inspired by the causal attention mechanism in Linear Transformer (Katharopoulos et al., 2020), we use two activation functions: 1) $\omega ( \cdot ) = \mathrm { e l u } ( \cdot ) + 1$ based on the exponential linear unit (Clevert et al., 2016); 2) $\omega ( \cdot ) = \mathrm { s o f t p l u s } ( \cdot )$ based on the softplus function (Glorot et al., 2011). With the causal function $f$ in (7), we compute the attention matrix of the unpack attention: $A _ { u n p a c k } = \omega ( f ( X , X , A _ { p a c k } ^ { T } ) )$ . Unlike $A _ { p a c k }$ , we can use $\omega ( \cdot ) = \mathrm { s o f t m a x } ( \cdot )$ for $A _ { u n p a c k }$ , because the normalization is along the $l$ -dimension rather than the $n$ -dimension of $X$ . Finally, the output $\mathrm { Y }$ is computed by $Y = f ( A _ { u n p a c k } , A _ { p a c k } ^ { T } , X )$ .
|
| 112 |
+
|
| 113 |
+
The complexity of the causal attention in Luna is still linear: $O ( l n )$ . One drawback of Luna causal attention, similar to the causal attention in Random Feature Attention (RFA) (Peng et al., 2021) and Linear Transformer (Katharopoulos et al., 2020), is its sequential computation for each timestep $t$ .
|
| 114 |
+
|
| 115 |
+
The sources of $P$ . In the formulation of causal attention, $P$ is expected to contain no information about $X$ . Thus, we need to formulate $P$ based on the usage mode of the causal attention. For the encoder-decoder mode in sequence-to-sequence modeling (e.g. for machine translation), we can use packed output from the Luna encoder as $P$ . For the decoder-only mode (e.g. for language modeling), $P$ might be formulated as a learnable parameter of each layer.
|
| 116 |
+
|
| 117 |
+
Table 1: Experimental results on the long range arena (LRA) benchmark. For Luna, we explore three projected dimensions: 16, 128 and 256. ‘Avg. (w/o rtl)’ denotes the averaged accuracy over all tasks excluding Retrieval. The performance of previous works are from Tay et al. (2021).
|
| 118 |
+
|
| 119 |
+
<table><tr><td>Models</td><td>ListOps</td><td>Text</td><td>Retrieval</td><td>Image</td><td>Pathfinder</td><td>Avg.</td><td>Avg. (w/o rtl)</td></tr><tr><td>Transformer Transformer (re-impl)</td><td>36.37 37.11</td><td>64.27 65.21</td><td>57.46 79.14</td><td>42.44</td><td>71.40</td><td>54.39</td><td>53.62</td></tr><tr><td></td><td></td><td></td><td></td><td>42.94</td><td>71.83</td><td>59.24</td><td>54.27</td></tr><tr><td>Local Attention</td><td>15.82</td><td>52.98</td><td>53.39</td><td>41.46</td><td>66.63</td><td>46.06</td><td>44.22</td></tr><tr><td>Sparse Trans.</td><td>17.07</td><td>63.58</td><td>59.59</td><td>44.24</td><td>71.71</td><td>51.24</td><td>49.15</td></tr><tr><td>Longformer</td><td>35.63</td><td>62.85</td><td>56.89</td><td>42.22</td><td>69.71</td><td>53.46</td><td>52.60</td></tr><tr><td>Linformer</td><td>35.70</td><td>53.94</td><td>52.27</td><td>38.56</td><td>76.34</td><td>51.36</td><td>51.14</td></tr><tr><td>Reformer</td><td>37.27</td><td>56.10</td><td>53.40</td><td>38.07</td><td>68.50</td><td>50.67</td><td>49.99</td></tr><tr><td>Sinkhorn Trans.</td><td>33.67</td><td>61.20 61.68</td><td>53.83</td><td>41.23</td><td>67.45</td><td>51.39</td><td>50.89</td></tr><tr><td>Synthesizer</td><td>36.99 36.05</td><td>64.02</td><td>54.67</td><td>41.61</td><td>69.45</td><td>52.88</td><td>52.43</td></tr><tr><td>BigBird Linear Trans.</td><td>16.13</td><td>65.90</td><td>59.29 53.09</td><td>40.83 42.34</td><td>74.87 75.30</td><td>55.01</td><td>53.94</td></tr><tr><td>Performer</td><td>18.01</td><td>65.40</td><td>53.82</td><td>42.77</td><td>77.05</td><td>50.55 51.41</td><td>49.92</td></tr><tr><td></td><td>37.43</td><td></td><td></td><td></td><td></td><td></td><td>50.81</td></tr><tr><td>Luna-16</td><td>38.01</td><td>65.74 65.74</td><td>79.38 79.55</td><td>46.39</td><td>78.36</td><td>61.46</td><td>56.98</td></tr><tr><td>Luna-128</td><td>37.98</td><td></td><td></td><td>47.47</td><td>78.89</td><td>61.93</td><td>57.53</td></tr><tr><td>Luna-256</td><td></td><td>65.78</td><td>79.56</td><td>47.86</td><td>78.55</td><td>61.95</td><td>57.54</td></tr></table>
|
| 120 |
+
|
| 121 |
+
# 3.4 Discussion
|
| 122 |
+
|
| 123 |
+
Relation to Linformer and Shared Workspace. One previous work closely related to Luna is Linformer (Wang et al., 2019). Linformer linearly projects the context sequence $C \in \mathbb { R } ^ { m \times d }$ into a sequence with fixed length $l$ : $C ^ { \prime } = E C$ , where $\dot { C } ^ { \prime } \in \mathbf { \mathbb { R } } ^ { l \times d }$ is the projected context sequence and $E \in \mathbb { R } ^ { l \times m }$ is the learnable projection matrix of each layer. Then, the attention operation is applied on the query $X$ and the projected context $C ^ { \prime }$ . The pack attention in Luna is a generalization of the linear projection in Linformer. There are two main advantages to Luna over Linformer: i) with pack attention as the projection method, Luna is able to model sequences with various lengths. In contrast, Linformer requires the length of all input sequences to be the same $m$ , due to the projection matrix $E$ , whose shape depends on $m$ . ii) Luna achieves better expressiveness than Linear, not only due to the general projection method but also by encoding adequate contextual information into the projection via $P$ (see $\ S 3 . 1 \ r .$ ). Experimental improvements over non-contextual projection demonstrate the effectiveness of Luna (see $\ S 4 . 2 )$ . In contemporaneous and individual work, Goyal et al. (2021) formulate contextual $p$ as a shared global workspace, which shares similar instantiation with Luna.
|
| 124 |
+
|
| 125 |
+
Relation to Set Transformer. The additional input $P$ in Luna can be regarded as a side memory module that can access the entire sequence to gather contextual information. From this view of point, Luna is also closely related to Set Transformer (Lee et al., 2019), an early model to integrate side memory module in Transformers. Similar to the projection matrix in Linformer, the inducing points in Set Transformer are learnable parameters. Thus, these inducing points might be formulated as the non-contextual version of $P$ in Luna. Moreover, Set Transformer is designed for set-input problems, which are problems wherein the input is a set of features and the model is thereby invariant to permutation or ordering of the input features (Tay et al., 2020b), while Luna attention is used as a drop-in replacement for regular softmax attention.
|
| 126 |
+
|
| 127 |
+
# 4 Experiments
|
| 128 |
+
|
| 129 |
+
# 4.1 Long-Context Sequence Modeling
|
| 130 |
+
|
| 131 |
+
We evaluate the effectiveness and efficiency of Luna on the Long Range Arena (LRA) benchmark recently introduced by Tay et al. (2021), which is designed for the purpose of evaluating efficient Transformer models under the long-context scenario. They collect five tasks in this benchmark which are ListOps (Nangia and Bowman, 2018), byte-level text classification (Text; Maas et al., 2011), byte-level document retrieval (Retrieval; Radev et al., 2013), image classification on sequences of pixels (Image; Krizhevsky et al., 2009) and Pathfinder (Linsley et al., 2018). These tasks consist of input sequences ranging from 1K to 8K tokens and span across a variety of data types and modalities.
|
| 132 |
+
|
| 133 |
+
Table 2: Training speed and peak memory consumption comparison of different models on byte-level text classification with various input lengths (1K, 2K, 3K and 4K). The best model is in boldface.
|
| 134 |
+
|
| 135 |
+
<table><tr><td>Model</td><td colspan="4"> Steps per second 个</td><td colspan="4">Peak Memory Usage (GB)↓</td></tr><tr><td>Transformer</td><td>1K 1.0</td><td>2K 1.0</td><td>3K 1.0</td><td>4K</td><td>1K 1.00</td><td>2K 1.00</td><td>3K 1.00</td><td>4K 1.00</td></tr><tr><td></td><td></td><td></td><td></td><td>1.0</td><td></td><td></td><td></td><td></td></tr><tr><td>Local Attention</td><td>1.1</td><td>1.7</td><td>3.2</td><td>5.3</td><td>0.49</td><td>0.29</td><td>0.19</td><td>0.14</td></tr><tr><td>Linformer Reformer</td><td>1.2</td><td>1.9</td><td>3.7</td><td>5.5</td><td>0.44</td><td>0.21</td><td>0.18</td><td>0.10</td></tr><tr><td>Sinkhorn Trans</td><td>0.5 1.1</td><td>0.4 1.6</td><td>0.7</td><td>0.8</td><td>0.56 0.55</td><td>0.37 0.31</td><td>0.28</td><td>0.24 0.16</td></tr><tr><td>Synthesizer</td><td>1.1</td><td>1.2</td><td>2.9</td><td>3.8</td><td>0.76</td><td></td><td>0.21</td><td>0.74</td></tr><tr><td>BigBird</td><td></td><td>0.8</td><td>2.9</td><td>1.4 1.1</td><td></td><td>0.75</td><td>0.74</td><td>0.30</td></tr><tr><td>Linear Trans.</td><td>0.9</td><td>1.9</td><td>1.2</td><td>5.6</td><td>0.91 0.44</td><td>0.56</td><td>0.40</td><td>0.11</td></tr><tr><td>Performer</td><td>1.1 1.2</td><td>1.9</td><td>3.7 3.8</td><td>5.7</td><td>0.44</td><td>0.22 0.22</td><td>0.15 0.15</td><td>0.11</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Luna-16</td><td>1.2</td><td>1.8</td><td>3.7</td><td>5.5</td><td>0.44 0.49</td><td>0.23</td><td>0.17</td><td>0.10</td></tr><tr><td>Luna-128</td><td>1.1</td><td>1.7</td><td>3.4</td><td>5.1</td><td></td><td>0.28</td><td>0.21</td><td>0.14</td></tr><tr><td>Luna-256</td><td>1.1</td><td>1.7</td><td>3.3</td><td>4.9</td><td>0.60</td><td>0.33</td><td>0.23</td><td>0.16</td></tr></table>
|
| 136 |
+
|
| 137 |
+
To ensure fair comparisons, for all tasks except for the task Retrieval, we closely follow the model configurations in Tay et al. (2021) such as data preprocessing, data split, model architecture, etc. For the task of Retrieval, we find that models are not fully converged when being trained for 5K steps as stated in Tay et al. (2021). Therefore, we train models for 20K steps for this task and obtain much better results. For a direct comparison, besides the average performance of models across all tasks, we also report the average accuracy on tasks excluding Retrieval. We run each experiment for five times with different random seeds and report the average accuracy. The hyper-parameters for each task are shown in Appendix A.1.
|
| 138 |
+
|
| 139 |
+
Results. The results of various models on the LRA benchmark are presented in Table 1. For our proposed method, we report results from models of three different projected dimensions (16, 128 and 256). First, we note that Luna achieves good results on all tasks consistently compared to the Transformer model and significantly outperforms all the other baseline methods in terms of the average accuracy. By taking a closer look at the accuracy for each individual task, Luna wins over baseline models on three out of five tasks and performs comparably with the best performed model on the other two tasks, i.e. ListOps and byte-level text classification. Notably, Luna improves over the Transformer model on image classification and pathfinder by a large margin. Second, we observe that although Luna achieves the best average performance with a projection dimension of 256, it also performs considerably well with smaller projection dimensions (16 and 128). This demonstrates the effectiveness of Luna even with small projected dimensions.
|
| 140 |
+
|
| 141 |
+
Memory and Speed Efficiency. Luna employs two nested linear attention functions to reduce the time and memory complexity compared to the vanilla softmax attention. Here, we examine the speed and memory footprint of various models with varying input lengths (1K, 2K, 3K and 4K). Following Tay et al. (2021), all models are evaluated on the byte-level classification task with the same batch size. The result is shown in Table 2.
|
| 142 |
+
|
| 143 |
+
Considering the memory efficiency, Luna with a projected dimension of 16 is highly memoryefficient, which is only $10 \%$ of the vanilla Transformer at 4K input sequence length. With larger projected dimensions, i.e. 128 and 256, Luna requires more memory but is still competitive compared to other efficient Transformer models. In terms of time efficiency, Luna-16 speeds up over the standard Transformer by 1.2-5.5 times, varying by the sequence length. Compared to other efficient Transformers, Luna-16 performs comparably with the fastest models, i.e. Performer and Linformer. Overall, our models achieve competitive advantage both in time- and memory-efficiency over other models, while attaining the best performance on the LRA benchmark (see Figure 1).
|
| 144 |
+
|
| 145 |
+
In addition, we plot the trade-off among memory, time and averaged LRA score without task Retrieval in Figure 1. Models such as Linformer and Performer have faster speed and small memory requirement with the sacrifice of performance. However, besides competitive time- and memory-efficiency, Luna models retain superior performance even with a small projected dimension $\left( l { = } 1 6 \right)$ .
|
| 146 |
+
|
| 147 |
+
Contextual information in $P$ of Luna. Recently, a popular method to model the classification task using Transformerbased models is to prepend a special symbol, [CLS], to every input example. The last hidden state of this symbol is regarded as the aggregate sequence representation. In Luna, we introduce an extra model input $P$ which not only allows us to efficiently compute the attention mechanism but learn contextual information as well. Theoretically, the $P$ from the
|
| 148 |
+
|
| 149 |
+
Table 3: Performance comparison of two sentence representation methods on LRA benchmark.
|
| 150 |
+
|
| 151 |
+
<table><tr><td>Models</td><td>ListOps</td><td>Text</td><td>Retrieval</td><td>Avg.</td></tr><tr><td>Luna-16,[CLS]</td><td>37.43</td><td>65.74</td><td>79.38</td><td>60.85</td></tr><tr><td>Luna-16, P</td><td>38.06</td><td>65.81</td><td>80.22</td><td>61.36</td></tr><tr><td>Luna-128, [CLS]</td><td>38.01</td><td>65.74</td><td>79.55</td><td>61.10</td></tr><tr><td>Luna-128,P</td><td>38.27</td><td>65.89</td><td>80.27</td><td>61.48</td></tr><tr><td>Luna-256, [CLS]</td><td>37.98</td><td>65.78</td><td>79.56</td><td>61.11</td></tr><tr><td>Luna-256, P</td><td>38.36</td><td>66.07</td><td>80.25</td><td>61.56</td></tr></table>
|
| 152 |
+
|
| 153 |
+
last layer is capable of learning the representation of the input sequence. To validate this, we extract $P$ at the last layer and employ the mean pooling strategy over positions to obtain the final feature for classification. We test its performance on three long-text modeling tasks in LRA (Tay et al., 2021), i.e., ListOps, Text and Retrieval and report results in Table 3. We find that $P$ -based methods obtain better scores across all tasks against the [CLS]-based one, validating the powerful ability of $P$ to encode contextual information of the input sequence.
|
| 154 |
+
|
| 155 |
+
# 4.2 Machine translation
|
| 156 |
+
|
| 157 |
+
To evaluate Luna on sequence-to-sequence modeling, we conduct experiments on a standard machine translation benchmark, i.e. WMT’14 English-German $\mathbf { E N } { } \mathbf { D E }$ ) dataset (4.5M sentence pairs). The data split and preprocessing steps follow those of Vaswani et al. (2017), using the scripts from FairSeq (Ott et al., 2019). We share the source and target vocabularies within the language pair, with 37K byte pair encoding (BPE) types (Sennrich et al., 2016). The Luna models closely follow the architecture of Transformer-base: 6 encoder and decoder layers with 8 attention heads and $d _ { \mathrm { m o d e l } } / d _ { \mathrm { h i d d e n } } = 5 1 2 / 2 0 4 8$ . We train the Transformer-base model with two optimization methods: Adam (Kingma and Ba, 2015) and
|
| 158 |
+
|
| 159 |
+
Table 4: Test BLEU on WMT’14 EN DE.
|
| 160 |
+
|
| 161 |
+
<table><tr><td>Model</td><td>BLEU</td><td> # Param.</td></tr><tr><td>Transformer-base (Adam) Transformer-base (Apollo)</td><td>27.8</td><td>64.9M</td></tr><tr><td>RFA (k = 256)</td><td>28.3 27.2</td><td>64.9M 66.2M</td></tr><tr><td>Luna-16, elu, tied kv Luna-32,elu, tied kv</td><td>27.1 27.3</td><td>69.6M 69.7M</td></tr><tr><td>Luna-16,softplus, tied kv Luna-32, softplus, tied kv</td><td>27.3 27.5</td><td>69.6M 69.7M</td></tr><tr><td>Luna-16, elu</td><td>27.4</td><td>77.5M</td></tr><tr><td>Luna-32, elu</td><td>27.6</td><td></td></tr><tr><td></td><td></td><td>77.6M</td></tr><tr><td>Luna-16, softplus Luna-32, softplus</td><td>27.6 27.8</td><td>77.5M</td></tr></table>
|
| 162 |
+
|
| 163 |
+
Apollo (Ma, 2020), and find Apollo achieves better performance. Therefore, we use Apollo as the optimizer for all Luna models. For each experiment, we conduct distributed training across eight NVIDIA Tesla V100 GPUs with maximum batch size of 8192 tokens per GPU. Further details are provided in Appendix A.2.
|
| 164 |
+
|
| 165 |
+
Results. Table 4 presents the results of Luna on the test set BLEU scores of WMT’ $1 4 \mathrm { E N } { } \mathrm { D E }$ , along with Transformer-base and Random Feature Attention (RFA) as baselines. Different from Peng et al. (2021) where the random feature attention is applied only to decoders, the RFA model in Table 4 applies random feature attention in both the encoder and decoder for a fair comparison. $k = 2 5 6$ is the number of feature maps in RFA. For Luna, we report performance of models with different projected lengths: $l = 1 6$ and $l = 3 2$ , different activation functions in (7): $\mathrm { e l u } ( \cdot ) + 1$ and softplus $( \cdot )$ , and w./w.o parameter sharing.
|
| 166 |
+
|
| 167 |
+
From Table 4, the first observation is that softplus $( \cdot )$ consistently outperforms $\mathrm { e l u } ( \cdot ) + 1$ . Thus, we use softplus $( \cdot )$ as the default activation function in the implementation. Another interesting observation is that Luna with a small projected length $( l = 1 6$ ) obtains similar performance to RFA with $k = 2 5 6$ feature maps. Luna with $l = 3 2$ achieves competitive performance, but still falls behind the Transformer-base model. Further improving the machine translation performance of Luna is left to future work. We also report the number of parameters of different models. At last, we evaluate Luna w./w.o parameter sharing. Although there are two sets of parameters in a single Luna attention function $( W _ { Q } , \ W _ { K } , \ W _ { V } )$ , as mentioned in $\ S 3 . 1$ , we tie $W _ { k }$ with $W _ { v }$ to reduce the number of parameters, and the performance decline is marginal. As a result, Luna with shared parameters has $7 \%$ and $5 \%$ more parameters compared to the vanilla Transformer and RFA models.
|
| 168 |
+
|
| 169 |
+
Effect of Encoding Contextual Information into $P$ . As discussed in $\ S 3 . 4$ , one advantage of Luna against Linformer is to incorporate contextual $P$ by formulating it as an extra input. To investigate the importance of this design, we conduct experiments on WMT’14 to compare Luna with the baseline model where $P$ is formulated as a non-contextual learnable parameter of each layer.
|
| 170 |
+
|
| 171 |
+
Table 5: Dev and Test BLEU
|
| 172 |
+
|
| 173 |
+
<table><tr><td>Model</td><td>Dev.</td><td>Test</td></tr><tr><td>Non-Contextual</td><td>24.4</td><td>25.2</td></tr><tr><td>Contextual</td><td>25.9</td><td>27.3</td></tr></table>
|
| 174 |
+
|
| 175 |
+
For both the contextual and non-contextual models, we train Luna with $l = 1 6$ , parameter sharing and softplus. Table 5 lists the BLEU scores on the development and test sets. Luna with contextual $P$ significantly outperforms the baseline with non-contextual $P$ , demonstrating the effectiveness of this design in Luna.
|
| 176 |
+
|
| 177 |
+
# 4.3 Masked Language Modeling for Large-Scale Pretraining
|
| 178 |
+
|
| 179 |
+
One popular application of Transformer is to pretrain a large-scale language model on a large amount of data which can then be fine-tuned on a wide range of downstream tasks, such as BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), etc. Therefore, we pretrain a Luna-based language model with RoBERTa-base model configuration on two versions of data as our pretraining set: 1) BERT version with BookCorpus (Zhu et al., 2015) and English Wikipedia (totally 16GB), 2) RoBERTa version with BookCorpus, English Wikipedia, CC-News (Nagel, 2016), OpenWebText (Gokaslan and Cohen, 2019) and Stories (Trinh and Le, 2018) (totally 160GB). For Luna models, we set $l = 1 2 8$ . On the larger training corpus (160GB), we train models w./w.o parameter sharing, respectively. We compare our models with RoBERTa-base, BERT-base and Linformer which are trained on the same training data. Experimental details are provided in Appendix A.3.
|
| 180 |
+
|
| 181 |
+
Finetuning Luna After obtaining the pretrained Luna-based language model, we finetune it on various natural language processing tasks, including sentiment classification (SST-2; Socher et al., 2013), natural language inference (QNLI; Rajpurkar et al., 2016), textual similarity (QQP; Chen et al., 2018, question answering (RACE (Lai et al., 2017) and CommonsenseQA (CSQA; Talmor et al., 2019). For GLUE tasks, following Liu et al. (2019), we consider a limited hyperparameter sweep for each task, with batch sizes $\in \{ 1 6 , 3 2 \}$ and learning rate $\in \{ 5 e ^ { - 6 } , 1 e ^ { - 5 } , \dot { 2 } e ^ { - 5 } \}$ , with a linear warmup for the first $6 \%$ of steps followed by a linear decay to 0. Finetuning is performed for 20 epochs with early stopping based on each task’s evaluation metric on the dev set3. For QA tasks, we concatenate each candidate answer with the corresponding question and passage. We then encode every candidate and pass the [CLS] output at the last layer through a fully-connected layer, which is used to predict the correct answer. We truncate question-answer pairs that are longer than 128 tokens and, if needed, the passage so that the total length is at most 512 tokens. Following Liu et al. (2019), we try a small range of possible values for hyperparameters, i.e., batch size $\in \left\{ 1 6 , 3 2 \right\}$ , learning rate $\bar { \in } \{ 1 e ^ { - 5 } , 2 e ^ { - 5 } , 3 e ^ { - 5 } \}$ and dropout $\in \{ 0 . \dot { 0 } , 0 . \dot { 1 } , 0 . 2 \}$ . For other configurations such as warm-up steps, optimizer, we follow thoses in Liu et al. (2019).
|
| 182 |
+
|
| 183 |
+
The result is reported in Table 6. We observe that on the smaller dataset (16GB) our Luna model has similar or slightly better downstream results compared to other pretrained language models. On QNLI and SST-2, Luna models obtain the best performance among all models, reaffirming the effectiveness of Luna in pre-training. This demonstrates the strong ability of Luna for language representations. On the larger dataset (160GB), however, the performance of Luna is slightly worse than RoBERTa with vanilla Transformer architecture. One possible reason is that the capacity of Luna is not as sufficient as vanilla Transformer, due to the efficient attention mechanism. This is supported by the evidence that Luna with full sets of parameters achieves better performance than that with parameter-sharing, because Luna with full sets of parameters has better capacity.
|
| 184 |
+
|
| 185 |
+
# 5 Related Work
|
| 186 |
+
|
| 187 |
+
There has been signficiant prior work on improving the efficiency of Transformers, besides the three closely related works discussed in $\ S 3 . 4$ . The common techniques include, but are not limited to, weight sharing (Dehghani et al., 2018), quantization (Shen et al., 2020; Fan et al., 2020), sparse attention (Parmar et al., 2018; Kitaev et al., 2020), side memory module (Lee et al., 2019; Gupta and Berant, 2020; Goyal et al., 2021), and low-rank or compressed context (Wang et al., 2019; Ainslie et al., 2020). In this section, we briefly review some recently proposed methods. For a detailed overview we refer the readers to Tay et al. (2020b).
|
| 188 |
+
|
| 189 |
+
Table 6: Performance of various models on development set of benchmark natural language understanding tasks. Bold face indicates best performance.
|
| 190 |
+
|
| 191 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">data</td><td colspan="3">GLUE</td><td colspan="2">QA</td></tr><tr><td>SST-2</td><td>QNLI</td><td>QQP</td><td>RACE</td><td>CSQA</td></tr><tr><td>BERT-base</td><td>16GB</td><td>92.7</td><td>88.4</td><td>89.6</td><td>64.2</td><td>53.3</td></tr><tr><td>RoBERTa-base</td><td>16GB</td><td>93.1</td><td>90.9</td><td>90.9</td><td>65.6</td><td>-</td></tr><tr><td>Linformer-128</td><td>16GB</td><td>92.4</td><td>90.4</td><td>90.2</td><td>1</td><td>1</td></tr><tr><td>Luna-128, tied kv</td><td>16GB</td><td>93.1</td><td>91.2</td><td>90.8</td><td>65.2</td><td>53.1</td></tr><tr><td>RoBERTa-base</td><td>160GB</td><td>94.8</td><td>92.8</td><td>91.9</td><td>73.50</td><td>63.61</td></tr><tr><td>Luna-128, tied kv</td><td>160GB</td><td>94.3</td><td>91.5</td><td>91.2</td><td>71.50</td><td>61.48</td></tr><tr><td>Luna-128</td><td>160GB</td><td>94.6</td><td>92.2</td><td>91.3</td><td>72.25</td><td>62.08</td></tr></table>
|
| 192 |
+
|
| 193 |
+
Sparse Attention The general idea of these methods is that, instead of attending to the whole sequence, each token only access to a fixed, predefined range such as local neighborhoods and strided or “dilated” windows. Popular methods include local attention (Parmar et al., 2018), blockwise attention (Qiu et al., 2019), strided attention patterns (Child et al., 2019; Beltagy et al., 2020), and compressed attention (Liu et al., 2018). To make this range more flexible, Reformer (Kitaev et al., 2020) employs a hash-based similarity measure to efficiently cluster tokens into chunks and Routing Transformer(Roy et al., 2021) employ online $\mathbf { k }$ -means clustering on the tokens. The Sinkhorn sorting Network (Tay et al., 2020a) exposes the sparsity in attention weights by learning to sort blocks of the input sequence.
|
| 194 |
+
|
| 195 |
+
Kernel Methods. A recently popular method to improve the efficiency of Transformers is to avoid explicitly computing the $m \times n$ attention matrix $A$ in (1) by re-writing it with kernels. Typical models leveraging kernelization are Linear Transformer (Katharopoulos et al., 2020), Performer (Choromanski et al., 2020) and Random Feature Attention (Peng et al., 2021). Since kernels are a form of approximation of the attention matrix, they can be also viewed as a form of low-rank method (Choromanski et al., 2020) that compresses the context to a shorter length, such as Linformer (Wang et al., 2019) and the proposed Luna model.
|
| 196 |
+
|
| 197 |
+
Recurrence. The simplest technique to reduce the complexity of Transformer is to chunk input sequences into fixed blocks, with the obvious disadvantage of losing contextual information from past chunks. As discussed in Tay et al. (2020b), these models can be regarded as fixed pattern models. Transformer-XL (Dai et al., 2019) proposed a natural extension to the blockwise method to connect these blocks via a recurrence mechanism. Compressive Transformer (Rae et al., 2020) further extends Transformer-XL by maintaining a fine-grained memory of past chunk activations, which are discarded in Transformer-XL. Technically, Luna can be adapted to a recurrence method, by simply using $P$ as an inherent memory module to maintain the recurrence across segments.
|
| 198 |
+
|
| 199 |
+
# 6 Conclusion
|
| 200 |
+
|
| 201 |
+
We have introduced Luna, a simple, efficient and effective linear attention mechanism used as a drop-in substitute for regular softmax attention. By introducing an extra input with the fixed length, Luna is capable of capturing adequate contextual information while performing attention operations linearly. On three sequence modeling tasks, i.e., long-context sequence modeling, neural machine translation, and large-scale pretraining and finetuning, Luna achieves comparable or even better performance than a variety of strong baselines, while acquiring prominent gains of efficiency in both speed and memory. In future work, we are interested in combining Luna with recurrence methods where $P$ can be used as a running memory across segments of inputs. Another interesting direction would be to apply Luna to other tasks with long input sequences, such as document-level summarization and translation.
|
| 202 |
+
|
| 203 |
+
# Acknowledgments and Disclosure of Funding
|
| 204 |
+
|
| 205 |
+
This material is based on research sponsored by Air Force Research Laboratory (AFRL) under agreement number FA8750-19-1-1000. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation therein. Xiang Kong was supported by U.S. DARPA AIDA Program No. FA8750-18-2-0014. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of Air Force Laboratory, DARPA or the U.S. Government.
|
| 206 |
+
|
| 207 |
+
# References
|
| 208 |
+
|
| 209 |
+
Joshua Ainslie, Santiago Ontanon, Chris Alberti, Vaclav Cvicek, Zachary Fisher, Philip Pham, Anirudh Ravula, Sumit Sanghai, Qifan Wang, and Li Yang. Etc: Encoding long and structured inputs in transformers. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 268–284, 2020.
|
| 210 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 211 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations (ICLR), 2015.
|
| 212 |
+
Iz Beltagy, Matthew E Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
|
| 213 |
+
Zihan Chen, Hongbo Zhang, Xiaoji Zhang, and Leqi Zhao. Quora question pairs. University of Waterloo, 2018.
|
| 214 |
+
Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
|
| 215 |
+
Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020.
|
| 216 |
+
Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). In International Conference on Learning Representations (ICLR), 2016.
|
| 217 |
+
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G Carbonell, Quoc Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2978–2988, 2019.
|
| 218 |
+
Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. In International Conference on Learning Representations (ICLR), 2018.
|
| 219 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, 2019.
|
| 220 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
|
| 221 |
+
Angela Fan, Pierre Stock, Benjamin Graham, Edouard Grave, Remi Gribonval, Herve Jegou, and Armand Joulin. Training with quantization noise for extreme fixed-point compression. arXiv preprint arXiv:2004.07320, 2020.
|
| 222 |
+
|
| 223 |
+
Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pages 315–323. JMLR Workshop and Conference Proceedings, 2011.
|
| 224 |
+
|
| 225 |
+
Aaron Gokaslan and Vanya Cohen. Openwebtext corpus. URl: https://skylion007. github. io/OpenWebTextCorpus, 2019.
|
| 226 |
+
|
| 227 |
+
Anirudh Goyal, Aniket Didolkar, Alex Lamb, Kartikeya Badola, Nan Rosemary Ke, Nasim Rahaman, Jonathan Binas, Charles Blundell, Michael Mozer, and Yoshua Bengio. Coordination among neural modules through a shared global workspace. arXiv preprint arXiv:2103.01197, 2021.
|
| 228 |
+
|
| 229 |
+
Ankit Gupta and Jonathan Berant. Gmat: Global memory augmentation for transformers. arXiv preprint arXiv:2006.03274, 2020.
|
| 230 |
+
|
| 231 |
+
Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning, pages 5156–5165. PMLR, 2020.
|
| 232 |
+
|
| 233 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
|
| 234 |
+
|
| 235 |
+
Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. arXiv preprint arXiv:2001.04451, 2020.
|
| 236 |
+
|
| 237 |
+
Alex Krizhevsky et al. Learning multiple layers of features from tiny images. Technical Report. University of Toronto, 2009.
|
| 238 |
+
|
| 239 |
+
Guokun Lai, Qizhe Xie, Hanxiao Liu, Yiming Yang, and Eduard Hovy. Race: Large-scale reading comprehension dataset from examinations. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 785–794, 2017.
|
| 240 |
+
|
| 241 |
+
Juho Lee, Yoonho Lee, Jungtaek Kim, Adam Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In International Conference on Machine Learning, pages 3744–3753. PMLR, 2019.
|
| 242 |
+
|
| 243 |
+
Drew Linsley, Junkyung Kim, Vijay Veerabadran, Charles Windolf, and Thomas Serre. Learning long-range spatial dependencies with horizontal gated recurrent units. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper/2018/file/ec8956637a99787bd197eacd77acce5e-Paper.pdf.
|
| 244 |
+
|
| 245 |
+
Peter J Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. Generating wikipedia by summarizing long sequences. In International Conference on Learning Representations (ICLR), 2018.
|
| 246 |
+
|
| 247 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 248 |
+
|
| 249 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019.
|
| 250 |
+
|
| 251 |
+
Xuezhe Ma. Apollo: An adaptive parameter-wise diagonal quasi-newton method for nonconvex stochastic optimization. arXiv preprint arXiv:2009.13586, 2020.
|
| 252 |
+
|
| 253 |
+
Andrew Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew Y Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies, pages 142–150, 2011.
|
| 254 |
+
|
| 255 |
+
Ali Madani, Bryan McCann, Nikhil Naik, Nitish Shirish Keskar, Namrata Anand, Raphael R Eguchi, Possu Huang, and Richard Socher. Progen: Language modeling for protein generation. bioRxiv, 2020.
|
| 256 |
+
|
| 257 |
+
Sebastian Nagel. Cc-news. URL: http://web. archive. org/save/http://commoncrawl. org/2016/10/newsdatasetavailable, 2016.
|
| 258 |
+
|
| 259 |
+
Nikita Nangia and Samuel Bowman. Listops: A diagnostic dataset for latent tree learning. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Student Research Workshop, pages 92–99, 2018.
|
| 260 |
+
|
| 261 |
+
Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. In Proceedings of the Third Conference on Machine Translation: Research Papers, pages 1–9, 2018.
|
| 262 |
+
|
| 263 |
+
Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL-HLT 2019: Demonstrations, 2019.
|
| 264 |
+
|
| 265 |
+
Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning, pages 4055–4064. PMLR, 2018.
|
| 266 |
+
|
| 267 |
+
Hao Peng, Nikolaos Pappas, Dani Yogatama, Roy Schwartz, Noah Smith, and Lingpeng Kong. Random feature attention. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $=$ QtTKTdVrFBB.
|
| 268 |
+
|
| 269 |
+
Jiezhong Qiu, Hao Ma, Omer Levy, Scott Wen-tau Yih, Sinong Wang, and Jie Tang. Blockwise self-attention for long document understanding. arXiv preprint arXiv:1911.02972, 2019.
|
| 270 |
+
|
| 271 |
+
Dragomir R Radev, Pradeep Muthukrishnan, Vahed Qazvinian, and Amjad Abu-Jbara. The acl anthology network corpus. Language Resources and Evaluation, 47(4):919–944, 2013.
|
| 272 |
+
|
| 273 |
+
Jack W Rae, Anna Potapenko, Siddhant M Jayakumar, Chloe Hillier, and Timothy P Lillicrap. Compressive transformers for long-range sequence modeling. In International Conference on Learning Representations (ICLR), 2020.
|
| 274 |
+
|
| 275 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383–2392, 2016.
|
| 276 |
+
|
| 277 |
+
Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. Efficient content-based sparse attention with routing transformers. Transactions of the Association for Computational Linguistics, 9:53–68, 2021.
|
| 278 |
+
|
| 279 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1715–1725, 2016.
|
| 280 |
+
|
| 281 |
+
Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Q-bert: Hessian based ultra low precision quantization of bert. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 8815–8821, 2020.
|
| 282 |
+
|
| 283 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { \Delta Y N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pages 1631–1642, 2013.
|
| 284 |
+
|
| 285 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2818–2826, 2016.
|
| 286 |
+
|
| 287 |
+
Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. Commonsenseqa: A question answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4149–4158, 2019.
|
| 288 |
+
|
| 289 |
+
Yi Tay, Dara Bahri, Liu Yang, Donald Metzler, and Da-Cheng Juan. Sparse sinkhorn attention. In International Conference on Machine Learning, pages 9438–9447. PMLR, 2020a.
|
| 290 |
+
|
| 291 |
+
Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey. arXiv preprint arXiv:2009.06732, 2020b.
|
| 292 |
+
|
| 293 |
+
Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long range arena : A benchmark for efficient transformers. In International Conference on Learning Representations, 2021. URL https: //openreview.net/forum?id=qVyeW-grC2k.
|
| 294 |
+
Trieu H Trinh and Quoc V Le. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847, 2018.
|
| 295 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998–6008, 2017.
|
| 296 |
+
Ashish Vaswani, Samy Bengio, Eugene Brevdo, Francois Chollet, Aidan Gomez, Stephan Gouws, Llion Jones, Łukasz Kaiser, Nal Kalchbrenner, Niki Parmar, et al. Tensor2tensor for neural machine translation. In Proceedings of the 13th Conference of the Association for Machine Translation in the Americas (Volume 1: Research Track), pages 193–199, 2018.
|
| 297 |
+
Qiang Wang, Bei Li, Tong Xiao, Jingbo Zhu, Changliang Li, Derek F Wong, and Lidia S Chao. Learning deep transformer models for machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1810–1822, 2019.
|
| 298 |
+
Sinong Wang, Belinda Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
|
| 299 |
+
Yingce Xia, Tianyu He, Xu Tan, Fei Tian, Di He, and Tao Qin. Tied transformers: Neural machine translation with shared encoder and decoder. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 5466–5473, 2019.
|
| 300 |
+
Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tieyan Liu. On layer normalization in the transformer architecture. In International Conference on Machine Learning, pages 10524–10533. PMLR, 2020.
|
| 301 |
+
Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In Proceedings of the IEEE international conference on computer vision, pages 19–27, 2015.
|
md/train/H1loF2NFwr/H1loF2NFwr.md
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EVALUATING THE SEARCH PHASE OF NEURAL ARCHITECTURE SEARCH
|
| 2 |
+
|
| 3 |
+
Kaicheng $\mathbf { V } \mathbf { u } ^ { * }$ Computer vision lab, EPFL kaicheng.yu@epfl.ch
|
| 4 |
+
|
| 5 |
+
Christian Sciuto∗†
|
| 6 |
+
Daskell
|
| 7 |
+
christian.sciuto@daskell.com
|
| 8 |
+
|
| 9 |
+
Martin Jaggi Machine learning and optimization lab, EPFL martin.jaggi@epfl.ch
|
| 10 |
+
|
| 11 |
+
Claudiu Musat
|
| 12 |
+
Swisscom Digital Lab
|
| 13 |
+
claudiu.musat@swisscom.com
|
| 14 |
+
|
| 15 |
+
# Mathieu Salzmann
|
| 16 |
+
|
| 17 |
+
Computer vision lab, EPFL mathieu.salzmann@epfl.ch
|
| 18 |
+
|
| 19 |
+
# ABSTRACT
|
| 20 |
+
|
| 21 |
+
Neural Architecture Search (NAS) aims to facilitate the design of deep networks for new tasks. Existing techniques rely on two stages: searching over the architecture space and validating the best architecture. NAS algorithms are currently compared solely based on their results on the downstream task. While intuitive, this fails to explicitly evaluate the effectiveness of their search strategies. In this paper, we propose to evaluate the NAS search phase. To this end, we compare the quality of the solutions obtained by NAS search policies with that of random architecture selection. We find that: (i) On average, the state-of-the-art NAS algorithms perform similarly to the random policy; (ii) the widely-used weight sharing strategy degrades the ranking of the NAS candidates to the point of not reflecting their true performance, thus reducing the effectiveness of the search process. We believe that our evaluation framework will be key to designing NAS strategies that consistently discover architectures superior to random ones.
|
| 22 |
+
|
| 23 |
+
# 1 INTRODUCTION
|
| 24 |
+
|
| 25 |
+
By automating the design of a neural network for the task at hand, Neural Architecture Search (NAS) has tremendous potential to impact the practicality of deep learning (Zoph & Le, 2017; Liu et al., 2018b;a; Tan et al., 2018; Baker et al., 2016), and has already obtained state-of-the-art performance on many tasks. A typical NAS technique (Zoph & Le, 2017; Pham et al., 2018; Liu et al., 2018a) has two stages: the search phase, which aims to find a good architecture, and the evaluation one, where the best architecture is trained from scratch and validated on the test data.
|
| 26 |
+
|
| 27 |
+
In the literature, NAS algorithms are typically compared based on their results in the evaluation phase. While this may seem intuitive, the search phase of these algorithms often differ in several ways, such as their architecture sampling strategy and the search space they use, and the impact of these individual factors cannot be identified by looking at the downstream task results only. Furthermore, the downstream task results are often reported for a single random seed, which leaves unanswered the question of robustness of the search strategies.
|
| 28 |
+
|
| 29 |
+
Table 1: Comparison of NAS algorithms with random sampling. We report results on PTB using mean validation perplexity (the lower, the better) and on CIFAR-10 using mean top 1 accuracy. We also provide the $p$ -value of Student’s t-tests against random sampling.
|
| 30 |
+
|
| 31 |
+
<table><tr><td></td><td>PTB (PPL)</td><td>t-test</td><td>CIFAR-10 (acc.)</td><td>t-test</td></tr><tr><td>ENAS</td><td>59.88 ± 1.92</td><td>0.73</td><td>96.79 ± 0.11</td><td>0.01</td></tr><tr><td>DARTS</td><td>60.61 ± 2.54</td><td>0.62</td><td>96.62 ± 0.23</td><td>0.20</td></tr><tr><td>NAO</td><td>61.99 ± 1.95</td><td>0.02</td><td>96.86 ± 0.17</td><td>0.00</td></tr><tr><td>Random</td><td>60.13± 0.65</td><td>:</td><td>96.44 ± 0.19</td><td>-</td></tr></table>
|
| 32 |
+
|
| 33 |
+
In this paper, we therefore propose to investigate the search phase of existing NAS algorithms in a controlled manner. To this end, we compare the quality of the NAS solutions with a random search policy, which uniformly randomly samples an architecture from the same search space as the NAS algorithms, and then trains it using the same hyper-parameters as the NAS solutions. To reduce randomness, the search using each policy, i.e., random and NAS ones, is repeated several times, with different random seeds.
|
| 34 |
+
|
| 35 |
+
We perform a series of experiments on the Penn Tree Bank (PTB) (Marcus et al., 1994a) and CIFAR10 (Krizhevsky et al., 2009) datasets, in which we compared the state-of-the-art NAS algorithms whose code is publicly available—DARTS (Liu et al., 2019b), NAO (Luo et al., 2018) and ENAS (Pham et al., 2018)—to our random policy. We reached the surprising conclusions that, as shown in Table 1, none of them significantly outperforms random sampling. Since the mean performance for randomlysampled architectures converges to the mean performance over the entire search space, we further conducted Welch Student’s t-tests (Welch, 1947), which reveal that, in RNN space, ENAS and DARTS cannot be differentiated from the mean of entire search space, while NAO yields worse performance than random sampling. While the situation is slightly better in CNN space, all three algorithms still perform similarly to random sampling. Note that this does not necessarily mean that these algorithms perform poorly, but rather that the search space has been sufficiently constrained so that even a random architecture in this space provides good results. To verify this, we experiment with search spaces where we can exhaustively evaluate all architectures, and observe that these algorithms truly cannot discover top-performing architectures.
|
| 36 |
+
|
| 37 |
+
In addition to this, we observed that the ranking by quality of candidate architectures produced by the NAS algorithms during the search does not reflect the true performance of these architectures in the evaluation phase. Investigating this further allowed us to identify that weight sharing (Pham et al., 2018), widely adopted to reduce the amount of required resources from thousands of GPU days to a single one, harms the individual networks’ performance. More precisely, using reduced search spaces, we make use of the Kendall Tau $\tau$ metric1 to show that the architecture rankings obtained with and without weight sharing are entirely uncorrelated in RNN space $\scriptstyle \tau = - 0 . 0 0 4$ over 10 runs); and have little correlation in the CNN space $\tau = 0 . 1 9 5$ over 10 runs). Since such a ranking is usually treated as training data for the NAS sampler in the search phase, this further explains the small margin between random search and the NAS algorithms. We also show that training samplers without weight sharing in CNN space surpasses random sampling by a significant margin.
|
| 38 |
+
|
| 39 |
+
In other words, we disprove the common belief that the quality of architectures trained with and without weight sharing is similar. We show that the difference in ranking negatively impacts the search phase of NAS algorithms, thus seriously impeding their robustness and performance.
|
| 40 |
+
|
| 41 |
+
In short, evaluating the search phase of NAS, which is typically ignored, allowed us to identify two key characteristics of state-of-the-art NAS algorithms: The importance of the search space and the negative impact of weight sharing. We believe that our evaluation framework will be instrumental in designing NAS search strategies that are superior to the random one. Our code is publicly available at https://github.com/kcyu2014/eval-nas.
|
| 42 |
+
|
| 43 |
+
# 2 RELATED WORK
|
| 44 |
+
|
| 45 |
+
Since its introduction in (Zoph & Le, 2017), NAS has demonstrated great potential to surpass the human design of deep networks for both visual recognition (Liu et al., 2018b; Ahmed & Torresani, 2018; Chen et al., 2018; Pérez-Rúa et al., 2018; Liu et al., 2019a) and natural language processing (Zoph & Le, 2017; Pham et al., 2018; Luo et al., 2018; Zoph et al., 2018; Liu et al., 2018b; Cai et al., 2018a). Existing search strategies include reinforcement learning (RL) samplers (Zoph & Le, 2017; Zoph et al., 2018; Pham et al., 2018), evolutionary algorithms (Xie & Yuille, 2017; Real et al., 2017; Miikkulainen et al., 2019; Liu et al., 2018b; Lu et al., 2018), gradient-descent (Liu et al., 2019b), bayesian optimization (Kandasamy et al., 2018; Jin et al., 2019; Zhou et al., 2019) and performance predictors (Liu et al., 2018a; Luo et al., 2018). Here, our goal is not to introduce a new search policy, but rather to provide the means to analyze existing ones. Below, we briefly discuss existing NAS methods and focus on how they are typically evaluated.
|
| 46 |
+
|
| 47 |
+
Neural architecture search with weight sharing. The potential of vanilla NAS comes with the drawback of requiring thousands of GPU hours even for small datasets, such as PTB and CIFAR-10.
|
| 48 |
+
|
| 49 |
+
Furthermore, even when using such heavy computational resources, vanilla NAS has to restrict the number of trained architectures from a total of $\mathrm { i 0 ^ { 9 } }$ to $1 0 ^ { 4 }$ , and increasing the sampler accuracy can only be achieved by increasing the resources.
|
| 50 |
+
|
| 51 |
+
ENAS (Pham et al., 2018) was the first to propose a training scheme with shared parameters, reducing the resources from thousands of GPU days to one. Instead of being trained from scratch each sampled model inherits the parameters from previously-trained ones. Since then, NAS research has mainly focused on two directions: 1) Replacing the RL sampler with a better search algorithm, such as gradient descent (Liu et al., 2019b), bayesian optimiziation (Zhou et al., 2019) and performance predictors (Luo et al., 2018); 2) Exploiting NAS for other applications, e.g., object detection (Ghiasi et al., 2019; Chen et al., 2019), semantic segmentation (Liu et al., 2019a), and finding compact networks (Cai et al., 2018b; Wu et al., 2018; Chu et al., 2019; Guo et al., 2019).
|
| 52 |
+
|
| 53 |
+
Characterizing the search space. Ying et al. (2019); Dong & Yang (2020) introduced a dataset that contains the ground-truth performance of CNN cells, and Wang et al. (2019) evaluated some traditional search algorithms on it. Similarly, Radosavovic et al. (2019) characterizes many CNN search spaces by computing the statistics of a set of sampled architectures, revealing that, for datasets such as CIFAR-10 or ImageNet, these statistics are similar. While these works support our claim that evaluation of NAS algorithms is crucial, they do not directly evaluate the state-of-the-arts NAS algorithms as we do here.
|
| 54 |
+
|
| 55 |
+
Evaluation of NAS algorithms. Typically, the quality of NAS algorithms is judged based on the results of the final architecture they produce on the downstream task. In other words, the search and robustness of these algorithms are generally not studied, with (Liu et al., 2019b; So et al., 2019) the only exception for robustness, where results obtained with different random seeds were reported. Here, we aim to further the understanding of the mechanisms behind the search phase of NAS algorithms. Specifically, we propose doing so by comparing them with a simple random search policy, which uniformly randomly samples one architecture per run in the same search space as the NAS techniques.
|
| 56 |
+
|
| 57 |
+
While some works have provided partial comparisons to random search, these comparisons unfortunately did not give a fair chance to the random policy. Specifically, (Pham et al., 2018) reports the results of only a single random architecture, and (Liu et al., 2018b) those of an architecture selected among 8 randomly sampled ones as the most promising one after training for 300 epochs only. Here, we show that a fair comparison to the random policy, obtained by training all architectures, i.e., random and NAS ones, for 1000 epochs and averaging over multiple random seeds for robustness, yields a different picture; the state-of-the-art search policies are no better than the random one.
|
| 58 |
+
|
| 59 |
+
The motivation behind this comparison was our observation of only a weak correlation between the performance of the searched architectures and the ones trained from scratch during the evaluation phase. This phenomenon was already noticed by Zela et al. (2018), and concurrently to our work by Li & Talwalkar (2019); Xie et al. (2019); Ying et al. (2019), but the analysis of its impact or its causes went no further. Here, by contrast, we link this difference in performance between the search and evaluation phases to the use of weight sharing.
|
| 60 |
+
|
| 61 |
+
While this may seem to contradict the findings of Bender et al. (2018), which, on CIFAR-10, observed a strong correlation between architectures trained with and without weight sharing when searching a CNN cell, our work differs from (Bender et al., 2018) in two fundamental ways: 1) The training scheme in (Bender et al., 2018), in which the entire model with shared parameters is trained via random path dropping, is fundamentally different from those used by state-of-the-arts weight sharing NAS strategies (Pham et al., 2018; Liu et al., 2019b; Luo et al., 2018); 2) While the correlation in (Bender et al., 2018) was approximated using a small subset of sampled architectures, we make use of a reduced search space where we can perform a complete evaluation of all architectures, thus providing an exact correlation measure in this space.
|
| 62 |
+
|
| 63 |
+
# 3 EVALUATING THE NAS SEARCH
|
| 64 |
+
|
| 65 |
+
In this section, we detail our evaluation framework for the NAS search phase. As depicted in Fig. 1(a,b), typical NAS algorithms consist of two phases:
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
Figure 1: Evaluating NAS. Existing frameworks consist of two phases: (a) The search phase, where a sampler is trained to convergence or a pre-defined stopping criterion; (b) The evaluation phase that trains the best model from scratch and evaluates it on the test data. Here, we argue that one should evaluate the search itself. To this end, as shown in (c), we compare the best architecture found by the NAS policy with a single uniformly randomly sampled architecture. For this comparison to be meaningful, we repeat it with different random seeds for both training the NAS sampler and our random search policy. We then report the mean and standard deviations over the different seeds.
|
| 69 |
+
|
| 70 |
+
Search: The goal of this phase is to find the best candidate architecture from the search space2. This is where existing algorithms, such as ENAS, DARTS and NAO, differ. Nevertheless, for all the algorithms, the search depends heavily on initialization. In all the studied policies, initialization is random and the outcome thus depends on the chosen random seed.
|
| 71 |
+
|
| 72 |
+
Evaluation: In this phase, all the studied algorithms retrain the best model found in the search phase. The retrained model is then evaluated on the test data.
|
| 73 |
+
|
| 74 |
+
The standard evaluation of NAS techniques focuses solely on the final results on the test data. Here, by contrast, we aim to evaluate the search phase itself, which truly differentiates existing algorithms.
|
| 75 |
+
|
| 76 |
+
To do this, as illustrated in Fig. 1(c), we establish a baseline; we compare the search phase of existing algorithms with a random search policy. An effective search algorithm should yield a solution that clearly outperforms the random policy. Below, we introduce our framework to compare NAS search algorithms with random search. The three NAS algorithms that we evaluated, DARTS (Liu et al., 2019b), NAO (Luo et al., 2018) and ENAS (Pham et al., 2018), are representative of the state of the art for different search algorithms: reinforcement learning, gradient-descent and performance prediction, and are discussed in Appendix C.
|
| 77 |
+
|
| 78 |
+
# 3.1 COMPARING TO RANDOM SEARCH
|
| 79 |
+
|
| 80 |
+
We implement our random search policy by simply assigning uniform probabilities to all operations. Then, for each node in the Directed Acyclic Graph (DAG) that is typically used to represent an architecture, we randomly sample a connection to one previous node from the resulting distributions.
|
| 81 |
+
|
| 82 |
+
An effective search policy should outperform the random one. To evaluate this, we compute the validation results of the best architecture found by the NAS algorithm trained from scratch, as well as those of a single randomly sampled architecture. Comparing these values for a single random seed would of course not provide a reliable measure. Therefore, we repeat this process for multiple random seeds used both during the search phase of the NAS algorithm and to sample one random architecture as described above. We then report the means and standard deviations of these results over the different seeds. Note that while we use different seeds for the search and random sampling, we always use the same seed when training the models from scratch during the evaluation phase.
|
| 83 |
+
|
| 84 |
+
Our use of multiple random seeds and of the same number of epochs for the NAS algorithms and for our random search policy makes the comparison fair. This contrasts with the comparisons performed in (Pham et al., 2018), where the results of only a single random architecture were reported, and in (Liu et al., 2019b), which selected a single best random architecture among an initial set of 8 after training for 300 epochs only. As shown in Appendix D.2, some models that perform well in the early training stages may yield worse performance than others after convergence. Therefore, choosing the best random architecture after only 300 epochs for PTB and 100 for CIFAR-10, and doing so for a single random seed, might not be representative of the general behavior.
|
| 85 |
+
|
| 86 |
+
# 3.2 SEARCH IN A REDUCED SPACE
|
| 87 |
+
|
| 88 |
+
Because of the size of standard search spaces, one cannot understand the quality of the search by fully evaluating all possible solutions. Hence, we propose to make use of reduced search spaces with ground-truth architecture performances available to evaluate the search quality. For RNNs, we simply reduce the number of nodes in the search space from 12 to 2. Given that each node is identified by two values, the ID of the incoming node and the activation function, the space has a cardinality $| S | = n ! * | \mathcal { O } | ^ { n }$ , where $n = 2$ nodes and $| \mathcal { O } | = 4$ operations, thus yielding 32 possible solutions. To obtain ground truth, we train all of these architectures individually. Each architecture is trained 10 times with a different seed, which therefore yields a mean and standard deviation of its performance. The mean value is used as ground truth—the actual potential of the given architecture. These experiments took around 5000 GPU hours.
|
| 89 |
+
|
| 90 |
+
For CNNs, we make use of NASBench-101 (Ying et al., 2019), a CNN graph-based search space with 3 possible operations, conv3x3, conv1x1 and max3x3. This framework defines search spaces with between 3 and 7 nodes, with 423,624 architectures in 7-node case. To the best of our knowledge, we are the first to evaluate the NAS methods used in this paper on NASBench.
|
| 91 |
+
|
| 92 |
+
# 4 EXPERIMENTAL RESULTS
|
| 93 |
+
|
| 94 |
+
To analyze the search phase of the three state-of-the-art NAS algorithms mentioned above, we first compare these algorithms to our random policy when using standard search spaces for RNNs on (PTB) and CNNs on CIFAR-10. Details about the experiment setting are in Appendix C.5. The surprising findings in this typical NAS use case prompted us to study the behavior of the search strategies in reduced search spaces. This allowed us to identify a factor that has a significant impact on the observed results: Weight sharing. We then quantify this impact on the ranking of the NAS candidates, evidencing that it dramatically affects the effectiveness of the search.
|
| 95 |
+
|
| 96 |
+
# 4.1 NAS COMPARISON IN A STANDARD SEARCH SPACE
|
| 97 |
+
|
| 98 |
+
Below, we compare DARTS (Liu et al., 2019b), NAO (Luo et al., 2018), ENAS (Pham et al., 2018) and BayesNAS (Zhou et al., 2019) with our random search policy, as discussed in Section 3.1. We follow (Liu et al., 2019b) to define an RNN search space of 12 nodes and a CNN ones of 7 nodes. For each of the four search policies, we run 10 experiments with a different initialization of the sampling policy. During the search phase, we used the authors-provided hyper-parameters and code for each policy. Once a best architecture is identified by the search phase, it is used for evaluation, i.e., we train the chosen architecture from scratch for 1000 epochs for RNN and 600 for CNN.
|
| 99 |
+
|
| 100 |
+
RNN Results. In Figure 2, we plot, on the left, the mean perplexity evolution over the 1000 epochs, obtained by averaging the results of the best architectures found using the 10 consecutive seeds.3 On the right, we show the perplexity evolution for the best cell of each strategy among the 10 different runs. Random sampling is robust and consistently competitive. As shown in Table 1, it outperforms on average the DARTS and NAO policies, and yields the overall best cell for these experiments with perplexity
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
Figure 2: Validation perplexity evolution in the 12-node RNN search space. (Best viewed in color)
|
| 104 |
+
|
| 105 |
+
of 57.60. Further training this cell for 4000 epochs, as in (Liu et al., 2019b), yields a perplexity of 55.93. The excellent performance of the random policy evidences the high expressiveness of the manually-constructed search space; even arbitrary policies in this space perform well, as evidenced by the relatively low standard deviation over the 10 seeds of the random architectures, shown in Table 1 and Figure 2(left).
|
| 106 |
+
|
| 107 |
+
CNN Results. In Table 2, we compare the NAS methods with our random policy in the search space of Liu et al. (2019b). We provide the accuracy reported in the original papers as well as the accuracy we reproduced using our implementation. Note that the NAS algorithms only marginally outperform random search, by less than $0 . 5 \%$ in top-1 accuracy. The best architecture was discovered by NAO, with an accuracy of $9 7 . 1 0 \%$ , again less than $0 . 5 \%$ higher than the randomly discovered one. Note that, our random sampling comes at no search cost. By contrast, Li & Talwalkar (2019) obtained an accuracy of $9 7 . 1 5 \%$ with a different random search policy having the same cost as DARTS.
|
| 108 |
+
|
| 109 |
+
Table 2: Top 1 accuracy in the 7-node DARTS Search space. We report the mean and best top-1 accuracy on the test sets of architectures found by DARTS, NAO, ENAS, BayesNAS, and our random policy. As sanity check, we also train from scratch the architectures reported in original papers, as well as their reported performance.
|
| 110 |
+
|
| 111 |
+
<table><tr><td></td><td colspan="2">Our seed</td><td colspan="2">Best reported result</td></tr><tr><td>Type</td><td>Mean test</td><td>Best test</td><td>Original</td><td>Reproduced</td></tr><tr><td>DARTS</td><td>96.62 ± 0.23</td><td>96.80</td><td>97.24</td><td>97.15</td></tr><tr><td>NAO</td><td>96.86 ± 0.17</td><td>97.10</td><td>96.47</td><td>96.92</td></tr><tr><td>ENAS</td><td>96.76 ± 0.10</td><td>96.95</td><td>96.46</td><td>96.87</td></tr><tr><td>BayesNAS</td><td>95.99 ± 0.25</td><td>96.41</td><td>97.19</td><td>97.13</td></tr><tr><td>Random</td><td>96.48 ± 0.18</td><td>96.74</td><td>97.15t</td><td></td></tr></table>
|
| 112 |
+
|
| 113 |
+
†Result took from Li & Talwalkar (2019)
|
| 114 |
+
|
| 115 |
+
# Observations:
|
| 116 |
+
|
| 117 |
+
• The evaluated state-of-the-art NAS algorithms do not surpass random search by a significant margin, and even perform worse in the RNN search space.
|
| 118 |
+
• The ENAS policy sampler has the lowest variance among the three tested ones. This shows that ENAS is more robust to the variance caused by the random seed of the search phase.
|
| 119 |
+
• The NAO policy is more sensitive to the search space; while it yields the best performance in CNN
|
| 120 |
+
space, it performs the worst in RNN one.
|
| 121 |
+
• The DARTS policy is very sensitive to random initialization, and yields the largest standard deviation across the 10 runs (2.54 in RNN and 0.23 in CNN space).
|
| 122 |
+
|
| 123 |
+
Such a comparison of search policies would not have been possible without our framework. Nevertheless, the above analysis does not suffice to identify the reason behind these surprising observations. As mentioned before, one reason could be that the search space has been sufficiently constrained so that all architectures perform similarly well. By contrast, if we assume that the search space does contain significantly better architectures, then we can conclude that these search algorithms truly fail to find a good one. To answer this question, we evaluate these methods in a reduced search space, where we can obtain the true performance of all possible architectures.
|
| 124 |
+
|
| 125 |
+
# 4.2 SEARCHING A REDUCED SPACE
|
| 126 |
+
|
| 127 |
+
The results in the previous section highlight the inability of the studied methods to surpass random search. Encouraged by these surprising results, we then dig deeper into their causes. Below, we make use of search spaces with fewer nodes, which we can explore exhaustively.
|
| 128 |
+
|
| 129 |
+
Reduced RNN space. We use the same search space as in Section 3.2 but reduce the number of intermediate nodes to 2. In Table 3 (A), we provide the results of searching the RNN 2-node space. Its smaller size allows us to exhaustively compute the results of all possible solutions, thus determining the upper bound for
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 3: Architectures discovered by NAS algorithms. We rank all 32 architectures in the reduced search space based on their performance of individual training, from left (best) to right (worst), and plot the best cell found by three NAS algorithms across the 10 random seeds.
|
| 133 |
+
|
| 134 |
+
this case. In Figure 3, we plot the rank of the top 1 architecture discovered by the three NAS algorithms for each of the 10 different runs.
|
| 135 |
+
|
| 136 |
+
Table 3: Results in reduced search spaces. For RNNs (A), We report the mean and best perplexity on the validation and test sets at the end of training the architectures found using DARTS, NAO, ENAS. For CNNs (B), we show the mean and best top-1 accuracy on the test set. Instead of running random sampling in the reduced space, we compute the probability of the best model found by each method to surpass the random one (details in Appendix A.2). The mean and best statistics of the entire search space are reported as Space.
|
| 137 |
+
|
| 138 |
+
<table><tr><td></td><td colspan="4">(A)RNN n=2(32) in PPL.</td><td colspan="4">(B) NASBench n=7(423K)</td></tr><tr><td>Type</td><td>Mean Valid</td><td>Mean Test</td><td>Best Valid</td><td>Best Test</td><td>Mean Acc.</td><td>Best Acc.</td><td>Best Rank</td><td>p(>random)</td></tr><tr><td>DARTS</td><td>71.29 ± 2.45</td><td>68.74 ± 2.42</td><td>68.05</td><td>65.55</td><td>92.21 ± 0.61</td><td>93.02</td><td>57079</td><td>0.24</td></tr><tr><td>NAO</td><td>68.66 ± 2.50</td><td>66.03 ± 2.40</td><td>66.22</td><td>63.59</td><td>92.59 ± 0.59</td><td>93.33</td><td>19552</td><td>0.62</td></tr><tr><td>ENAS</td><td>69.99 ±0.0</td><td>66.61 ± 0.0</td><td>69.99</td><td>66.61</td><td>91.83 ±0.42</td><td>92.54</td><td>96939</td><td>0.07</td></tr><tr><td>Space</td><td>69.69 ± 2.44</td><td>67.21 ± 2.52</td><td>65.38</td><td>62.63</td><td>90.93 ±5.84</td><td>95.06</td><td>-</td><td>1</td></tr></table>
|
| 139 |
+
|
| 140 |
+
We observe that: (i) All policies failed to find the architecture that actually performs best; (ii) The ENAS policy always converged to the same architecture. This further evidences the robustness of ENAS to the random seed; (iii) NAO performs better than random sampling on average because it keeps a ranking of architectures; (iv) DARTS never discovered a top-5 architecture.
|
| 141 |
+
|
| 142 |
+
Reduced CNN space. In Table 3 (B), we report the mean and best test top-1 accuracy over 10 different runs on the NASBench-101 7-node space. To assess the search performance, we also show the best architecture rank in the entire space. The best test accuracy found by these methods is 93.33, by NAO, which remains much lower than the ground-truth best of 95.06. In terms of ranking, the best rank of these methods across 10 runs is 19522, which is among the top $4 \%$ architectures and yields a probability of 0.62 to surpass a randomly-sampled one given the same search budget. Note that ENAS and DARTS only have $7 \%$ and $24 \%$ chance to surpass the random policy. See Appendix A.2 for the definition of this probability, and Appendix D.3 for detailed results.
|
| 143 |
+
|
| 144 |
+
NAO seems to constantly outperform random search in the reduced space. Nevertheless, the final architecture chosen by NAO is always one of the architectures from the initial pool, which were sampled uniformly randomly. This indicates that the ranking of NAO is not correctly updated throughout the search and that, in practice, in a reduced space, NAO is similar to random search.
|
| 145 |
+
|
| 146 |
+
# 4.3 IMPACT OF WEIGHT SHARING
|
| 147 |
+
|
| 148 |
+
Our previous experiments in reduced search spaces highlight that the ranking of the searched architectures does not reflect the ground-truth one. As we will show below, this can be traced back to weight sharing, which all the tested algorithms, and the vast majority of existing ones, rely on. To evidence this, we perform the following experiments:
|
| 149 |
+
|
| 150 |
+
Without WS: We make use of the reduced space, where we have the architecture’s real performance.
|
| 151 |
+
|
| 152 |
+
With WS: We train the architectures in parallel, using the weight sharing strategy employed in NAO and ENAS. As DARTS does not have discrete representations of the solutions during the search, the idea of solution ranking does not apply. During training, each mini-batch is given to an architecture uniformly sampled from the search space. We repeat the process 10 times, with 10 random seeds and train the shared weights for 1000 epochs for the RNN experiments and 200 epochs for the CNN ones. Note that, this approach is equivalent to Single Path One Shot (SPOS) (Guo et al., 2019). It guarantees equal expectations of the number of times each architecture is sampled, thus overcoming the bias due to unbalanced training resulting from ineffective sampling policies.
|
| 153 |
+
|
| 154 |
+
We then compute the correlation between the architecture rankings found with WS and the ground truth (i.e., the architectures trained independently). For each of the 10 runs of the weight sharing strategy, we evaluate the Kendall Tau metric (defined in Appendix A.1) of the final rankings with respect to the real averaged ranking.
|
| 155 |
+
|
| 156 |
+
RNN Results. In Figure 4(a), we depict the architecture performance obtained without WS (sorted in ascending order of average validation perplexity), and the corresponding performance with WS. In Figure 4(b), we show the rank difference, where the best and worst were found using the Kendall Tau metric, and show a concrete rank change example in Figure 4(c).
|
| 157 |
+
|
| 158 |
+

|
| 159 |
+
Figure 4: Rank disorder due to weight sharing in RNN reduced space. (a) We report the average and std over 10 different runs. Note that the rankings significantly differ between using (line plot) and not using WS (bar plot), showing the negative impact of this strategy. (b) We visualize from left to right, the best, worst and average cases, and show the corresponding Kendall Tau value. A change in ranking, indicated by the colors and numbers, is measured as the absolute position change between the WS ranking and the true one. For conciseness, we only show the top 10 architectures. (c) For example, in the average scenario, the 6-th best architecture is wrongly placed as the best one, as indicated by the red arrow.
|
| 160 |
+
|
| 161 |
+
CNN Results. We report the average Kendall tau across 10 different runs. Note that we sampled up to 200 architectures for each experiment and fully evaluated on the entire test set to use the test accuracy for ranking. The Kendall tau for search spaces from 3 to 7 nodes is, respectively, 0.441, 0.314, 0.214, 0.195. We also provide other statistics in Table 6 of Appendix D.3.
|
| 162 |
+
|
| 163 |
+
Table 4: Search results w/o weight sharing. We report results from ENAS ans NAO on NASBench with 7 nodes over 10 runs.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Type</td><td>Mean Acc.</td><td>Best Acc.</td><td>Best Rank</td><td>P(>random)</td></tr><tr><td>NAO</td><td>93.08 ± 0.71</td><td>94.11</td><td>3543</td><td>0.92</td></tr><tr><td>ENAS</td><td>93.54± 0.45</td><td>94.04</td><td>4610</td><td>0.90</td></tr></table>
|
| 166 |
+
|
| 167 |
+
Since NAO and ENAS intrinsically disentangle the training of shared weights and sampler, to further confirm the negative effect of weight sharing, we adapt these algorithms to use the architecture’s performance in the NASBench dataset to train their sampler. Table 4 evidences that, after removing weight sharing, both ENAS and NAO consistently discover a good architecture, as indicated by a small difference between the best over 10 runs and the mean performance. More interestingly, for the 7-node case, the best cell discovered $( 9 4 . 1 1 \%$ by NAO and $9 4 . 0 4 \%$ by ENAS) are more than $1 \%$ higher than the best cells found with weight sharing (93.33 and 92.54, respectively, in Table 3).
|
| 168 |
+
|
| 169 |
+
# Observations:
|
| 170 |
+
|
| 171 |
+
• The difference of architecture performance is not related to the use of different random seeds, as indicated by the error bars in Figure 4(a).
|
| 172 |
+
• WS never produces the true ranking, as evidenced by the Best case in Figure 4(b).
|
| 173 |
+
• The behavior of the WS rankings is greatly affected by changing the seed. In particular, the Kendall Tau for the plots in Figure 4(b) are $0 . 2 8 2 , - 0 . 0 0 4 , - 0 . 1 1 6$ for Best, Average and Worst.
|
| 174 |
+
For RNNs, the Kendall Tau are close to 0, which suggests a lack of correlation between the WS rankings and the true one. By contrast, for CNNs, the correlation is on average higher than for RNNs. This matches the observation in Section 4.1 that CNN results are generally better than RNN ones.
|
| 175 |
+
• In a reduced CNN space, the ranking disorder increases with the space complexity, i.e., this disorder is proportional to the amount of weight sharing.4
|
| 176 |
+
• If we train NAO and ENAS without weight sharing in NASBench, on average the performance is $1 \%$ higher than them with it. This further evidences that weight sharing negatively impacts the sampler, and with a good ranking, the sampler can be trained better. Furthermore, the probability to surpass random search increases from 0.62 to 0.92 for NAO and from 0.07 to 0.90 for ENAS.
|
| 177 |
+
|
| 178 |
+
Together with previous results, we believe that these results evidence the negative impact of weight sharing; it dramatically affects the performance of the sampled architectures, thus complicating the overall search process and leading to search policies that are no better than the random one.
|
| 179 |
+
|
| 180 |
+
# 5 CONCLUSION
|
| 181 |
+
|
| 182 |
+
In this paper, we have analyzed the effectiveness of the search phase of NAS algorithms via fair comparisons to random search. We have observed that, surprisingly, the search policies of state-ofthe-art NAS techniques are no better than random, and have traced the reason for this to the use of (i) a constrained search space and (ii) weight sharing, which shuffles the architecture ranking during the search, thus negatively impacting it.
|
| 183 |
+
|
| 184 |
+
In essence, our gained insights highlight two key properties of state-of-the-art NAS strategies, which had been overlooked in the past due to the single-minded focus of NAS evaluation on the results on the target tasks. We believe that this will be key to the development of novel NAS algorithms. In the future, we will aim to do so by designing relaxed weight sharing strategies.
|
| 185 |
+
|
| 186 |
+
# 6 ACKNOWLEDGEMENT
|
| 187 |
+
|
| 188 |
+
This work was supported in part by the Swiss National Science Foundation. We would also like to thank Rene Ranftl and Vladlen Koltun for the discussions and support.
|
| 189 |
+
|
| 190 |
+
# REFERENCES
|
| 191 |
+
|
| 192 |
+
Karim Ahmed and Lorenzo Torresani. Maskconnect: Connectivity learning by gradient descent. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 349–365, 2018.
|
| 193 |
+
|
| 194 |
+
Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. arXiv preprint arXiv:1611.02167, 2016.
|
| 195 |
+
|
| 196 |
+
Gabriel Bender, Pieter-Jan Kindermans, Barret Zoph, Vijay Vasudevan, and Quoc Le. Understanding and simplifying one-shot architecture search. In International Conference on Machine Learning, pp. 549–558, 2018.
|
| 197 |
+
|
| 198 |
+
Han Cai, Tianyao Chen, Weinan Zhang, Yong Yu, and Jun Wang. Efficient architecture search by network transformation. AAAI, 2018a.
|
| 199 |
+
|
| 200 |
+
Han Cai, Ligeng Zhu, and Song Han. ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware. arXiv:1812.00332 [cs, stat], December 2018b. URL http://arxiv. org/abs/1812.00332. arXiv: 1812.00332.
|
| 201 |
+
|
| 202 |
+
Liang-Chieh Chen, Maxwell Collins, Yukun Zhu, George Papandreou, Barret Zoph, Florian Schroff, Hartwig Adam, and Jon Shlens. Searching for efficient multi-scale architectures for dense image prediction. In Advances in Neural Information Processing Systems, pp. 8713–8724, 2018.
|
| 203 |
+
|
| 204 |
+
Yukang Chen, Tong Yang, Xiangyu Zhang, Gaofeng Meng, Chunhong Pan, and Jian Sun. DetNAS: Neural Architecture Search on Object Detection. arXiv:1903.10979 [cs], March 2019. URL http://arxiv.org/abs/1903.10979. arXiv: 1903.10979.
|
| 205 |
+
|
| 206 |
+
Xiangxiang Chu, Bo Zhang, Ruijun Xu, and Jixiang Li. FairNAS: Rethinking Evaluation Fairness of Weight Sharing Neural Architecture Search. arXiv:1907.01845 [cs, stat], July 2019. URL http://arxiv.org/abs/1907.01845. arXiv: 1907.01845.
|
| 207 |
+
|
| 208 |
+
Terrance DeVries and Graham W. Taylor. Improved Regularization of Convolutional Neural Networks with Cutout. arXiv:1708.04552 [cs], August 2017. URL http://arxiv.org/abs/1708. 04552. arXiv: 1708.04552.
|
| 209 |
+
|
| 210 |
+
Xuanyi Dong and Yi Yang. Nas-bench-102: Extending the scope of reproducible neural architecture search. In International Conference on Learning Representations, 2020. URL https:// openreview.net/forum?id=HJxyZkBKDr.
|
| 211 |
+
|
| 212 |
+
Golnaz Ghiasi, Tsung-Yi Lin, Ruoming Pang, and Quoc V. Le. NAS-FPN: Learning Scalable Feature Pyramid Architecture for Object Detection. arXiv:1904.07392 [cs], April 2019. URL http://arxiv.org/abs/1904.07392. arXiv: 1904.07392.
|
| 213 |
+
|
| 214 |
+
Zichao Guo, Xiangyu Zhang, Haoyuan Mu, Wen Heng, Zechun Liu, Yichen Wei, and Jian Sun. Single Path One-Shot Neural Architecture Search with Uniform Sampling. arXiv:1904.00420 [cs], March 2019. URL http://arxiv.org/abs/1904.00420. arXiv: 1904.00420.
|
| 215 |
+
|
| 216 |
+
Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
|
| 217 |
+
|
| 218 |
+
Haifeng Jin, Qingquan Song, and Xia Hu. Auto-keras: An efficient neural architecture search system. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1946–1956. ACM, 2019.
|
| 219 |
+
|
| 220 |
+
Kirthevasan Kandasamy, Willie Neiswanger, Jeff Schneider, Barnabas Poczos, and Eric P Xing. Neural architecture search with bayesian optimisation and optimal transport. In Advances in Neural Information Processing Systems, pp. 2016–2025, 2018.
|
| 221 |
+
|
| 222 |
+
Maurice G Kendall. A new measure of rank correlation. Biometrika, 30(1/2):81–93, 1938.
|
| 223 |
+
|
| 224 |
+
Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). 2009.
|
| 225 |
+
|
| 226 |
+
Liam Li and Ameet Talwalkar. Random search and reproducibility for neural architecture search. arXiv preprint arXiv:1902.07638, 2019.
|
| 227 |
+
|
| 228 |
+
Chenxi Liu, Barret Zoph, Maxim Neumann, Jonathon Shlens, Wei Hua, Li-Jia Li, Li Fei-Fei, Alan Yuille, Jonathan Huang, and Kevin Murphy. Progressive neural architecture search. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 19–34, 2018a.
|
| 229 |
+
|
| 230 |
+
Chenxi Liu, Liang-Chieh Chen, Florian Schroff, Hartwig Adam, Wei Hua, Alan Yuille, and Li FeiFei. Auto-DeepLab: Hierarchical Neural Architecture Search for Semantic Image Segmentation. arXiv:1901.02985 [cs], 2019a. URL http://arxiv.org/abs/1901.02985.
|
| 231 |
+
|
| 232 |
+
Hanxiao Liu, Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, and Koray Kavukcuoglu. Hierarchical representations for efficient architecture search. International Conference on Learning Representations (ICLR), Conference track, 2018b.
|
| 233 |
+
|
| 234 |
+
Hanxiao Liu, Karen Simonyan, and Yiming Yang. Darts: Differentiable architecture search. ICLR, 2019b.
|
| 235 |
+
|
| 236 |
+
Zhichao Lu, Ian Whalen, Vishnu Boddeti, Yashesh Dhebar, Kalyanmoy Deb, Erik Goodman, and Wolfgang Banzhaf. Nsga-net: A multi-objective genetic algorithm for neural architecture search. arXiv preprint arXiv:1810.03522, 2018.
|
| 237 |
+
|
| 238 |
+
Renqian Luo, Fei Tian, Tao Qin, En-Hong Chen, and Tie-Yan Liu. Neural architecture optimization. In Advances in neural information processing systems, 2018.
|
| 239 |
+
|
| 240 |
+
Mitchell Marcus, Grace Kim, Mary Ann Marcinkiewicz, Robert MacIntyre, Ann Bies, Mark Ferguson, Karen Katz, and Britta Schasberger. The penn treebank: Annotating predicate argument structure. In Proceedings of the Workshop on Human Language Technology, HLT ’94, pp. 114–119, Stroudsburg, PA, USA, 1994a. Association for Computational Linguistics. ISBN 1-55860-357-3. doi: 10.3115/1075812.1075835. URL https://doi.org/10.3115/1075812.1075835.
|
| 241 |
+
|
| 242 |
+
Mitchell Marcus, Grace Kim, Mary Ann Marcinkiewicz, Robert MacIntyre, Ann Bies, Mark Ferguson, Karen Katz, and Britta Schasberger. The penn treebank: Annotating predicate argument structure. In Proceedings of the Workshop on Human Language Technology, pp. 114–119. Association for Computational Linguistics, 1994b.
|
| 243 |
+
|
| 244 |
+
Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and optimizing lstm language models. arXiv preprint arXiv:1708.02182, 2017.
|
| 245 |
+
|
| 246 |
+
Risto Miikkulainen, Jason Liang, Elliot Meyerson, Aditya Rawal, Daniel Fink, Olivier Francon, Bala Raju, Hormoz Shahrzad, Arshak Navruzyan, Nigel Duffy, et al. Evolving deep neural networks. In Artificial Intelligence in the Age of Neural Networks and Brain Computing, pp. 293–312. Elsevier, 2019.
|
| 247 |
+
|
| 248 |
+
Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th international conference on machine learning (ICML-10), pp. 807–814, 2010.
|
| 249 |
+
|
| 250 |
+
Juan-Manuel Pérez-Rúa, Moez Baccouche, and Stephane Pateux. Efficient progressive neural architecture search. arXiv preprint arXiv:1808.00391, 2018.
|
| 251 |
+
|
| 252 |
+
Hieu Pham, Melody Y Guan, Barret Zoph, Quoc V Le, and Jeff Dean. Efficient neural architecture search via parameter sharing. ICML, 2018.
|
| 253 |
+
|
| 254 |
+
Ilija Radosavovic, Justin Johnson, Saining Xie, Wan-Yen Lo, and Piotr Dollár. On Network Design Spaces for Visual Recognition. In International Conference on Computer Vision, May 2019.
|
| 255 |
+
|
| 256 |
+
Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Jie Tan, Quoc Le, and Alex Kurakin. Large-scale evolution of image classifiers. arXiv preprint arXiv:1703.01041, 2017.
|
| 257 |
+
|
| 258 |
+
David R. So, Chen Liang, and Quoc V. Le. The evolved transformer. In ICML, 2019.
|
| 259 |
+
|
| 260 |
+
Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, and Quoc V Le. Mnasnet: Platform-aware neural architecture search for mobile. arXiv preprint arXiv:1807.11626, 2018.
|
| 261 |
+
|
| 262 |
+
Linnan Wang, Yiyang Zhao, Yuu Jinnai, Yuandong Tian, and Rodrigo Fonseca. AlphaX: eXploring Neural Architectures with Deep Neural Networks and Monte Carlo Tree Search. arXiv preprint arXiv:1903.11059, 2019.
|
| 263 |
+
|
| 264 |
+
Bernard L Welch. The generalization ofstudent’s’ problem when several different population variances are involved. Biometrika, 34(1/2):28–35, 1947.
|
| 265 |
+
|
| 266 |
+
Bichen Wu, Xiaoliang Dai, Peizhao Zhang, Yanghan Wang, Fei Sun, Yiming Wu, Yuandong Tian, Peter Vajda, Yangqing Jia, and Kurt Keutzer. FBNet: Hardware-Aware Efficient ConvNet Design via Differentiable Neural Architecture Search. arXiv:1812.03443 [cs], December 2018. URL http://arxiv.org/abs/1812.03443. arXiv: 1812.03443.
|
| 267 |
+
|
| 268 |
+
L. Xie and A. Yuille. Genetic cnn. IEEE International Conference on Computer Vision (ICCV), 2017.
|
| 269 |
+
|
| 270 |
+
Saining Xie, Alexander Kirillov, Ross Girshick, and Kaiming He. Exploring randomly wired neural networks for image recognition. arXiv preprint arXiv:1904.01569, 2019.
|
| 271 |
+
|
| 272 |
+
Zhilin Yang, Zihang Dai, Ruslan Salakhutdinov, and William W Cohen. Breaking the softmax bottleneck: A high-rank rnn language model. arXiv preprint arXiv:1711.03953, 2017.
|
| 273 |
+
|
| 274 |
+
Chris Ying, Aaron Klein, Esteban Real, Eric Christiansen, Kevin Murphy, and Frank Hutter. Nasbench-101: Towards reproducible neural architecture search. arXiv preprint arXiv:1902.09635, 2019.
|
| 275 |
+
|
| 276 |
+
Arber Zela, Aaron Klein, Stefan Falkner, and Frank Hutter. Towards automated deep learning: Efficient joint neural architecture and hyperparameter search. ICML AutoML Workshop, 2018.
|
| 277 |
+
|
| 278 |
+
Hongpeng Zhou, Minghao Yang, Jun Wang, and Wei Pan. Bayesnas: A bayesian approach for neural architecture search. In ICML, 2019.
|
| 279 |
+
|
| 280 |
+
Barret Zoph and Quoc V. Le. Neural Architecture Search with Reinforcement Learning. International Conference on Learning Representations (ICLR), Conference track, 2017.
|
| 281 |
+
|
| 282 |
+
Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8697–8710, 2018.
|
| 283 |
+
|
| 284 |
+
# A METRICS TO EVALUATE NAS ALGORITHMS
|
| 285 |
+
|
| 286 |
+
A.1 KENDALL TAU METRIC
|
| 287 |
+
|
| 288 |
+
As a correlation measure, we make use of the Kendall Tau $( \tau )$ metric (Kendall, 1938): a number in the range [-1, 1] with the following properties:
|
| 289 |
+
|
| 290 |
+
• $\tau = - 1$ : Maximum disagreement. One ranking is the opposite of the other.
|
| 291 |
+
· $\tau = 1$ : Maximum agreement. The two rankings are identical.
|
| 292 |
+
• $\tau$ close to 0: A value close to zero indicates the absence of correlation.
|
| 293 |
+
|
| 294 |
+
# A.2 PROBABILITY TO SURPASS RANDOM SEARCH
|
| 295 |
+
|
| 296 |
+
As discussed in Section 3.2, the goal of NASBench is to search for a CNN cell with up to 7 nodes and 3 operations, resulting in total 423,624 architectures. Each architecture is trained 3 times with different random initialization up to 108 epochs on the CIFAR-10 training set, and evaluated on the test split. Hence, the average test accuracy of these runs can be seen as the ground-truth performances. In our experiments, we use this to rank the architectures, from 1 (highest accuracy) to 423,624. Given the best architecture’s rank $r$ after $n$ runs, and maximum rank $r _ { m a x }$ equals to the total number of architectures, the probability that the best architecture discovered is better than a randomly searched one given the same budget is given by
|
| 297 |
+
|
| 298 |
+
$$
|
| 299 |
+
p = 1 - ( 1 - ( r / r _ { m a x } ) ) ^ { n } .
|
| 300 |
+
$$
|
| 301 |
+
|
| 302 |
+
We use this as a new metric to evaluate the search phase.
|
| 303 |
+
|
| 304 |
+
# B NAS SEARCH SPACE REPRESENTATION
|
| 305 |
+
|
| 306 |
+
As discussed in the main paper, our starting point is a neural search space for a neural architecture, as illustrated in Figure 5. A convolutional cell can be represented with a similar topological structures. Following common practice in NAS (Zoph & Le, 2017), a candidate architecture sampled from this space connects the input and the output nodes through a sequence of intermediary ones. Each node is connected to others and has an operation attached to it.
|
| 307 |
+
|
| 308 |
+
A way of representing this search space (Pham et al., 2018; Luo et al., 2018), depicted in Figure 5(b), is by using strings. Each character in the string indicates either the node ID that the current node is connected to, or the operation selected for the current node. Operations include the identity, sigmoid, tanh and ReLU (Nair & Hinton, 2010).
|
| 309 |
+
|
| 310 |
+
Following the alternative way introduced in (Liu et al., 2019b), we make use of a vectorized representation of these strings. More specifically, as illustrated by Figure 5(c), a node ID, resp. an operation, is encoded as a vector of probabilities over all node IDs, resp. all operations. For instance, the connection between nodes $i$ and $j$ is represented as $\begin{array} { r } { y ^ { ( i , j ) } ( x ) = \sum _ { o \in \mathcal { O } } p _ { o } o ( x ) } \end{array}$ , with $\mathcal { O }$ the set of all operations, and $p _ { o } =$ softmax $\begin{array} { r } { \mathrm { \Pi } \cdot ( \alpha _ { o } ) = \exp ( \alpha _ { o } ) / \sum _ { o ^ { \prime } \in \mathcal { O } } \exp ( \alpha _ { o ^ { \prime } } ) } \end{array}$ the probability of each operation.
|
| 311 |
+
|
| 312 |
+
# C NAS ALGORITHMS
|
| 313 |
+
|
| 314 |
+
Here, we discuss the three state-of-the-art NAS algorithms used in our experiments in detail, including their hyper-parameters during the search phase. The current state-of-the-arts NAS on CIFAR-10 is ProxylessNAS (Cai et al., 2018b) with a top-1 accuracy of 97.92. However, this algorithm inherits the sampler from ENAS and DARTS, but with a different objective function, backbone model, and search space. In addition, the code is not publicly available, which precludes us from directly evaluating it.
|
| 315 |
+
|
| 316 |
+
# C.1 ENAS
|
| 317 |
+
|
| 318 |
+
adopts a reinforcement learning sampling strategy that is updated with the REINFORCE algorithm. The sampler is implemented as a two-layer LSTM Hochreiter & Schmidhuber (1997) and generates a sequence of strings. In the training process, each candidate sampled by the ENAS controller is trained on an individual mini-batch. At the end of each epoch, the controller samples new architectures that are evaluated on a single batch of the validation dataset. After this, the controller is updated accordingly using these validation metrics. We refer the reader to (Pham et al., 2018) for details about the hyper-parameter settings.
|
| 319 |
+
|
| 320 |
+

|
| 321 |
+
Figure 5: Search space of NAS algorithms. Typically, the search space is encoded as (a) a directed acyclic graph, and an architecture can be represented as (b) a string listing the node ID that each node is connected to, or the operation ID employed by each node. (c) An alternatively representation is a list of vectors $\alpha$ of siz e n(n+1)2 |O|, where n is the number of nodes and O is the set of all operations. Each vector, $\alpha ^ { ( i , j ) }$ , captures, via a softmax, the probability $p _ { o }$ that operation $o$ is employed between node $i$ and $j$ . Note that any node only takes one incoming edge, thus (b) and (c) represent the same search space and only differs in its formality.
|
| 322 |
+
|
| 323 |
+
# C.2 DARTS
|
| 324 |
+
|
| 325 |
+
It vectorizes the aforementioned strings as discussed in Section B and shown in Fig. 5(c). The sampling process is then parameterized by the vector $\alpha$ , which is optimized via gradient-descent in a dual optimization scheme: The architecture is first trained while fixing $\alpha$ , and $\alpha$ is then updated while the network is fixed. This process is repeated in an alternating manner. In the evaluation phase, DARTS samples the top-performing architecture by using the trained $\alpha$ vector as probability prior, i.e., the final model is not a soft average of all paths but one path in the DAG, which makes its evaluation identical to that of the other NAS algorithms. Note that we use the same hyper-parameters as in the released code of Liu et al. (2019b).
|
| 326 |
+
|
| 327 |
+
# C.3 NAO
|
| 328 |
+
|
| 329 |
+
It implements a gradient-descent algorithm, but instead of vectorizing the strings as in DARTS, it makes use of a variational auto-encoder (VAE) to learn a latent representation of the candidate architectures. Furthermore, it uses a performance predictor, which takes a latent vector as input to predict the corresponding architecture performance. In short, the search phase of NAO consists of first randomly sampling an initial pool of architectures and training them so as to obtain a ranking. This ranking is then used to train the encoder-predictor-decoder network, from which new candidates are sampled, and the process is repeated in an iterative manner. The best architecture is then taken as the top-1 in the NAO ranking. We directly use the code released by Luo et al. (2018).
|
| 330 |
+
|
| 331 |
+
# C.4 BAYESNAS
|
| 332 |
+
|
| 333 |
+
Bayesian optimization was first introduced to the neural architecture search field by Kandasamy et al. (2018) and Jin et al. (2019). We chose to evaluate BayesNAS (Zhou et al., 2019) because it is more recent than Auto-Keras (Jin et al., 2019) and than the work of Kandasamy et al. (2018), and because these two works use different search spaces than DARTS, resulting in models with significantly worse performance than DARTS. BayesNAS adopts Bayesian optimization to prune the fully-connected DAG graph using the shared weights to obtain accuracy metrics. The search space follows that of DARTS (Liu et al., 2019b) with minor modifications in connections, but exactly the same operations. Please see (Zhou et al., 2019) for more details. Note that BayesNAS was only implemented in CNN space. We use the search and model code released by Zhou et al. (2019) with our training pipeline, since the authors did not release the training code.
|
| 334 |
+
|
| 335 |
+
# C.5 EXPERIMENTAL SETUP
|
| 336 |
+
|
| 337 |
+
Following common practice in NAS, we make use of the word-level language modeling Penn Tree Bank (PTB) dataset (Marcus et al., 1994b) and of the image classification CIFAR-10 dataset (Krizhevsky et al., 2009). For these datasets, the goals are, respectively, finding a recurrent cell that correctly predicts the next word given the input sequence, and finding a convolutional cell that maximizes the classification accuracy. The quality of a candidate is then evaluated using the perplexity metric and top-1 accuracy, respectively.
|
| 338 |
+
|
| 339 |
+
In the evaluation phase, we always use the same model backbone and parameter initialization for all searched architectures, which ensures fairness and reflects the empirical observation that the searched models are insensitive (accuracy variations of less than 0.002 (Liu et al., 2019b)) to initialization during evaluation. For our RNN comparisons, we follow the procedure used in (Liu et al., 2019b; Pham et al., 2018; Luo et al., 2018) for the final evaluation, consisting of keeping the connections found for the best architecture in the search phase but increasing the hidden state size (to 850 in practice), so as to increase capacity. Furthermore, when training an RNN architecture from scratch, we follow (Yang et al., 2017; Merity et al., 2017) and first make the use of standard SGD to speed up training, and then change to average SGD to improve convergence. For all CNN architectures, we use RMSProp for fast optimization (Ying et al., 2019) and enable auxiliary head and cut-out (DeVries & Taylor, 2017) to boost the performance as in Liu et al. (2019b).
|
| 340 |
+
|
| 341 |
+
# C.6 ADAPTATION TO REDUCED SEARCH SPACE
|
| 342 |
+
|
| 343 |
+
When changing to reduced search spaces, we adapted the evaluated search algorithms to achieve the best performance. Below, we describe these modifications.
|
| 344 |
+
|
| 345 |
+
# RNN reduced space
|
| 346 |
+
|
| 347 |
+
• For DARTS, no changes are needed except modifying the number of nodes in the search space. For NAO, to mimic the behavior of the algorithm in the space of 12 nodes, we randomly sample $20 \%$ of the possible architectures to define the initial candidate pool. We train the encoderpredictor-decoder network for 250 iterations every 50 epochs using the top-4 architectures in the NAO ranking. At each search iteration, we sample at most 3 new architectures to be added to the pool. The rest of the search logic remains unchanged. For ENAS, we reduce the number of architectures sampled in one epoch to 20 and increase the number of batches to 10 for each architecture. All other hyper-parameters are unchanged.
|
| 348 |
+
|
| 349 |
+
# CNN reduced space
|
| 350 |
+
|
| 351 |
+
For DARTS, again, no changes are needed except modifying the number of nodes in the search space.
|
| 352 |
+
• For NAO, since the topology of the NASBench space is very similar to the original search space, we kept most of the parameters unchanged, but only change the embedding size of the encoder proportionally to the number of nodes $1 2 \times { \mathrm { n o d e } } - 1 2$ ).
|
| 353 |
+
• For ENAS, we set the LSTM sampler size to 64 and keep the temperature as 5.0. The number of aggregation step of each sampler training is set to 10.
|
| 354 |
+
|
| 355 |
+
# D SUPPLEMENTARY EXPERIMENTS
|
| 356 |
+
|
| 357 |
+
We provide additional experiments to support our claims.
|
| 358 |
+
|
| 359 |
+
# D.1 INFLUENCE OF THE AMOUNT OF SHARING
|
| 360 |
+
|
| 361 |
+
Depending on the active connections in the DAG, different architectures are subject to different amounts of weight sharing. In Figure 6 (a), let us consider the 3-node case, with node 1 and node 2 fixed and node 3 having node 1 as incoming node. In this scenario, the input to node 3 can be either directly node 0 (i.e., the input), or node 1, or node 2. In the first case, the only network parameters that the output of node 3 depends on are the weights of its own operation. In the second and third cases, however, the output further depends on the parameters of node 1, and of nodes 1 and 2, respectively.
|
| 362 |
+
|
| 363 |
+

|
| 364 |
+
Figure 6: A toy search space to assess the influence of weight sharing in RNN space. (a) Top: the reduced space. (a) Bottom: The amount of sharing depends on the activated path. (b) Ranking obtained from weight sharing training, that best ranked architectures has weight matrix to share.
|
| 365 |
+
|
| 366 |
+
To study the influence of the amount of sharing on the architecture ranking, we performed an experiment where we fixed the first two nodes and only searched for the third one. This represents a space of 12 architectures (3 possible connections to node $3 \times 4$ operations). We train them using the same setting in Section 4.3. The ranking of the 12 architectures is shown in Figure 6 (b), where color indicates the number of shared weight matrices, that is, matrices of nodes 1 and 2 also used in the search for node 3. Note that the top-performing architectures do not share any weights and that the more weights are shared, the worse the architecture performs.
|
| 367 |
+
|
| 368 |
+
In CNN space, we conduct a similar experiment in NASBench. With total node equals to 6, we only permute the last node operation and connection to one of the previous nodes. In short, we will have a total 4 connection possibility and 3 operation choices, in total 12 architectures. We compute the Kendall Tau among the architectures with the same connection but different operations, and the results are reported in Table 5. Clearly, the correlation of architectures decrease while the weight sharing matrices increase.
|
| 369 |
+
|
| 370 |
+
Table 5: Ranking disorder of weight sharing in CNN.
|
| 371 |
+
|
| 372 |
+
<table><tr><td>#of shared matrix</td><td>0</td><td>1</td><td>2</td><td>3</td></tr><tr><td>Kendall Tau T</td><td>0.67.</td><td>0.33</td><td>-0.33</td><td>0.0</td></tr></table>
|
| 373 |
+
|
| 374 |
+
# D.2 RANDOM SAMPLING COMPARISON
|
| 375 |
+
|
| 376 |
+
As discussed before, the random policy in (Liu et al., 2019b) samples 8 architectures, and picks the best after training them for 300 epochs independently. It might seem contradictory that DARTS outperforms this random policy, but cannot surpass the much simpler one designed in our paper, which only randomly samples 10 architectures (1 per random seed), trains them to convergence and picks the best. However, the random policy in DARTS relies on the assumption that a model that performs well in the early training stage will remain effective until the end of training. While this may sound intuitive, we observed a different picture with our reduced search space.
|
| 377 |
+
|
| 378 |
+
Since we obtained the ground-truth performance ranking, as discussed in Section 4.2 of the main paper, in Figure 7, we plot the evolution of models’ rank while training proceeds, based on the average validation perplexity over 10 runs. Clearly, there are significant variations during training: Good models in early stages drop lower in the ranking towards the end. As such, there is a non-negligible chance that the random policy in DARTS picks a model whose performance will be sub-optimal. We therefore believe that our policy that simply samples one model and trains it until convergence yields a more fair baseline. Furthermore, the fact that we perform our comparison using 10 random seeds, for both our approach and the NAS algorithms, vs a single one in (Liu et al., 2019b) makes our conclusions more reliable.
|
| 379 |
+
|
| 380 |
+

|
| 381 |
+
Figure 7: Rank changes while training. Each line represents the evolution of the rank of a single architecture. The models are sorted based on their test performance after 1000 epochs, with the bestperforming one at the top. The curves were averaged over 10 runs. They correspond to the experiment in Section 4.2. The vertical dashed lines indicate the epoch number where random sampling was performed, either by the random policy in Liu et al. (2019b), or by ours.
|
| 382 |
+
|
| 383 |
+
Table 6: Comparison of state-of-the-art methods on NASBench-101 search space.
|
| 384 |
+
|
| 385 |
+
<table><tr><td>Search Space</td><td colspan="10">NASBench-101 on CIFAR-10.n: number of nodes,(x):total architecture choices,mean and best:top 1 acuracy (in %)</td><td></td><td></td><td></td></tr><tr><td></td><td colspan="3"></td><td colspan="3">n = 5 (2.5K)</td><td colspan="3">n =6 (64K)</td><td colspan="3">n = 7 (423K)</td><td>Best of</td></tr><tr><td>Method</td><td>Mean</td><td>n = 4 (91) Best</td><td>K-T</td><td>Mean</td><td>Best</td><td>K-T</td><td>Mean</td><td>Best</td><td>K-T</td><td>Mean</td><td>Best</td><td>K-T</td><td>all n</td></tr><tr><td>Samplingmethods,train sampler during training super-net</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ENAS</td><td>89.41±3.54</td><td>92.95</td><td>=</td><td>89.03 ± 2.76</td><td>91.84</td><td></td><td>91.41 ± 1.42</td><td>92.75</td><td></td><td>91.83 ± 0.42</td><td>92.54</td><td></td><td>93.69</td></tr><tr><td>NAO</td><td>92.87 ± 0.69</td><td>93.88</td><td>=</td><td>92.07 ± 1.14</td><td>93.97</td><td></td><td>92.83 ±0.78</td><td>93.62</td><td></td><td>92.59± 0.59</td><td>93.33</td><td></td><td>93.97</td></tr><tr><td>DARTS FBNET</td><td>91.54 ± 1.93</td><td>93.71</td><td></td><td>91.82 ± 1.10</td><td>93.63</td><td>=</td><td>91.12 ± 1.86</td><td>93.92</td><td>=</td><td>92.21 ± 0.61</td><td>93.02</td><td></td><td>93.92</td></tr><tr><td></td><td>91.56 ± 1.89</td><td>93.71</td><td>-</td><td>92.51 ± 1.51</td><td>93.90</td><td>=</td><td>91.76 ± 1.26</td><td>92.98</td><td></td><td>92.29 ± 1.25</td><td>93.98</td><td></td><td>93.98</td></tr><tr><td colspan="10">One-shotmethods,train sampler after optimizing super-net</td><td></td><td></td><td></td><td></td></tr><tr><td>SPOS</td><td>91.14 ± 3.47</td><td>94.24</td><td>0.441</td><td>91.53 ± 1.76</td><td>93.72</td><td>0.314</td><td>90.56 ± 1.03</td><td>92.29</td><td>0.214</td><td>89.85 ± 3.80</td><td>93.84</td><td>0.195</td><td>94.24</td></tr><tr><td>FAIRNAS</td><td>89.08 ± 4.35</td><td>94.13</td><td>-0.043</td><td>91.38 ± 1.44</td><td>93.55</td><td>-0.028</td><td>91.75 ± 2.20</td><td>94.47</td><td>-0.221</td><td>91.10 ± 1.84</td><td>93.55</td><td>-0.232</td><td>94.47</td></tr></table>
|
| 386 |
+
|
| 387 |
+
# D.3 NASBENCH DETAILED RESULTS.
|
| 388 |
+
|
| 389 |
+
We provide additional evaluations on the NASBench dataset to benchmark the performance of the state-of-the-art NAS algorithms. In addition to the three methods in the main paper, we reimplemented some recent algorithms, such as FBNet (Wu et al., 2018), Single Path One Shot (SPOS) (Guo et al., 2019), and FairNAS (Chu et al., 2019). Note that we removed the FBNet device look-up table and model latency from the objective function since the search for a mobile model is not our primary goal. This also makes it comparable with the other baselines.
|
| 390 |
+
|
| 391 |
+
To ensure fairness, after the search phase is completed, each method trains the top 1 architectures found by its policy from scratch to obtain ground-truth performance; we repeated all the experiments with 10 random seeds. We report the mean and best top 1 accuracy in Table 6 for a number of nodes $n \in [ 4 , 7 ]$ , and the Kendall Tau (K-T) values for one-shot methods following Section 4.2 in the paper.
|
| 392 |
+
|
| 393 |
+
From the results, we observe that: 1) Sampling-based NAS strategies always have better mean accuracy with lower standard deviation, meaning that they converge to a local minimum more easily but do not exploit the entire search space. 2) By contrast, one-shot methods explore more diverse solutions, thus having larger standard deviations but lower means, but are able to pick a better architecture than sampling-based strategies (94.47 for FairNAS and 94.24 for SPOS, vs best of sampler based FBNet 93.98). 3) ENAS constantly improves as the number of nodes increases. 4) FBNet constantly outperforms DARTS, considering the similarity, using Gumbel Softmax seems a better choice. 5) The variance of these algorithms is large and sensitive to initialization. 6) Even one-shot algorithms cannot find the overall best architecture with accuracy 95.06.
|
md/train/H1uR4GZRZ/H1uR4GZRZ.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# STOCHASTIC ACTIVATION PRUNING FOR ROBUST ADVERSARIAL DEFENSE
|
| 2 |
+
|
| 3 |
+
Guneet S. Dhillon1,2, Kamyar Azizzadenesheli3, Zachary C. Lipton $^ { 1 , 4 }$ ,
|
| 4 |
+
Jeremy Bernstein1,5, Jean Kossaifi1,6, Aran Khanna1, Anima Anandkumar1,5
|
| 5 |
+
1Amazon AI, 2UT Austin, 3UC Irvine, 4CMU, 5Caltech, 6Imperial College London
|
| 6 |
+
guneetdhillon@utexas.edu, kazizzad@uci.edu, zlipton@cmu.edu, bernstein@caltech.edu, jean.kossaifi@imperial.ac.uk, aran@arankhanna.com, anima@amazon.com
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
Neural networks are known to be vulnerable to adversarial examples. Carefully chosen perturbations to real images, while imperceptible to humans, induce misclassification and threaten the reliability of deep learning systems in the wild. To guard against adversarial examples, we take inspiration from game theory and cast the problem as a minimax zero-sum game between the adversary and the model. In general, for such games, the optimal strategy for both players requires a stochastic policy, also known as a mixed strategy. In this light, we propose Stochastic Activation Pruning (SAP), a mixed strategy for adversarial defense. SAP prunes a random subset of activations (preferentially pruning those with smaller magnitude) and scales up the survivors to compensate. We can apply SAP to pretrained networks, including adversarially trained models, without fine-tuning, providing robustness against adversarial examples. Experiments demonstrate that SAP confers robustness against attacks, increasing accuracy and preserving calibration.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
While deep neural networks have emerged as dominant tools for supervised learning problems, they remain vulnerable to adversarial examples (Szegedy et al., 2013). Small, carefully chosen perturbations to input data can induce misclassification with high probability. In the image domain, even perturbations so small as to be imperceptible to humans can fool powerful convolutional neural networks (Szegedy et al., 2013; Goodfellow et al., 2014). This fragility presents an obstacle to using machine learning in the wild. For example, a vision system vulnerable to adversarial examples might be fundamentally unsuitable for a computer security application. Even if a vision system is not explicitly used for security, these weaknesses might be critical. Moreover, these problems seem unnecessary. If these perturbations are not perceptible to people, why should they fool a machine?
|
| 15 |
+
|
| 16 |
+
Since this problem was first identified, a rapid succession of papers have proposed various techniques both for generating and for guarding against adversarial attacks. Goodfellow et al. (2014) introduced a simple method for quickly producing adversarial examples called the fast gradient sign method (FGSM). To produce an adversarial example using FGSM, we update the inputs by taking one step in the direction of the sign of the gradient of the loss with respect to the input.
|
| 17 |
+
|
| 18 |
+
To defend against adversarial examples some papers propose training the neural network on adversarial examples themselves, either using the same model (Goodfellow et al., 2014; Madry et al., 2017), or using an ensemble of models (Tramèr et al., 2017a). Taking a different approach, Nayebi & Ganguli (2017) draws inspiration from biological systems. They propose that to harden neural networks against adversarial examples, one should learn flat, compressed representations that are sensitive to a minimal number of input dimensions.
|
| 19 |
+
|
| 20 |
+
This paper introduces Stochastic Activation Pruning (SAP), a method for guarding pretrained networks against adversarial examples. During the forward pass, we stochastically prune a subset of the activations in each layer, preferentially retaining activations with larger magnitudes. Following the pruning, we scale up the surviving activations to normalize the dynamic range of the inputs to the subsequent layer. Unlike other adversarial defense methods, our method can be applied post-hoc to pretrained networks and requires no additional fine-tuning.
|
| 21 |
+
|
| 22 |
+
# 2 PRELIMINARIES
|
| 23 |
+
|
| 24 |
+
We denote an $n$ -layered neural network $h : \mathcal { X } Y$ as a chain of functions $h = h ^ { n } \circ h ^ { n - 1 } \circ . . . \circ h ^ { 1 }$ , where each $h ^ { i }$ consists of a linear transformation $W ^ { i }$ followed by a non-linearity $\phi ^ { i }$ . Given a set of nonlinearities and weight matrices, a neural network provides a nonlinear mapping from inputs $x \in \mathcal { X }$ to outputs $\hat { y } \in \mathcal { V }$ , i.e.
|
| 25 |
+
|
| 26 |
+
$$
|
| 27 |
+
\hat { y } : = h ( x ) = \phi ^ { n } ( W ^ { n } \phi ^ { n - 1 } ( W ^ { n - 1 } \phi ^ { n - 2 } ( . . . \phi ^ { 1 } ( W ^ { 1 } x ) ) ) ) .
|
| 28 |
+
$$
|
| 29 |
+
|
| 30 |
+
In supervised classification and regression problems, we are given a data set $\mathcal { D }$ of pairs $( x , y )$ , where each pair is drawn from an unknown joint distribution. For the classification problems, $y$ is a categorical random variable, and for regression, $y$ is a real-valued vector. Conditioned on a given dataset, network architecture, and a loss function such as cross entropy, a learning algorithm, e.g. stochastic gradient descent, learns parameters $\theta : = \{ W ^ { i } \} _ { i = 1 } ^ { n }$ in order to minimize the loss. We denote $J ( \theta , x , y )$ as the loss of a learned network, parameterized by $\theta$ , on a pair of $( x , y )$ . To simplify notation, we focus on classification problems, although our methods are broadly applicable.
|
| 31 |
+
|
| 32 |
+
Consider an input $x$ that is correctly classified by the model $h$ . An adversary seeks to apply a small additive perturbation, $\Delta x$ , such that $h ( x ) \neq h ( x + \Delta x )$ , subject to the constraint that the perturbation is imperceptible to a human. For perturbations applied to images, the $l _ { \infty }$ -norm is considered a better measure of human perceptibility than the more familiar $l _ { 2 }$ norm Goodfellow et al. (2014). Throughout this paper, we assume that the manipulative power of the adversary, the perturbation $\Delta x$ , is of bounded norm $\| \Delta x \| _ { \infty } \leq \lambda$ . Given a classifier, one common way to generate an adversarial example is to perturb the input in the direction that increases the cross-entropy loss. This is equivalent to minimizing the probability assigned to the true label. Given the neural network $h$ , network parameters $\theta$ , input data $x$ , and corresponding true output $y$ , an adversary could create a perturbation $\Delta x$ as follows
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
\Delta x = \arg \operatorname* { m a x } _ { \| r \| \infty } J ( \theta , x + r , y ) ,
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
Due to nonlinearities in the underlying neural network, and therefore of the objective function $J$ , the optimization Eq. 1, in general, can be a non-convex problem. Following Madry et al. (2017); Goodfellow et al. (2014), we use the first order approximation of the loss function
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\Delta x = \arg \operatorname* { m a x } _ { \| r \| _ { \infty } \leq \lambda } [ J ( \theta , x , y ) + r ^ { \top } \mathcal { T } ( \theta , x , y ) ] , \qquad \mathrm { w h e r e ~ } \mathcal { I } = \nabla _ { x } J .
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
The first term in the optimization is not a function of the adversary perturbation, therefore reduces to
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\Delta x = \arg \operatorname* { m a x } _ { \| r \| _ { \infty } \leq \lambda } { r ^ { \top } \mathcal { I } ( \theta , x , y ) } .
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
An adversary chooses $r$ to be in the direction of sign of $\mathcal { I } ( \theta , x , y )$ , i.e. $\Delta x = \lambda \cdot \mathrm { s i g n } ( \mathcal { I } ( \theta , x , y ) )$ . This is the FGSM technique due to Goodfellow et al. (2014). Note that FGSM requires an adversary to access the model in order to compute the gradient.
|
| 51 |
+
|
| 52 |
+
# 3 STOCHASTIC ACTIVATION PRUNING
|
| 53 |
+
|
| 54 |
+
Consider the defense problem from a game-theoretic perspective (Osborne & Rubinstein, 1994). The adversary designs a policy in order to maximize the defender’s loss, while knowing the defenders policy. At the same time defender aims to come up with a strategy to minimize the maximized loss. Therefore, we can rewrite Eq. 1 as follows
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\pi ^ { * } , \rho ^ { * } : = \arg \operatorname* { m i n } _ { \pi } \operatorname* { m a x } _ { \rho } \mathbb { E } _ { p \sim \pi , r \sim \rho } \left[ J ( M _ { p } ( \theta ) , x + r , y ) \right] ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $\rho$ is the adversary’s policy, which provides $r \sim \rho$ in the space of bounded (allowed) perturbations (for any $r$ in range of $\rho$ , $\| r \| _ { \infty } \leq \bar { \lambda } )$ and $\pi$ is the defenders policy which provides $p \sim \pi$ , an instantiation of its policy. The adversary’s goal is to maximize the loss of the defender by perturbing
|
| 61 |
+
|
| 62 |
+
# Algorithm 1 Stochastic Activation Pruning (SAP)
|
| 63 |
+
|
| 64 |
+
<table><tr><td>1:</td><td colspan="3">Input: input datum x, neural network with n layers, with ith layer having weight matrix Wi, non-linearity $i and number of samples to be drawn r𝑖 .</td></tr><tr><td>2:</td><td>h←x</td><td></td><td></td></tr><tr><td>3:</td><td>for each layeri do</td><td></td><td></td></tr><tr><td>h² ←²(Wihi-1)</td><td></td><td></td><td>>activation vector for layer i with dimension ai</td></tr><tr><td>4: 5:</td><td>p← (h²)j</td><td>∀j ∈{1,...,a²}</td><td>>activations normalized on to the simplex</td></tr><tr><td>6:</td><td>s←0</td><td>∑=1(h)1</td><td>> set of indices not to be pruned</td></tr><tr><td>7:</td><td>repeat ri times</td><td></td><td>> the activations have ri chances of being kept</td></tr><tr><td>8:</td><td></td><td>Draw s ~ categorical(p)</td><td>draw an index to be kept</td></tr><tr><td>9:</td><td>S←SU{s}</td><td></td><td>add index s to the keep set</td></tr><tr><td>10:</td><td>for each j Sdo</td><td></td><td></td></tr><tr><td>11:</td><td>(h²)←0</td><td></td><td> prune the activations not in S</td></tr><tr><td>12:</td><td>for each j ∈ S do</td><td></td><td></td></tr><tr><td>13:</td><td>(h²);← (h²)j</td><td></td><td>> scale up the activations in S</td></tr><tr><td></td><td>1-(1-p)m</td><td></td><td></td></tr><tr><td></td><td>14: return hn</td><td></td><td></td></tr></table>
|
| 65 |
+
|
| 66 |
+
the input under a strategy $\rho$ and the defender’s goal is to minimize the loss by changing model parameters $\theta$ to $M _ { p } ( \theta )$ under strategy $\pi$ . The optimization problem in Eq. 2 is a minimax zero-sum game between the adversary and defender where the optimal strategies $( \pi ^ { * } , \rho ^ { * } )$ , in general, are mixed Nash equilibrium, i.e. stochastic policies.
|
| 67 |
+
|
| 68 |
+
Intuitively, the idea of SAP is to stochastically drop out nodes in each layer during forward propagation. We retain nodes with probabilities proportional to the magnitude of their activation and scale up the surviving nodes to preserve the dynamic range of the activations in each layer. Empirically, the approach preserves the accuracy of the original model. Notably, the method can be applied post-hoc to already-trained models.
|
| 69 |
+
|
| 70 |
+
Formally, assume a given pretrained model, with activation layers (ReLU, Sigmoid, etc.) and input pair of $( x , y )$ . For each of those layers, SAP converts the activation map to a multinomial distribution, choosing each activation with a probability proportional to its absolute value. In other words, we obtain the multinomial distribution of each activation layer with $L _ { 1 }$ normalization of their absolute values onto a $L _ { 1 }$ -ball simplex. Given the $i$ ’th layer activation map, $h ^ { i } \in \mathbb { R } ^ { a ^ { i } }$ , the probability of sampling the $j ^ { ; }$ ’th activation with value $( h ^ { i } ) _ { j }$ is given by
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
p _ { j } ^ { i } = \frac { | ( h ^ { i } ) _ { j } | } { \sum _ { k = 1 } ^ { a ^ { i } } | ( h ^ { i } ) _ { k } | } .
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
We draw random samples with replacement from the activation map given the probability distribution described above. This makes it convenient to determine whether an activation would be sampled at all. If an activation is sampled, we scale it up by the inverse of the probability of sampling it over all the draws. If not, we set the activation to 0. In this way, SAP preserves inverse propensity scoring of each activation. Under an instance $p$ of policy $\pi$ , we draw $r _ { p } ^ { i }$ samples with replacement from this multinomial distribution. The new activation map, $M _ { p } ( h ^ { i } )$ is given by
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
M _ { p } ( h ^ { i } ) = h ^ { i } \odot m _ { p } ^ { i } , \qquad ( m _ { p } ^ { i } ) _ { j } = \frac { \mathbb { I } ( ( h ^ { i } ) _ { j } ) } { 1 - ( 1 - p _ { j } ^ { i } ) ^ { r _ { p } ^ { i } } } ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $\mathbb { I } ( ( h ^ { i } ) _ { j } )$ is the indicator function that returns 1 if $( h ^ { i } ) _ { j }$ was sampled at least once, and 0 otherwise. The algorithm is described in Algorithm 1. In this way, the model parameters are changed from $\theta$ to $M _ { p } ( \theta )$ , for instance $p$ under policy $\pi$ , while the reweighting $1 - ( 1 - p _ { j } ^ { i } ) ^ { r _ { p } ^ { i } }$ preserves $\mathbb { E } _ { p \sim \pi } [ M _ { p } ( h ^ { i } ) _ { j } ] = ( h ^ { i } ) _ { j }$ . If the model was linear, the proposed pruning method would behave the same way as the original model in expectation. In practice, we find that even with the non-linearities in deep neural networks, for sufficiently many examples, SAP performs similarly to the un-pruned model. This guides our decision to apply SAP to pretrained models without performing fine-tuning.
|
| 83 |
+
|
| 84 |
+
# 3.1 ADVANTAGE AGAINST ADVERSARIAL ATTACK
|
| 85 |
+
|
| 86 |
+
We attempt to explain the advantages of SAP under the assumption that we are applying it to a pre-trained model that achieves high generalization accuracy. For instance $p$ under policy $\pi$ , if the number of samples drawn for each layer $i$ , $r _ { p } ^ { i }$ , is large, then fewer parameters of the neural network are pruned, and the scaling factor gets closer to 1. Under this scenario, the stochastically pruned model performs almost identically to the original model. The stochasticity is not advantageous in this case, but there is no loss in accuracy in the pruned model as compared to the original model.
|
| 87 |
+
|
| 88 |
+
On the other hand, with fewer samples in each layer, $r _ { p } ^ { i }$ , a large number of parameters of the neural network are pruned. Under this scenario, the SAP model’s accuracy will drop compared to the original model’s accuracy. But this model is stochastic and has more freedom to deceive the adversary. So the advantage of SAP comes if we can balance the number of samples drawn in a way that negligibly impacts accuracy but still confers robustness against adversarial attacks.
|
| 89 |
+
|
| 90 |
+
SAP is similar to the dropout technique due to Srivastava et al. (2014). However, there is a crucial difference: SAP is more likely to sample activations that are high in absolute value, whereas dropout samples each activation with the same probability. Because of this difference, SAP, unlike dropout, can be applied post-hoc to pretrained models without significantly decreasing the accuracy of the model. Experiments comparing SAP and dropout are included in section 4. Interestingly, dropout confers little advantage over the baseline. We suspect that the reason for this is that the dropout training procedure encourages all possible dropout masks to result in similar mappings.
|
| 91 |
+
|
| 92 |
+
# 3.2 ADVERSARIAL ATTACK ON SAP
|
| 93 |
+
|
| 94 |
+
If the adversary knows that our defense policy is to apply SAP, it might try to calculate the best strategy against the SAP model. Given the neural network $h$ , input data $x$ , corresponding true output $y$ , a policy $\rho$ over the allowed perturbations, and a policy $\pi$ over the model parameters that come from SAP (this result holds true for any stochastic policy chosen over the model parameters), the adversary determines the optimal policy $\rho ^ { * }$
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\rho ^ { * } = \arg \operatorname* { m a x } _ { \rho } \mathbb { E } _ { p \sim \pi , r \sim \rho } [ J ( M _ { p } ( \theta ) , x + r , y ) ] .
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
Therefore, using the result from section 2, the adversary determines the perturbation $\Delta x$ as follows;
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\Delta x = \arg \operatorname* { m a x } _ { r } r ^ { \top } \mathbb { E } _ { p \sim \pi } [ \mathcal { I } ( M _ { p } ( \theta ) , x , y ) ] .
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
To maximize the term, the adversary will set $r$ to be in the direction of sign of $\mathbb { E } _ { p \sim \pi } [ \mathcal { I } ( M _ { p } ( \theta ) , x , y ) ]$ . Analytically computing $\mathbb { E } _ { p \sim \pi } [ \mathcal { T } ( M _ { p } ( \theta ) , x , y ) ]$ is not feasible. However, the adversary can use Monte Carlo (MC) sampling to estimate the expectation as $\mathcal { \widetilde { I } } ( M _ { p } ( \theta ) , x , y )$ . Then, using FGSM, $\Delta x = \lambda \cdot \mathrm { s i g n } ( \widetilde { \mathcal { I } } ( M _ { p } ( \theta ) , x , y ) )$ .
|
| 107 |
+
|
| 108 |
+
# 4 EXPERIMENTS
|
| 109 |
+
|
| 110 |
+
Our experiments to evaluate SAP address two tasks: image classification and reinforcement learning. We apply the method to the $R e L U$ activation maps at each layer of the pretrained neural networks. To create adversarial examples in our evaluation, we use FGSM, $\Delta x = \lambda \cdot \mathrm { s i g n } ( \mathcal { I } ( M _ { p } ( \theta ) , x , y ) )$ . For stochastic models, the adversary estimates $\mathcal { I } ( M _ { p } ( \theta ) , x , y )$ using MC sampling unless otherwise mentioned. All perturbations are applied to the pixel values of images, which normally take values in the range 0-255. So the fraction of perturbation with respect to the data’s dynamic range would be λ256 . To ensure that all images are valid, even following perturbation, we clip the resulting pixel values so that they remain within the range $[ 0 , 2 5 5 ]$ . In all plots, we consider perturbations of the following magnitudes $\lambda = \{ 0 , 1 , 2 , 4 , 8 , 1 6 , 3 \dot { 2 } , 6 4 \}$ .1
|
| 111 |
+
|
| 112 |
+
To evaluate models in the image classification domain, we look at two aspects: the model accuracy for varying values of $\lambda$ , and the calibration of the models (Guo et al., 2017). Calibration of a model is the relation between the confidence level of the model’s output and its accuracy. A linear calibration is ideal, as it suggests that the accuracy of the model is proportional to the confidence level of its output. To evaluate models in the reinforcement learning domain, we look at the average score that each model achieves on the games played, for varying values of $\lambda$ . The higher the score, the better is the model’s performance. Because the units of reward are arbitrary, we report results in terms of the the relative percent change in rewards. In both cases, the output of stochastic models are computed as an average over multiple forward passes.
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
Figure 1: Accuracy plots of a variety of attacks against dense model and SAP models with different perturbation strengths, $\lambda$ . For the SAP $\tau \%$ models, $\tau$ denotes the percentages of samples drawn from the multinomial distribution, at each layer. $( a )$ SAP models tested against random perturbation. $( b )$ SAP models tested against the FGSM attack, using MC sampling. $( c )$ SAP-100 tested against an iterative adversarial attack, using MC sampling (legend shows defender vs. adversary). It is worth restating that obtaining the iterative attack of SAP models is much more expensive and noisier than the iterative attack of dense models.
|
| 116 |
+
|
| 117 |
+
# 4.1 ADVERSARIAL ATTACKS IN IMAGE CLASSIFICATION
|
| 118 |
+
|
| 119 |
+
The CIFAR-10 dataset (Krizhevsky & Hinton, 2009) was used for the image classification domain. We trained a ResNet-20 model (He et al., 2016) using SGD, with minibatches of size 512, momentum of 0.9, weight decay of 0.0001, and a learning rate of 0.5 for the first 100 epochs, then 0.05 for the next 30 epochs, and then 0.005 for the next 20 epochs. This achieved an accuracy of $8 9 . 8 \%$ with cross-entropy loss and $R e L U$ non-linearity. For all the figures in this section, we refer to this model as the dense model. The accuracy of the dense model degrades quickly with $\lambda$ . For $\lambda = 1$ , the accuracy drops down to $6 6 . 3 \%$ , and for $\lambda = 2$ it is $5 6 . 4 \%$ . These are small (hardly perceptible) perturbations in the input images, but the dense model’s accuracy decreases significantly.
|
| 120 |
+
|
| 121 |
+
# 4.1.1 STOCHASTIC ACTIVATION PRUNING (SAP)
|
| 122 |
+
|
| 123 |
+
We apply SAP to the dense model. For each activation map $h ^ { i } \in \mathbb { R } ^ { a ^ { i } }$ , we pick $k \%$ of $a ^ { i }$ activations to keep. Since activations are sampled with replacement, $k$ can be more than 100. We will refer to $k$ as the percentage of samples drawn. Fig. 1a plots performance of SAP models against examples perturbed with random noise. Perturbations of size $\lambda = 6 4$ are readily perceptible and push all models under consideration to near-random outputs, so we focus our attention on smaller values of $\lambda$ Fig. 1b plots performance of these models against adversarial examples. With many samples drawn, SAP converges to the dense model. With few samples drawn, accuracy diminishes for $\lambda = 0$ , but is higher for $\lambda \neq 0$ . The plot explains this balance well. We achieve the best performance with $\sim 1 0 0 \%$ samples picked. We will now only look at SAP $1 0 0 \%$ (SAP-100). Against adversarial examples, with $\lambda = 1$ , 2 and 4, we observe a $1 2 . 2 \%$ , $1 6 . 3 \%$ and $1 2 . 8 \%$ absolute increase in accuracy respectively. However, for $\lambda = 0$ , we observe a $6 . 5 \%$ absolute decrease in accuracy. For $\lambda = 1 6$ again, there is a $5 . 2 \%$ absolute decrease in accuracy.
|
| 124 |
+
|
| 125 |
+
# 4.1.2 DROPOUT (DRO)
|
| 126 |
+
|
| 127 |
+
Dropout, a technique due to Srivastava et al. (2014), was also tested to compare with SAP. Similar to the SAP setting, this method was added to the $R e L U$ activation maps of the dense model. We see that low dropout rate perform similar to the dense model for small $\lambda$ values, but its accuracy starts decreasing very quickly for higher $\lambda$ values (Fig. 2a). We also trained ResNet-20 models, similar to the dense model, but with different dropout rates. This time, the models were trained for 250 epochs, with an initial learning rate of 0.5, reduced by a factor of 0.1 after 100, 150, 190 and 220 epochs. These models were tested against adversarial examples with and without dropout during validation (Figs. 2b and 2c respectively). The models do similar to the dense model, but do not provide additional robustness.
|
| 128 |
+
|
| 129 |
+

|
| 130 |
+
Figure 2: Robustness of dropout models, with different rates of dropout (denoted in the legends), against adversarial attacks, using MC sampling, with a variety of perturbation strengths, $\lambda$ : $( a )$ dropout is applied on the pre-trained models during the validations; $( b )$ the models are trained using dropout, and dropout is applied during the validations; $( c )$ the models are trained using dropout, but dropout is not applied during the validations.
|
| 131 |
+
|
| 132 |
+
# 4.1.3 ADVERSARIAL TRAINING (ADV)
|
| 133 |
+
|
| 134 |
+
Adversarial training (Goodfellow et al., 2014) has emerged a standard method for defending against adversarial examples. It has been adopted by Madry et al. (2017); Tramèr et al. (2017a) to maintain high accuracy levels even for large $\lambda$ values. We trained a ResNet-20 model, similar to the dense model, with an initial learning rate of 0.5, which was halved every 10 epochs, for a total of 100 epochs. It was trained on a dataset consisting of $8 0 \%$ un-perturbed data and $2 0 \%$ adversarially perturbed data, generated on the model from the previous epoch, with $\lambda = 2$ . This achieved an accuracy of $7 5 . 0 \%$ on the un-perturbed validation set. Note that the model capacity was not changed. When tested against adversarial examples, the accuracy dropped to $7 2 . 9 \%$ , $7 0 . 9 \%$ and $6 7 . 5 \%$ for $\lambda = 1 , 2$ and 4 respectively. We ran SAP-100 on the ADV model (referred to as $\mathrm { \ A D V { + } S A P { - } 1 0 0 }$ ). The accuracy in the no perturbation case was $7 4 . 1 \%$ . For adversarial examples, both models act similar to each other for small values of $\lambda$ . But for $\lambda = 1 6$ and 32, ADV $^ +$ SAP-100 gets a higher accuracy than ADV by an absolute increase of $7 . 8 \%$ and $7 . 9 \%$ respectively.
|
| 135 |
+
|
| 136 |
+
We compare the accuracy- $\lambda$ plot for dense, SAP-100, ADV and $\mathrm { \ A D V + S A P - 1 0 0 }$ models. This is illustrated in Fig. 3 For smaller values of $\lambda$ , SAP-100 achieves high accuracy. As $\lambda$ gets larger, ADV+SAP-100 performs better than all the other models. We also compare the calibration plots for these models, in Fig. 4. The dense model is not linear for any $\lambda \neq 0$ . The other models are well calibrated (close to linear), and behave similar to each other for $\lambda \leq 4$ . For higher values of $\lambda$ , we see that ADV $^ +$ SAP-100 is the closest to a linearly calibrated model.
|
| 137 |
+
|
| 138 |
+
# 4.2 ADVERSARIAL ATTACKS IN DEEP REINFORCEMENT LEARNING (RL)
|
| 139 |
+
|
| 140 |
+
Previously, (Behzadan & Munir, 2017; Huang et al., 2017; Kos & Song, 2017) have shown that the reinforcement learning agents can also be easily manipulated by adversarial examples. The RL agent learns the long term value $Q ( a , s )$ of each state-action pair $( s , a )$ through interaction with an environment, where given a state $s$ , the optimal action is ar $\operatorname { g m a x } _ { a } Q ( a , s )$ . A regression based algorithm, Deep Q-Network (DQN)(Mnih et al., 2015) and an improved variant, Double DQN (DDQN) have been proposed for the popular Atari games (Bellemare et al., 2013) as benchmarks. We deploy DDQN algorithm and train an RL agent in variety of different Atari game settings.
|
| 141 |
+
|
| 142 |
+
Similar to the image classification experiments, we tested SAP on a pretrained model (the model is described in the Appendix section A), by applying the method on the $R e L U$ activation maps. SAP-100 was used for these experiments. Table 1 specifies the relative percentage increase in rewards of SAP-100 as compared to the original model. For all the games, we observe a drop in performance for the no perturbation case. But for $\lambda \neq 0$ , the relative increase in rewards is positive (except for $\lambda = 1$ in the BattleZone game), and is very high in some cases $3 4 2 5 . 9 \%$ for $\lambda = 1$ for the Bowling game).
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 3: Accuracy plots of the dense, SAP-100, ADV and ADV $^ +$ SAP-100 models, against adversarial attacks, using MC sampling, with a variety of perturbation strengths, $\lambda$ .
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 4: Calibration plots of the dense, SAP-100, ADV and $\mathrm { A D V + S A P - 1 0 0 }$ models, against adversarial attacks, using MC sampling, with a variety of different perturbation strengths, $\lambda$ . These plots show the relation between the confidence level of the model’s output and its accuracy.
|
| 149 |
+
|
| 150 |
+
# 4.3 ADDITIONAL BASELINES
|
| 151 |
+
|
| 152 |
+
In addition to experimenting with SAP, dropout, and adversarial training, we conducted extensive experiments with other methods for introducing stochasticity into a neural network. These techniques included 0-mean Gaussian noise added to weights (RNW), 1-mean multiplicative Gaussian noise for the weights (RSW), and corresponding additive (RNA) and multiplicative (RSA) noise added to
|
| 153 |
+
|
| 154 |
+
Table 1: Relative percentage increase in rewards gained for SAP-100 compared to original model while playing different Atari games.
|
| 155 |
+
|
| 156 |
+
<table><tr><td>入</td><td>Assault</td><td>Asterix</td><td>BankHeist</td><td>BattleZone</td><td>BeamRider</td><td>Bowling</td></tr><tr><td>0</td><td>-12.2%</td><td>-33.4%</td><td>-59.2%</td><td>-65.8%</td><td>-15.8%</td><td>-4.5%</td></tr><tr><td>1</td><td>10.4%</td><td>13.3%</td><td>131.7%</td><td>-22.0%</td><td>164.5%</td><td>3425.9%</td></tr><tr><td>2</td><td>9.8%</td><td>20.8%</td><td>204.8%</td><td>110.1%</td><td>92.3%</td><td></td></tr><tr><td>4</td><td>12.4%</td><td>14.0%</td><td>1760.0%</td><td>202.6%</td><td></td><td></td></tr><tr><td>8</td><td>16.6%</td><td>7.4%</td><td>60.9%</td><td>134.8%</td><td></td><td></td></tr></table>
|
| 157 |
+
|
| 158 |
+

|
| 159 |
+
Figure 5: Robustness of different pruning and noisifying strategies against their respective adversarial attacks (MC sampling used to estimate gradients of stochastic models).
|
| 160 |
+
|
| 161 |
+
the activations. We describe each method in detail in Appendix B. Each of these models performs worse than the dense baseline at most levels of perturbation and none matches the performance of SAP. Precisely why SAP works while other methods introducing stochasticity do not, remains an open question that we continue to explore in future work.
|
| 162 |
+
|
| 163 |
+
# 4.4 SAP ATTACKS WITH VARYING NUMBERS OF MC SAMPLES
|
| 164 |
+
|
| 165 |
+
In the previous experiments the SAP adversary used $1 0 0 ~ \mathrm { M C }$ samples to estimate the gradient. Additionally, we compared the performance of SAP-100 against various attacks, these include the standard attack calculated based on the dense model and those generated on SAP-100 by estimating the gradient with various numbers of MC samples. We see that if the adversary uses the dense model to generate adversarial examples, SAP-100 model’s accuracy decreases. Additionally, if the adversary uses the SAP-100 model to generate adversarial examples, greater numbers of MC samples lower the accuracy more. Still, even with $1 0 0 0 \mathbf { M C }$ samples, for low amounts of perturbation ( $\lambda = 1$ and 2), SAP-100 retains higher accuracy than the dense model.
|
| 166 |
+
|
| 167 |
+
Computing a single backward pass of the SAP-100 model for 512 examples takes $\sim 2 0$ seconds on 8 GPUs. Using 100 and $1 0 0 0 \mathbf { M C }$ samples would take $\sim 0 . 6$ and $\sim 6$ hours respectively.
|
| 168 |
+
|
| 169 |
+
# 4.5 ITERATIVE ADVERSARIAL ATTACK
|
| 170 |
+
|
| 171 |
+
A more sophisticated technique for producing adversarial perturbations (than FGSM) is to apply multiple and smaller updates to the input in the direction of the local sign-gradients. This can be done by taking small steps of size $k \leq \lambda$ in the direction of the sign-gradient at the updated point and
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 6: Accuracy plots of adversarial attacks, with different perturbation strengths, $\lambda$ . The legend shows defender vs. adversary models (used for gradient computation), and the number of MC samples used to estimate the gradient.
|
| 175 |
+
|
| 176 |
+
repeating the procedure $\lceil \frac { \lambda } { k } \rceil$ times (Kurakin et al., 2016) as follows
|
| 177 |
+
|
| 178 |
+
$$
|
| 179 |
+
x ^ { 0 } = x \mathrm { ~ , ~ } \quad \quad x ^ { t } = c l i p _ { x , \lambda } \left( x ^ { t - 1 } + k \mathrm { s i g n } ( \mathcal { I } ( \theta , x ^ { t - 1 } , y ) ) \right) ,
|
| 180 |
+
$$
|
| 181 |
+
|
| 182 |
+
where function $c l i p _ { x , \lambda }$ is a projection into a $L _ { \infty }$ -ball of radius $\lambda$ centered at $x$ , and also into the hyper-cube of image space (each pixel is clipped to the range of $[ 0 , 2 5 5 ] ,$ ). The dense and SAP-100 models are tested against this adversarial attack, with $k = 1 . 0$ (Fig. 1c). The accuracies of the dense model at $\lambda = 0$ , 1, 2 and 4 are $8 9 . 8 \%$ , $6 6 . 3 \%$ , $5 0 . 1 \%$ and $3 1 . 0 \%$ respectively. The accuracies of the SAP-100 model against attacks computed on the same model (with $1 0 \mathrm { M C }$ samples taken at each step to estimate the gradient) are $8 3 . 3 \%$ , $8 2 . 0 \%$ , $8 0 . 2 \%$ and $7 6 . 7 \%$ , for $\lambda = 0 , 1 , 2 , 4$ respectively. The SAP-100 model provides accuracies of $8 3 . 3 \%$ , $7 5 . 2 \%$ , $6 7 . 0 \%$ and $5 0 . 8 \%$ , against attacks computed on the dense model, with the perturbations $\lambda = 0 , 1 , 2 , 4$ respectively. Iterative attacks on the SAP models are much more expensive to compute and noisier than iterative attacks on dense models. This is why the adversarial attack computed on the dense model results in lower accuracies on the SAP-100 model than the adversarial attack computed on the SAP-100 model itself.
|
| 183 |
+
|
| 184 |
+
# 5 RELATED WORK
|
| 185 |
+
|
| 186 |
+
Robustness to adversarial attack has recently emerged as a serious topic in machine learning (Goodfellow et al., 2014; Kurakin et al., 2016; Papernot & McDaniel, 2016; Tramèr et al., 2017b; Fawzi et al., 2018). Goodfellow et al. (2014) introduced FGSM. Kurakin et al. (2016) proposed an iterative method where FGSM is used for smaller step sizes, which leads to a better approximation of the gradient. Papernot et al. (2017) observed that adversarial examples could be transferred to other models as well. Madry et al. (2017) introduce adding random noise to the image and then using the FGSM method to come up with adversarial examples.
|
| 187 |
+
|
| 188 |
+
Being robust against adversarial examples has primarily focused on training on the adversarial examples. Goodfellow et al. (2014) use FGSM to inject adversarial examples into their training dataset. Madry et al. (2017) use an iterative FGSM approach to create adversarial examples to train on. Tramèr et al. (2017a) introduced an ensemble adversarial training method of training on the adversarial examples created on the model itself and an ensemble of other pre-trained models. These works have been successful, achieving only a small drop in accuracy form the clean and adversarially generated data. Nayebi & Ganguli (2017) proposes a method to produce a smooth input-output mapping by using saturating activation functions and causing the activations to become saturated.
|
| 189 |
+
|
| 190 |
+
# 6 CONCLUSION
|
| 191 |
+
|
| 192 |
+
The SAP approach guards networks against adversarial examples without requiring any additional training. We showed that in the adversarial setting, applying SAP to image classifiers improves both the accuracy and calibration. Notably, combining SAP with adversarial training yields additive benefits. Additional experiments show that SAP can also be effective against adversarial examples in reinforcement learning.
|
| 193 |
+
|
| 194 |
+
# REFERENCES
|
| 195 |
+
|
| 196 |
+
Vahid Behzadan and Arslan Munir. Vulnerability of deep reinforcement learning to policy induction attacks. arXiv preprint arXiv:1701.04143, 2017.
|
| 197 |
+
|
| 198 |
+
Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 47:253–279, 2013.
|
| 199 |
+
|
| 200 |
+
Tianqi Chen, Mu Li, Yutian Li, Min Lin, Naiyan Wang, Minjie Wang, Tianjun Xiao, Bing Xu, Chiyuan Zhang, and Zheng Zhang. Mxnet: A flexible and efficient machine learning library for heterogeneous distributed systems. arXiv preprint arXiv:1512.01274, 2015.
|
| 201 |
+
|
| 202 |
+
Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Analysis of classifiers’ robustness to adversarial perturbations. Machine Learning, 107(3):481–508, 2018.
|
| 203 |
+
|
| 204 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
|
| 205 |
+
|
| 206 |
+
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. arXiv preprint arXiv:1706.04599, 2017.
|
| 207 |
+
|
| 208 |
+
Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
|
| 209 |
+
|
| 210 |
+
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.
|
| 211 |
+
|
| 212 |
+
Sandy Huang, Nicolas Papernot, Ian Goodfellow, Yan Duan, and Pieter Abbeel. Adversarial attacks on neural network policies. arXiv preprint arXiv:1702.02284, 2017.
|
| 213 |
+
|
| 214 |
+
Jernej Kos and Dawn Song. Delving into adversarial attacks on deep policies. arXiv preprint arXiv:1705.06452, 2017.
|
| 215 |
+
|
| 216 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
|
| 217 |
+
|
| 218 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
|
| 219 |
+
|
| 220 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
|
| 221 |
+
|
| 222 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
|
| 223 |
+
|
| 224 |
+
Aran Nayebi and Surya Ganguli. Biologically inspired protection of deep networks from adversarial attacks. arXiv preprint arXiv:1703.09202, 2017.
|
| 225 |
+
|
| 226 |
+
Martin J Osborne and Ariel Rubinstein. A course in game theory. MIT press, 1994.
|
| 227 |
+
|
| 228 |
+
Nicolas Papernot and Patrick McDaniel. On the effectiveness of defensive distillation. arXiv preprint arXiv:1607.05113, 2016.
|
| 229 |
+
|
| 230 |
+
Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519. ACM, 2017.
|
| 231 |
+
|
| 232 |
+
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.
|
| 233 |
+
|
| 234 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
|
| 235 |
+
|
| 236 |
+
Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Dan Boneh, and Patrick McDaniel. Ensemble adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017a.
|
| 237 |
+
|
| 238 |
+
Florian Tramèr, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick McDaniel. The space of transferable adversarial examples. arXiv preprint arXiv:1704.03453, 2017b.
|
| 239 |
+
|
| 240 |
+
# A REINFORCEMENT LEARNING MODEL ARCHITECTURE
|
| 241 |
+
|
| 242 |
+
For the experiments in section 4.2, we trained the network with RMSProp, minibatches of size 32, a learning rate of 0.00025, and a momentum of 0.95 and as in (Mnih et al., 2015) where the discount factor is $\gamma = 0 . 9 9$ , the number of steps between target updates to 10000 steps. We updated the network every 4 steps by randomly sampling a minibatch of size 32 samples from the replay buffer and trained the agents for a total of $1 0 0 M$ steps per game. The experience replay contains the $1 M$ most recent transitions. For training we used an $\varepsilon$ -greedy policy with $\varepsilon$ annealed linearly from 1 to 0.1 over the first $1 M$ time steps and fixed at 0.1 thereafter.
|
| 243 |
+
|
| 244 |
+
The input to the network is $4 \times 8 4 \times 8 4$ tensor with a rescaled, gray-scale version of the last four observations. The first convolution layer has 32 filters of size 8 with a stride of 4. The second convolution layer has 64 filters of size 4 with stride 2. The last convolution layer has 64 filters of size 3 followed by two fully connected layers with size 512 and the final fully connected layer Q-value of each action where ReLU rectifier is deployed for the nonlinearity at each layer.
|
| 245 |
+
|
| 246 |
+
# B OTHER METHODS
|
| 247 |
+
|
| 248 |
+
We tried a variety of different methods that could be added to pretrained models and tested their performance against adversarial examples. The following is a continuation of section 4.1, where we use the dense model again on the CIFAR-10 dataset.
|
| 249 |
+
|
| 250 |
+
# B.1 RANDOM NOISY WEIGHTS (RNW)
|
| 251 |
+
|
| 252 |
+
One simple way of introducing stochasticity to the activations is by adding random Gaussian noise to each weight, with mean 0 and constant standard deviation, s. So each weight tensor $W ^ { i }$ now changes to $M ( W ^ { i } )$ , where the $j$ ’th entry is given by
|
| 253 |
+
|
| 254 |
+
$$
|
| 255 |
+
M ( W ^ { i } ) _ { j } = ( W ^ { i } ) _ { j } + \eta , \qquad \eta \sim \mathcal { N } ( 0 , s ^ { 2 } ) .
|
| 256 |
+
$$
|
| 257 |
+
|
| 258 |
+
These models behave very similar to the dense model (Fig. 5a, the legend indicates the value of $s$ ). While we test several different values of $s$ , we do not observe any significant improvements regarding robustness against adversarial examples. As $s$ increased, the accuracy for non-zero $\lambda$ decreased.
|
| 259 |
+
|
| 260 |
+
# B.2 RANDOMLY SCALED WEIGHTS (RSW)
|
| 261 |
+
|
| 262 |
+
Instead of using additive noise, we also try multiplicative noise. The scale factor can be picked from a Gaussian distribution, with mean 1 and constant standard deviation s. So each weight tensor $W ^ { i }$ now changes to $M ( W ^ { i } )$ , where the $j$ ’th entry is given by
|
| 263 |
+
|
| 264 |
+
$$
|
| 265 |
+
M ( W ^ { i } ) _ { j } = \eta \cdot ( W ^ { i } ) _ { j } , \qquad \eta \sim { \mathcal { N } } ( 1 , s ^ { 2 } ) .
|
| 266 |
+
$$
|
| 267 |
+
|
| 268 |
+
These models perform similar to the dense model, but again, no robustness is offered against adversarial examples. They follow a similar trend as the RNW models (Figure 5b, the legend indicates the value of $s$ ).
|
| 269 |
+
|
| 270 |
+
# B.3 DETERMINISTIC WEIGHT PRUNING (DWP)
|
| 271 |
+
|
| 272 |
+
Following from the motivation of preventing perturbations to propagate forward in the network, we tested deterministic weight pruning, where the top $k \%$ entries of a weight matrix were kept, while the rest were pruned to 0, according to their absolute values. This method was prompted by the success achieved by this pruning method, introduced by Han et al. (2015), where they also fine-tuned the model.
|
| 273 |
+
|
| 274 |
+
For low levels of pruning, these models do very similar to the dense model, even against adversarial examples (Fig. 5c, the legend indicates the value of $k$ ). The adversary can compute the gradient of the sparse model, and the perturbations propagate forward through the surviving weights. For higher levels of sparsity, the accuracy in the no-perturbation case drops down quickly.
|
| 275 |
+
|
| 276 |
+
# B.4 STOCHASTIC WEIGHT PRUNING (SWP)
|
| 277 |
+
|
| 278 |
+
Observing the failure of deterministic weight pruning, we tested a mix of stochasticity and pruning, the stochastic weight pruning method. Very similar to the idea of SAP, we consider all the entries of a weight tensor to be a multinomial distribution, and we sample from it with replacement. For a weight tensor $W ^ { i } \in \mathbb { R } ^ { a ^ { i } }$ , we sample from it $r ^ { i }$ times with replacement. The probability of sampling $( W ^ { \bar { i } } ) _ { j }$ is given by
|
| 279 |
+
|
| 280 |
+
$$
|
| 281 |
+
p _ { j } ^ { i } = \frac { | ( W ^ { i } ) _ { j } | } { \sum _ { k = 1 } ^ { a ^ { i } } | ( W ^ { i } ) ) _ { k } | } .
|
| 282 |
+
$$
|
| 283 |
+
|
| 284 |
+
The new weight entry, $M ( W ^ { i } ) _ { j }$ , is given by
|
| 285 |
+
|
| 286 |
+
$$
|
| 287 |
+
M ( W ^ { i } ) _ { j } = W _ { j } ^ { i } \cdot \frac { \mathbb { I } ( W _ { j } ^ { i } ) } { 1 - ( 1 - p _ { i } ) ^ { r ^ { i } } } ,
|
| 288 |
+
$$
|
| 289 |
+
|
| 290 |
+
where $\mathbb { I } ( W _ { j } ^ { i } )$ is the indicator function that returns 1 if $W _ { j } ^ { i }$ was sampled at least once, and 0 otherwise.
|
| 291 |
+
|
| 292 |
+
For these experiments, for each weight matrix $W ^ { i } \in \mathbb { R } ^ { m ^ { i } }$ , the number of samples picked were $k \%$ of $m ^ { i }$ . Since samples were picked with replacement, $k$ could be more than 100. We will refer to $k$ as the percentage of samples drawn.
|
| 293 |
+
|
| 294 |
+
These models behave very similar to the dense model. We tried drawing range of percentages of samples, but no evident robustness could be seen against adversarial examples (Figure 5d, the legend indicates the value of $k$ ). For a small $s$ , it is very similar to the dense model. As $s$ increases, the these models do marginally better for low non-zero $\lambda$ values, and then drops again (similar to the SAP case).
|
| 295 |
+
|
| 296 |
+
# B.5 RANDOM NOISY ACTIVATIONS (RNA)
|
| 297 |
+
|
| 298 |
+
Next we change our attention to the activation maps in the dense model. One simple way of introducing stochasticity to the activations is by adding random Gaussian noise to each activation entry, with mean 0 and constant standard deviation, $s$ . So each activation map $h ^ { i }$ now changes to $M ( h ^ { i } )$ , where the $j ^ { : }$ ’th entry is given by
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
M ( h ^ { i } ) _ { j } = ( h ^ { i } ) _ { j } + \eta , \qquad \eta \sim \mathcal { N } ( 0 , s ^ { 2 } ) .
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
These models too do not offer any robustness against adversarial examples. Their accuracy drops quickly with $\lambda$ and $s$ (Fig. 5e, the legend indicates the value of $s$ ).
|
| 305 |
+
|
| 306 |
+
# B.6 RANDOMLY SCALED ACTIVATIONS (RSA)
|
| 307 |
+
|
| 308 |
+
Instead of having additive noise, we can also make the model stochastic by scaling the activations. The scale factor can be picked from a Gaussian distribution, with mean 1 and constant standard deviation $s$ . So each activation map $h ^ { i }$ now changes to $M ( h ^ { i } )$ , where the $j$ ’th entry is given by
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
M ( h ^ { i } ) _ { j } = \eta ( h ^ { i } ) _ { j } , \qquad \eta \sim { \mathcal { N } } ( 1 , s ^ { 2 } ) .
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
These models perform similar to the dense model, exhibiting no additional robustness against adversarial examples (Figure 5f, the legend indicates the value of $s$ ).
|
md/train/HJDBUF5le/HJDBUF5le.md
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TOWARDS A NEURAL STATISTICIAN
|
| 2 |
+
|
| 3 |
+
# Amos Storkey
|
| 4 |
+
|
| 5 |
+
Harrison Edwards
|
| 6 |
+
School of Informatics
|
| 7 |
+
University of Edinburgh
|
| 8 |
+
Edinburgh, UK
|
| 9 |
+
H.L.Edwards@sms.ed.ac.uk
|
| 10 |
+
|
| 11 |
+
School of Informatics University of Edinburgh Edinburgh, UK A.Storkey@ed.ac.uk
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
An efficient learner is one who reuses what they already know to tackle a new problem. For a machine learner, this means understanding the similarities amongst datasets. In order to do this, one must take seriously the idea of working with datasets, rather than datapoints, as the key objects to model. Towards this goal, we demonstrate an extension of a variational autoencoder that can learn a method for computing representations, or statistics, of datasets in an unsupervised fashion. The network is trained to produce statistics that encapsulate a generative model for each dataset. Hence the network enables efficient learning from new datasets for both unsupervised and supervised tasks. We show that we are able to learn statistics that can be used for: clustering datasets, transferring generative models to new datasets, selecting representative samples of datasets and classifying previously unseen classes. We refer to our model as a neural statistician, and by this we mean a neural network that can learn to compute summary statistics of datasets without supervision.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
The machine learning community is well-practised at learning representations of data-points and sequences. A middle-ground between these two is representing, or summarizing, datasets - unordered collections of vectors, such as photos of a particular person, recordings of a given speaker or a document as a bag-of-words. Where these sets take the form of i.i.d samples from some distribution, such summaries are called statistics. We explore the idea of using neural networks to learn statistics and we refer to our approach as a neural statistician.
|
| 20 |
+
|
| 21 |
+
The key result of our approach is a statistic network that takes as input a set of vectors and outputs a vector of summary statistics specifying a generative model of that set - a mean and variance specifying a Gaussian distribution in a latent space we term the context. The advantages of our approach are that it is:
|
| 22 |
+
|
| 23 |
+
• Unsupervised: It provides principled and unsupervised way to learn summary statistics as the output of a variational encoder of a generative model.
|
| 24 |
+
• Data efficient: If one has a large number of small but related datasets, modelling the datasets jointly enables us to gain statistical strength.
|
| 25 |
+
• Parameter Efficient: By using summary statistics instead of say categorical labellings of each dataset, we decouple the number of parameters of the model from the number of datasets.
|
| 26 |
+
• Capable of few-shot learning: If the datasets correspond to examples from different classes, class embeddings (summary statistics associated with examples from a class), allow us to handle new classes at test time.
|
| 27 |
+
|
| 28 |
+
# 2 PROBLEM STATEMENT
|
| 29 |
+
|
| 30 |
+
We are given datasets $D _ { i }$ for $i \in \mathcal { Z }$ . Each dataset $D _ { i } = \{ x _ { 1 } , \ldots , x _ { k _ { i } } \}$ consists of a number of i.i.d samples from an associated distribution $p _ { i }$ over $\mathbb { R } ^ { n }$ . The task can be split into learning and inference components. The learning component is to produce a generative model $\hat { p } _ { i }$ for each dataset $D _ { i }$ . We assume there is a common underlying generative process $p$ such that $p _ { i } = p ( \cdot | c _ { i } )$ for $c _ { i } \in \mathbb { R } ^ { l }$ drawn from $p ( c )$ . We refer to $c$ as the context. The inference component is to give an approximate posterior over the context $q ( c | D )$ for a given dataset produced by a statistic network.
|
| 31 |
+
|
| 32 |
+
# 3 NEURAL STATISTICIAN
|
| 33 |
+
|
| 34 |
+
In order to exploit the assumption of a hierarchical generative process over datasets we will use a ‘parameter-transfer approach’ (see Pan & Yang, 2010) to extend the variational autoencoder model of Kingma & Welling (2013).
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 1: Left: basic hierarchical model, where the plate encodes the fact that the context variable $c$ is shared across each item in a given dataset. Center: full neural statistician model with three latent layers $z _ { 1 } , z _ { 2 } , z _ { 3 }$ . Each collection of incoming edges to a node is implemented as a neural network, the input of which is the concatenation of the edges’ sources, the output of which is a parameterization of a distribution over the random variable represented by that node. Right: The statistic network, which combines the data via an exchangeable statistic layer.
|
| 38 |
+
|
| 39 |
+
# 3.1 VARIATIONAL AUTOENCODER
|
| 40 |
+
|
| 41 |
+
The variational autoencoder is a latent variable model $p ( x | z ; \theta )$ (often called the decoder) with parameters $\theta$ . For each observed $x$ , a corresponding latent variable $z$ is drawn from $p ( z )$ so that
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
p ( x ) = \int p ( x | z ; \theta ) p ( z ) d z .
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
The generative parameters $\theta$ are learned by introducing a recognition network (also called an encoder) $q ( z | x ; \phi )$ with parameters $\phi$ . The recognition network gives an approximate posterior over the latent variables that can then be used to give the standard variational lower bound (Saul & Jordan, 1996) on the single-datum log-likelihood. I.e. $\log P ( x | \theta ) \geq \mathcal { L } _ { x }$ , where
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\mathcal { L } _ { x } = \mathbb { E } _ { q ( z | x , \phi ) } \left[ \log p ( x | z ; \theta ) \right] - D _ { K L } \left( q ( z | x ; \phi ) \| p ( z ) \right) .
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
Likewise the full-data log likelihood is lower bounded by the sum of the ${ \mathcal { L } } _ { x }$ terms over the whole dataset. We can then optimize this lower bound with respect to $\phi$ and $\theta$ using the reparameterization trick introduced by Kingma & Welling (2013) and Rezende et al. (2014) to get a Monte-Carlo estimate of the gradient.
|
| 54 |
+
|
| 55 |
+
# 3.2 BASIC MODEL
|
| 56 |
+
|
| 57 |
+
We extend the variational autoencoder to the model depicted on the left in Figure 1. This includes a latent variable $c$ , the context, that varies between different datasets but is constant, a priori, for items within the same dataset. Now, the likelihood of the parameters $\theta$ for one single particular dataset $D$ is given by
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
p ( D ) = \int p ( c ) \left[ \prod _ { x \in D } \int p ( x | z ; \theta ) p ( z | c ; \theta ) d z \right] d c .
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
The prior $p ( c )$ is chosen to be a spherical Gaussian with zero mean and unit variance. The conditional $p ( z | c ; \theta )$ is Gaussian with diagonal covariance, where all the mean and variance parameters depend on $c$ through a neural network. Similarly the observation model $p ( x | z ; \theta )$ will be a simple likelihood function appropriate to the data modality with dependence on $z$ parameterized by a neural network. For example, with real valued data, a diagonal Gaussian likelihood could be used where the mean and log variance of $x$ are created from $z$ via a neural network.
|
| 64 |
+
|
| 65 |
+
We use approximate inference networks $q ( \boldsymbol { z } | \boldsymbol { x } , c ; \phi )$ , $q ( c | D ; \phi )$ , with parameters collected into $\phi$ , to once again enable the calculation and optimization of a variational lower bound on the loglikelihood. The single dataset log likelihood lower bound is given by
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\begin{array}{c} \mathcal { L } _ { D } = \mathbb { E } _ { q ( c | D ; \phi ) } \left[ \sum _ { x \in d } \mathbb { E } _ { q ( z | c , x ; \phi ) } \left[ \log p ( x | z ; \theta ) \right] - D _ { K L } \left( q ( z | c , x ; \phi ) \| p ( z | c ; \theta ) \right) \right] \\ & { \phantom { = \ } - D _ { K L } \left( q ( c | D ; \phi ) \| p ( c ) \right) . } \end{array}
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
As with the generative distributions, the likelihood forms for $q ( \boldsymbol { z } | \boldsymbol { x } , c ; \phi )$ and $q ( c | D ; \phi )$ are diagonal Gaussian distributions, where all the mean and log variance parameters in each distribution are produced by a neural network taking the conditioning variables as inputs. Note that $q ( c | D ; \phi )$ accepts as input a dataset $D$ and we refer to this as the statistic network. We describe this in Subsection 3.4.
|
| 72 |
+
|
| 73 |
+
The full-data variational bound is given by summing the variational bound for each dataset in our collection of datasets. It is by learning the difference of the within-dataset and between-dataset distributions that we are able to discover an appropriate statistic network.
|
| 74 |
+
|
| 75 |
+
# 3.3 FULL MODEL
|
| 76 |
+
|
| 77 |
+
The basic model works well for modelling simple datasets, but struggles when the datasets have complex internal structure. To increase the sophistication of the model we use multiple stochastic layers $z _ { 1 } , \ldots , z _ { k }$ and introduce skip-connections for both the inference and generative networks. The generative model is shown graphically in Figure 1 in the center. The probability of a dataset $D$ is then given by
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
p ( D ) = \int p ( c ) \prod _ { x \in D } \int p ( x | c , z _ { 1 : L } ; \theta ) p ( z _ { L } | c ; \theta ) \prod _ { i = 1 } ^ { L - 1 } p ( z _ { i } | z _ { i + 1 } , c ; \theta ) d z _ { 1 : L } d c
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
where the $p ( z _ { i } | z _ { i + 1 } , c , \theta )$ are again Gaussian distributions where the mean and log variance are given as the output of neural networks. The generative process for the full model is described in Algorithm 1.
|
| 84 |
+
|
| 85 |
+
The full approximate posterior factorizes analogously as
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
q ( c , z _ { 1 : L } | D ; \phi ) = q ( c | D ; \phi ) \prod _ { x \in D } q ( z _ { L } | x , c ; \phi ) \prod _ { i = 1 } ^ { L - 1 } q ( z _ { i } | z _ { i + 1 } , x , c ; \phi ) .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
For convenience we give the variational lower bound as sum of a three parts, a reconstruction term $R _ { D }$ , a context divergence $C _ { D }$ and a latent divergence $L _ { D }$ :
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\begin{array} { l } { \displaystyle R _ { D } = \mathbb { E } _ { q ( c | D ; \phi ) } \sum _ { x \in D } \mathbb { E } _ { q ( z _ { 1 : L } | c , x ; \phi ) } \log p ( x | z _ { 1 : L } , c ; \theta ) } \\ { \displaystyle C _ { D } = D _ { K L } \left( q ( c | D ; \phi ) \| p ( c ) \right) } \\ { \displaystyle L _ { D } = \mathbb { E } _ { q ( c , z _ { 1 : L } | D ; \phi ) } \left[ \displaystyle \sum _ { x \in D } D _ { K L } \left( q ( z _ { L } | c , x ; \phi ) \| p ( z _ { L } | c ; \theta ) \right) \right. } \\ { \displaystyle \left. \qquad \quad + \displaystyle \sum _ { i = 1 } ^ { L - 1 } D _ { K L } \left( q ( z _ { i } | z _ { i + 1 } , c , x ; \phi ) \| p ( z _ { i } | z _ { i + 1 } , c ; \theta ) \right) \right] . } \end{array}
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
The skip-connections $p ( z _ { i } | z _ { i + 1 } , c ; \theta )$ and $q ( z _ { i } | z _ { i + 1 } , x ; \phi )$ allow the context to specify a more precise distribution for each latent variable by explaining-away more generic aspects of the dataset at each stochastic layer. This architecture was inspired by recent work on probabilistic ladder networks in Kaae Sønderby et al. (2016). Complementing these are the skip-connections from each latent variable to the observation $p ( x | z _ { 1 : L } , c ; \theta )$ , the intuition here is that each stochastic layer can focus on representing a certain level of abstraction, since its information does not need to be copied into the next layer, a similar approach was used in Maaløe et al. (2016).
|
| 98 |
+
|
| 99 |
+
Once again, note that we are maximizing the lower bound to the log likelihood over many datasets $D$ : we want to maximize the expectation of $\mathcal { L } _ { D }$ over all datasets. We do this optimization using stochastic gradient descent. In contrast to a variational autoencoder where a minibatch would consist of a subsample of datapoints from the dataset, we use minibatches consisting of a subsample of datasets - tensors of shape (batch size, sample size, number of features).
|
| 100 |
+
|
| 101 |
+
# 3.4 STATISTIC NETWORK
|
| 102 |
+
|
| 103 |
+
In addition to the standard inference networks we require a statistic network $q ( c | D ; \phi )$ to give an approximate posterior over the context $c$ given a dataset $D = \{ x _ { 1 } , \ldots , x _ { k } \}$ . This inference network must capture the exchangeability of the data in $D$ .
|
| 104 |
+
|
| 105 |
+
We use a feedforward neural network consisting of three main elements:
|
| 106 |
+
|
| 107 |
+
• An instance encoder $E$ that takes each individual datapoint $x _ { i }$ to a vector $e _ { i } = E ( x _ { i } )$ . • An exchangeable instance pooling layer that collapses the matrix $( e _ { 1 } , \ldots , e _ { k } )$ to a single pre-statistic vector $v$ . Examples include elementwise means, sums, products, geometric means and maximum. We use the sample mean for all experiments. • A final post-pooling network that takes $v$ to a parameterization of a diagonal Gaussian.
|
| 108 |
+
|
| 109 |
+
The graphical model for this is given at the right of Figure 1.
|
| 110 |
+
|
| 111 |
+
We note that the humble sample mean already gives the statistic network a great deal of representational power due to the fact that the instance encoder can learn a representation where averaging makes sense. For example since the instance encoder can approximate a polynomial on a compact domain, and so can the post-pooling network, a statistic network can approximate any moment of a distribution.
|
| 112 |
+
|
| 113 |
+
# 4 RELATED WORK
|
| 114 |
+
|
| 115 |
+
Due to the general nature of the problem considered, our work touches on many different topics which we now attempt to summarize.
|
| 116 |
+
|
| 117 |
+
Topic models and graphical models The form of the graphical model in Figure 1 on the left is equivalent to that of a standard topic model. In contrast to traditional topic models we do not use discrete latent variables, or restrict to discrete data. Work such as that by Ranganath et al. (2014) has extended topic models in various directions, but importantly we use flexible conditional distributions and dependency structures parameterized by deep neural networks. Recent work has explored neural networks for document models (see e.g. Miao et al., 2015) but has been limited to modelling datapoints with little internal structure. Along related lines are ‘structured variational autoencoders’ (see Johnson et al., 2016), where they treat the general problem of integrating graphical models with variational autoencoders.
|
| 118 |
+
|
| 119 |
+
Transfer learning There is a considerable literature on transfer learning, for a survey see Pan & Yang (2010). There they discuss ‘parameter-transfer’ approaches whereby parameters or priors are shared across datasets, and our work fits into that paradigm. For examples see Lawrence & Platt (2004) where share they priors between Gaussian processes, and Evgeniou & Pontil (2004) where they take an SVM-like approach to share kernels.
|
| 120 |
+
|
| 121 |
+
One-shot Learning Learning quickly from small amounts of data is a topic of great interest. Lake et al. (2015) use Bayesian program induction for one-shot generation and classification, and Koch (2015) train a Siamese (Chopra et al. (2005)) convolutional network for one-shot image classification. We note the relation to the recent work (Rezende et al., 2016) in which the authors use a conditional recurrent variational autoencoder capable of one-shot generalization by taking as extra input a conditioning data point. The important differences here are that we jointly model datasets and datapoints and consider datasets of any size. Recent approaches to one-shot classification are matching networks (Vinyals et al., 2016b) (which was concurrent with the initial preprint of this work), and related previous work (Santoro et al., 2016). The former can be considered a kind of differentiable nearest neighbour classifier, and the latter augments their network with memory to store information about the classification problem. Both are trained end-to-end for the classification problem, whereas the present work is a general approach to learning representations of datasets. Probably the closest previous work is by Salakhutdinov et al. (2012) where the authors learn a topic model over the activations of a DBM for one-shot learning. Compared with their work we use modern architectures and easier to train VAEs, in particular we have fast and amortized feedforward inference for test (and training) datasets, avoiding the need for MCMC.
|
| 122 |
+
|
| 123 |
+
Multiple-Instance Learning There is previous work on classifying sets in multiple-instance learning, for a useful survey see Cheplygina et al. (2015). Typical approaches involve adapting kernel based methods such as support measure machines (Muandet et al., 2012), support distribution machines (Poczos et al., 2012) and ´ multiple-instance-kernels (Gartner et al., 2002). We do not consider applications to multiple-instance learning type problems here, but it may be fruitful to do so in the future.
|
| 124 |
+
|
| 125 |
+
Set2Seq In very related work, Vinyals et al. (2016a) explore architectures for mapping sets to sequences. There they use an LSTM to repeatedly compute weighted-averages of the datapoints and use this to tackle problems such as sorting a list of numbers. The main difference between their work and ours is that they primarily consider supervised problems, whereas we present a general unsupervised method for learning representations of sets of i.i.d instances. In future work we may also explore recurrently computing statistics.
|
| 126 |
+
|
| 127 |
+
ABC There has also been work on learning summary statistics for Approximate Bayesian Computation by either learning to predict the parameters generating a sample as a supervised problem, or by using kernel embeddings as infinite dimensional summary statistics. See the work by Fukumizu et al. (2013) for an example of kernel-based approaches. More recently Jiang et al. (2015) used deep neural networks to predict the parameters generating the data. The crucial differences are that their problem is supervised, they do not leverage any exchangeability properties the data may have, nor can it deal with varying sample sizes.
|
| 128 |
+
|
| 129 |
+
# 5 EXPERIMENTAL RESULTS
|
| 130 |
+
|
| 131 |
+
Given an input set $x _ { 1 } , \ldots x _ { k }$ we can use the statistic network to calculate an approximate posterior over contexts $q ( c | x _ { 1 } , \ldots , x _ { k } ; \phi )$ . Under the generative model, each context $c$ specifies a conditional model $p ( x | c ; \bar { \theta } )$ . To get samples from the model corresponding to the most likely posterior value of $c$ , we set $c$ to the mean of the approximate posterior and then sample directly from the conditional distributions. This is described in Algorithm 2. We use this process in our experiments to show samples. In all experiments, we use the Adam optimization algorithm (Kingma & Ba, 2014) to optimize the parameters of the generative models and variational approximations. Batch normalization (Ioffe & Szegedy, 2015) is implemented for convolutional layers and we always use a batch size of 16. We primarily use the Theano (Theano Development Team, 2016) framework with the Lasagne (Dieleman et al., 2015) library, but the final experiments with face data were done using Tensorflow (Abadi et al., 2015). In all cases experiments were terminated after a given number of epochs when training appeared to have sufficiently converged (300 epochs for omniglot, youtube and spatial MNIST examples, and 50 epochs for the synthetic experiment).
|
| 132 |
+
|
| 133 |
+
# 5.1 SIMPLE 1-D DISTRIBUTIONS
|
| 134 |
+
|
| 135 |
+
In our first experiment we wanted to know if the neural statistician will learn to cluster synthetic 1-D datasets by distribution family. We generated a collection of synthetic 1-D datasets each containing 200 samples. Datasets consist of samples from either an Exponential, Gaussian, Uniform or Laplacian distribution with equal probability. Means and variances are sampled from $U [ - 1 , 1 ]$ and $U [ \bar { 0 } . 5 , 2 ]$ respectively. The training data contains $1 0 K$ sets.
|
| 136 |
+
|
| 137 |
+
The architecture for this experiment contains a single stochastic layer with 32 units for $z$ and 3 units for $c _ { \cdot }$ , . The model $p ( \boldsymbol { x } | \boldsymbol { z } , c ; \boldsymbol { \theta } )$ and variational approximation $\dot { q ( \boldsymbol { z } | \boldsymbol { x } , \boldsymbol { c } ; \boldsymbol { \phi } ) }$ are each a diagonal Gaussian distribution with all mean and log variance parameters given by a network composed of three dense layers with ReLU activations and 128 units. The statistic network determining the mean and log variance parameters of posterior over context variables is composed of three dense layers before and after pooling, each with 128 units with Rectified Linear Unit (ReLU) activations.
|
| 138 |
+
|
| 139 |
+
Figure 2 shows 3-D scatter plots of the summary statistics learned. Notice that the different families of distribution cluster. It is interesting to observe that the Exponential cluster is differently orientated to the others, perhaps reflecting the fact that it is the only non-symmetric distribution. We also see that between the Gaussian and Laplacian clusters there is an area of ambiguity which is as one might expect. We also see that within each cluster the mean and variance are mapped to orthogonal directions.
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 2: Three different views of the same data. Each point is the mean of the approximate posterior over the context $q ( c | D ; \phi )$ where $c \in \mathbb { R } ^ { 3 }$ . Each point is a summary statistic for a single dataset with 200 samples. Top plot shows points colored by distribution family, left plot colored by the mean and right plot colored by the variance. The plots have been rotated to illustrative angles.
|
| 143 |
+
|
| 144 |
+
# 5.2 SPATIAL MNIST
|
| 145 |
+
|
| 146 |
+
Building on the previous experiments we investigate 2-D datasets that have complex structure, but the datapoints contain little information by themselves, making it a good test of the statistic network. We created a dataset called spatial MNIST. In spatial MNIST each image from MNIST (LeCun et al., 1998) is turned into a dataset by interpreting the normalized pixel intensities as a probability density and sampling coordinate values. An example is shown in Figure 3. This creates two-dimensional spatial datasets. We used a sample size of 50. Note that since the pixel coordinates are discrete, it is necessary to dequantize them by adding uniform noise $u \sim U [ 0 , 1 ]$ to the coordinates if one models them as real numbers, else you can get arbitrarily high densities (see Theis et al. (2016) for a discussion of this point).
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 3: An image from MNIST on the left, transformed to a set of 50 $( x , y )$ coordinates, shown as a scatter plot on the right.
|
| 150 |
+
|
| 151 |
+
The generative architecture for this experiment contains 3 stochastic $z$ layers, each with 2 units, and a single $c$ layer with 64 units. The means and log variances of the Gaussian likelihood for $p ( x | z _ { 1 : 3 } , \bar { c } ; \theta )$ , and each subnetwork for $z$ in both the encoder and decoder contained 3 dense layers with 256 ReLU units each. The statistic network also contained 3 dense layers pre-pooling and 3 dense layers post pooling with 256 ReLU units.
|
| 152 |
+
|
| 153 |
+
In addition to being able to sample from the model conditioned on a set of inputs, we can also summarize a dataset by choosing a subset $S \subseteq D$ to minimise the KL divergence of $q ( C | D ; \phi )$ from $q ( C | S ; \phi )$ . We do this greedily by iteratively discarding points from the full sample. Pseudocode for this process is given in Algorithm 3. The results are shown in Figure 4. We see that the model is capable of handling complex arrangements of datapoints. We also see that it can select sensible subsets of a dataset as a summary.
|
| 154 |
+
|
| 155 |
+
# 5.3 OMNIGLOT
|
| 156 |
+
|
| 157 |
+
Next we work with the OMNIGLOT data (Lake et al., 2015). This contains 1628 classes of handwritten characters but with just 20 examples per class. This makes it an excellent test-bed for transfer / few-shot learning. We constructed datasets by splitting each class into datasets of size 5. We train on datasets drawn from 1200 classes and reserve the remaining classes to test few-shot sampling and classification. We created new classes by rotating and reflecting characters. We resized the images to $2 8 \times 2 8$ . We sampled a binarization of each image for each epoch. We also randomly applied the dilation operator from computer vision as further data augmentation since we observed that the stroke widths are quite uniform in the OMNIGLOT data, whereas there is substantial variation in MNIST, this augmentation improved the visual quality of the few-shot MNIST samples considerably and increased the few-shot classification accuracy by about 3 percent. Finally we used ‘sample dropout’ whereby a random subset of each dataset was removed from the pooling in the statistic network, and then included the number of samples remaining as an extra feature. This was beneficial since it reduced overfitting and also allowed the statistic network to learn to adjust the approximate posterior over $c$ based on the number of samples.
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 4: Conditioned samples from spatial MNIST data. Blue and red digits are the input sets, black digits above correspond to samples given the input. Red points correspond to a 6-sample summary of the dataset
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 5: Few-shot learning Left: Few-shot learning from OMNIGLOT to MNIST. Left rows are input sets, right rows are samples given the inputs. Right: Few-shot learning from with OMNIGLOT data to unseen classes. Left rows are input sets, right rows are samples given the inputs. Black-white inversion is applied for ease of viewing.
|
| 164 |
+
|
| 165 |
+
We used a single stochastic layer with 16 units for $z$ , and 512 units for $c$ . We used a shared convolutional encoder between the inference and statistic networks and a deconvolutional decoder network. Full details of the networks are given in Appendix B.1. The decoder used a Bernoulli likelihood.
|
| 166 |
+
|
| 167 |
+
In Figure 5 we show two examples of few-shot learning by conditioning on samples of unseen characters from OMNIGLOT, and conditioning on samples of digits from MNIST. The samples are mostly of a high-quality, and this shows that the neural statistician can generalize even to new datasets.
|
| 168 |
+
|
| 169 |
+
As a further test we considered few-shot classification of both unseen OMNIGLOT characters and MNIST digits. Given a sets of labelled examples of each class $D _ { 0 } , \ldots , D _ { 9 }$ (for MNIST say), we computed the approximate posteriors $q ( C | D _ { i } ; \phi )$ using the statistic network. Then for each test image $x$ we also computed the posterior $q ( C | x ; \phi )$ and classified it according to the training dataset $D _ { i }$ minimizing the KL divergence from the test context $t o$ the training context. This process is described in Algorithm 4. We tried this with either 1 or 5 labelled examples per class and either 5 or 20 classes. For each trial we randomly select $K$ classes, randomly select training examples for each class, and test on the remaining examples. This process is repeated 100 times and the results averaged. The results are shown in Table 1. We compare to a number of results reported in Vinyals et al. (2016b) including Santoro et al. (2016) and Koch (2015). Overall we see that the neural statistician model can be used as a strong classifier, particularly for the 5-way tasks, but performs worse than matching networks for the 20-way tasks. One important advantage that matching networks have is that, whilst each class is processed independently in our model, the representation in matching networks is conditioned on all of the classes in the few-shot problem. This means that it can exaggerate differences between similar classes, which are more likely to appear in a 20-way problem than a 5-way problem.
|
| 170 |
+
|
| 171 |
+
<table><tr><td colspan="3">Task</td><td rowspan="2"></td><td colspan="3">Method</td></tr><tr><td>Test Dataset</td><td>K Shot</td><td>K Way</td><td>Siamese</td><td>MANN</td><td>Matching Ours</td></tr><tr><td>MNIST</td><td>1</td><td>10</td><td>70</td><td>=</td><td>72</td><td>78.6</td></tr><tr><td>MNIST</td><td>5</td><td>10</td><td>=</td><td>=</td><td>=</td><td>93.2</td></tr><tr><td>OMNIGLOT</td><td>1</td><td>5</td><td>97.3</td><td>82.8</td><td>98.1</td><td>98.1</td></tr><tr><td>OMNIGLOT</td><td>5</td><td>5</td><td>98.4</td><td>94.9</td><td>98.9</td><td>99.5</td></tr><tr><td>OMNIGLOT</td><td>1</td><td>20</td><td>88.1</td><td>-</td><td>93.8</td><td>93.2</td></tr><tr><td>OMNIGLOT</td><td>5</td><td>20</td><td>97.0</td><td>=</td><td>98.7</td><td>98.1</td></tr></table>
|
| 172 |
+
|
| 173 |
+
Table 1: The table shows the classification accuracies of various few-shot learning tasks. Models are trained on OMNIGLOT data and tested on either unseen OMNIGLOT classes or MNIST with varying numbers of samples per class (K-shot) with varying numbers of classes (K-way). Comparisons are to Vinyals et al. (2016b) (Matching), Santoro et al. (2016) (MANN) and Koch (2015) (Siamese). 5-shot MNIST results are included for completeness.
|
| 174 |
+
|
| 175 |
+
# 5.4 YOUTUBE FACES
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 6: Few-shot learning for face data. Samples are from model trained on Youtube Faces Database. Left: Each row shows an input set of size 5. Center: Each row shows 5 samples from the model corresponding to the input set on the left. Right: Imagined new faces generated by sampling contexts from the prior. Each row consists of 5 samples from the model given a particular sampled context.
|
| 179 |
+
|
| 180 |
+
Finally, we provide a proof of concept for generating faces of a particular person. We use the Youtube Faces Database from Wolf et al. (2011). It contains 3, 245 videos of 1, 595 different people. We use the aligned and cropped to face version, resized to $6 4 \times 6 4$ . The validation and test sets contain 100 unique people each, and there is no overlap of persons between data splits. The sets were created by sampling frames randomly without replacement from each video, we use a set size of 5 frames. We resample the sets for the training data each epoch.
|
| 181 |
+
|
| 182 |
+
Our architecture for this problem is based on one presented in Lamb et al. (2016). We used a single stochastic layer with 500 dimensional latent $c$ and 16 dimensional $z$ variable. The statistic network and the inference network $q ( \boldsymbol { z } | \boldsymbol { x } , c ; \phi )$ share a common convolutional encoder, and the deocder uses deconvolutional layers. For full details see Appendix B.2. The likelihood function is a Gaussian, but where the variance parameters are shared across all datapoints, this was found to make training faster and more stable.
|
| 183 |
+
|
| 184 |
+
The results are shown in Figure 6. Whilst there is room for improvement, we see that it is possible to specify a complex distribution on-the-fly with a set of photos of a previously unseen person. The samples conditioned on an input set have a reasonable likeness of the input faces. We also show the ability of the model to generate new datasets and see that the samples have a consistent identity and varied poses.
|
| 185 |
+
|
| 186 |
+
# 6 CONCLUSION
|
| 187 |
+
|
| 188 |
+
We have demonstrated a highly flexible model on a variety of tasks. Going forward our approach will naturally benefit from advances in generative models as we can simply upgrade our base generative model, and so future work will pursue this. Compared with some other approaches in the literature for few-shot learning, our requirement for supervision is weaker: we only ask at training time that we are given datasets, but we do not need labels for the datasets, nor even information on whether two datasets represent the same or different classes. It would be interesting then to explore application areas where only this weaker form of supervision is available. There are two important limitations to this work, firstly that the method is dataset hungry: it will likely not learn useful representations of datasets given only a small number of them. Secondly at test time the few-shot fit of the generative model will not be greatly improved by using larger datasets unless the model was also trained on similarly large datasets. The latter limitation seems like a promising future research direction - bridging the gap between fast adaptation and slow training.
|
| 189 |
+
|
| 190 |
+
# ACKNOWLEDGMENTS
|
| 191 |
+
|
| 192 |
+
This work was supported in part by the EPSRC Centre for Doctoral Training in Data Science, funded by the UK Engineering and Physical Sciences Research Council (grant EP/L016427/1) and the University of Edinburgh.
|
| 193 |
+
|
| 194 |
+
# REFERENCES
|
| 195 |
+
|
| 196 |
+
Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, and Zhifeng Chen et al. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow. org/. Software available from tensorflow.org.
|
| 197 |
+
Veronika Cheplygina, David M.J. Tax, and Marco Loog. On classification with bags, groups and sets. Pattern Recognition Letters, 59:11 – 17, 2015.
|
| 198 |
+
S. Chopra, R. Hadsell, and Y. LeCun. Learning a similarity metric discriminatively, with application to face verification. In Computer Vision and Pattern Recognition, 2005. CVPR 2005. IEEE Computer Society Conference on, pp. 539–546 Vol. 1, June 2005.
|
| 199 |
+
Sander Dieleman, Jan Schluter, Colin Raffel, Eben Olson, SK Sønderby, D Nouri, D Maturana, ¨ M Thoma, E Battenberg, J Kelly, et al. Lasagne: First release. Zenodo: Geneva, Switzerland, 2015.
|
| 200 |
+
Theodoros Evgeniou and Massimiliano Pontil. Regularized multi–task learning. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 109–117. ACM, 2004.
|
| 201 |
+
Kenji Fukumizu, Le Song, and Arthur Gretton. Kernel Bayes’ rule: Bayesian inference with positive definite kernels. The Journal of Machine Learning Research, 14(1):3753–3783, 2013.
|
| 202 |
+
Thomas Gartner, Peter A. Flach, Adam Kowalczyk, and Alex J. Smola. Multi-instance kernels. In In Proc. 19th International Conf. on Machine Learning, pp. 179–186. Morgan Kaufmann, 2002.
|
| 203 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of The 32nd International Conference on Machine Learning, pp. 448–456, 2015.
|
| 204 |
+
|
| 205 |
+
Bai Jiang, Tung-yu Wu, Charles Zheng, and Wing H Wong. Learning summary statistic for approximate Bayesian computation via deep neural network. arXiv preprint arXiv:1510.02175, 2015.
|
| 206 |
+
|
| 207 |
+
Matthew J Johnson, David Duvenaud, Alexander B Wiltschko, Sandeep R Datta, and Ryan P Adams. Structured vaes: Composing probabilistic graphical models and variational autoencoders. arXiv preprint arXiv:1603.06277, 2016.
|
| 208 |
+
|
| 209 |
+
Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. How to train deep variational autoencoders and probabilistic ladder networks. arXiv preprint arXiv:1602.02282, 2016.
|
| 210 |
+
|
| 211 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 212 |
+
|
| 213 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. In Proceedings of the 2nd International Conference on Learning Representations (ICLR), number 2014, 2013.
|
| 214 |
+
|
| 215 |
+
Gregory Koch. Siamese neural networks for one-shot image recognition. Doctoral dissertation, University of Toronto, 2015.
|
| 216 |
+
|
| 217 |
+
Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
|
| 218 |
+
|
| 219 |
+
Alex Lamb, Vincent Dumoulin, and Aaron Courville. Discriminative regularization for generative models. arXiv preprint arXiv:1602.03220, 2016.
|
| 220 |
+
|
| 221 |
+
Neil D Lawrence and John C Platt. Learning to learn with the informative vector machine. In Proceedings of the twenty-first international conference on Machine learning, pp. 65. ACM, 2004.
|
| 222 |
+
|
| 223 |
+
Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 224 |
+
|
| 225 |
+
Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
|
| 226 |
+
|
| 227 |
+
Yishu Miao, Lei Yu, and Phil Blunsom. Neural variational inference for text processing. arXiv preprint arXiv:1511.06038, 2015.
|
| 228 |
+
|
| 229 |
+
Krikamol Muandet, Kenji Fukumizu, Francesco Dinuzzo, and Bernhard Schlkopf. Learning from distributions via support measure machines. In P. Bartlett, FCN. Pereira, CJC. Burges, L. Bottou, and KQ. Weinberger (eds.), Advances in Neural Information Processing Systems 25, pp. 10–18. 2012.
|
| 230 |
+
|
| 231 |
+
Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. Knowledge and Data Engineering, IEEE Transactions on, 22(10):1345–1359, 2010.
|
| 232 |
+
|
| 233 |
+
Barnabas P ´ oczos, Liang Xiong, Dougal J Sutherland, and Jeff Schneider. Support distribution ma- ´ chines. Technical Report, 2012. URL http://arxiv.org/abs/1202.0302.
|
| 234 |
+
|
| 235 |
+
Rajesh Ranganath, Sean Gerrish, and David M Blei. Black box variational inference. In AISTATS, pp. 814–822, 2014.
|
| 236 |
+
|
| 237 |
+
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of The 31st International Conference on Machine Learning, pp. 1278–1286, 2014.
|
| 238 |
+
|
| 239 |
+
Danilo Jimenez Rezende, Shakir Mohamed, Ivo Danihelka, Karol Gregor, and Daan Wierstra. Oneshot generalization in deep generative models. arXiv preprint arXiv:1603.05106, 2016.
|
| 240 |
+
|
| 241 |
+
Ruslan Salakhutdinov, Joshua B Tenenbaum, and Antonio Torralba. One-shot learning with a hierarchical nonparametric bayesian model. In ICML Unsupervised and Transfer Learning, pp. 195–206, 2012.
|
| 242 |
+
|
| 243 |
+
Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Oneshot learning with memory-augmented neural networks. arXiv preprint arXiv:1605.06065, 2016.
|
| 244 |
+
|
| 245 |
+
Lawrence K Saul and Michael I Jordan. Exploiting tractable substructures in intractable networks. In Advances in Neural Processing Systems 8, 1996.
|
| 246 |
+
|
| 247 |
+
Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. arXiv e-prints, abs/1605.02688, May 2016. URL http://arxiv.org/abs/ 1605.02688.
|
| 248 |
+
|
| 249 |
+
L. Theis, A. van den Oord, and M. Bethge. A note on the evaluation of generative models. In International Conference on Learning Representations (ICLR), 2016.
|
| 250 |
+
|
| 251 |
+
Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: sequence to sequence for sets. In International Conference on Learning Representations (ICLR), 2016a.
|
| 252 |
+
|
| 253 |
+
Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. arXiv preprint arXiv:1606.04080, 2016b.
|
| 254 |
+
|
| 255 |
+
Lior Wolf, Tal Hassner, and Itay Maoz. Face recognition in unconstrained videos with matched background similarity. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pp. 529–534. IEEE, 2011.
|
| 256 |
+
|
| 257 |
+
# A APPENDIX A: PSEUDOCODE
|
| 258 |
+
|
| 259 |
+
# Algorithm 1 Sampling a dataset of size $k$
|
| 260 |
+
|
| 261 |
+
sample $c \sim p ( c )$
|
| 262 |
+
for $i = 1$ to $k$ do sample $z _ { i , L } \sim p ( z _ { L } | c ; \theta )$ for $j = L - 1$ to 1 do sample $z _ { i , j } \sim p ( z _ { j } | z _ { i , j + 1 } , c ; \theta )$ end for sample $x _ { i } \sim p ( x | z _ { i , 1 } , . . . , z _ { i , L } , c ; \theta )$
|
| 263 |
+
end for
|
| 264 |
+
|
| 265 |
+
<table><tr><td>Algorithm 2 Sampling a dataset of size k conditioned on a dataset of size m</td></tr><tr><td>μc,O² ← q(c|x1,...,Xm; Φ) {Calculate approximate posterior over c using statistic network.} c ← μc {Set c to be the mean of the approximate posterior.}</td></tr><tr><td>fori=1 to k do sample zi,L ~ p(zLlc; 0)</td></tr><tr><td>forj=L-1to1do</td></tr><tr><td>sample zi,j ~ p(zj|zi,j+1,C;0)</td></tr><tr><td>end for</td></tr><tr><td></td></tr><tr><td>sample xi ~p(x|zi,1,.., Zi,L,c;0)</td></tr></table>
|
| 266 |
+
|
| 267 |
+
# Algorithm 3 Selecting a representative sample of size $k$
|
| 268 |
+
|
| 269 |
+
S ← {x1, . . . , xm}
|
| 270 |
+
I ← {1, . . . , m}
|
| 271 |
+
SI = {xi ∈ S : i ∈ I}
|
| 272 |
+
$N _ { S _ { I } } q ( c | S _ { I } ; \phi )$ {Calculate approximate posterior over $c$ using statistic network.}
|
| 273 |
+
for $i = 1$ to $k$ do $\begin{array} { l } { t \gets a r g m i n _ { j \in I } D _ { K L } \left( N _ { S } \| N _ { S _ { I - j } } \right) } \\ { I \gets I - t } \end{array}$
|
| 274 |
+
end for
|
| 275 |
+
|
| 276 |
+
<table><tr><td>Algorithm4K-way few-shot classification</td></tr><tr><td>Do,...,Dk ← sets of labelled examples for each class</td></tr><tr><td>x ← datapoint to be classified</td></tr><tr><td>Nx ← q(c|x;) {approximate posterior over c given query point}</td></tr><tr><td>for i=1 to K do</td></tr><tr><td>Ni ← q(c|Di;Φ)</td></tr><tr><td>end for</td></tr><tr><td>y ←argminiDkL (NillNx)</td></tr></table>
|
| 277 |
+
|
| 278 |
+
# B APPENDIX B: FURTHER EXPERIMENTAL DETAILS
|
| 279 |
+
|
| 280 |
+
# B.1 OMNIGLOT
|
| 281 |
+
|
| 282 |
+
# Shared encoder $x \to h$
|
| 283 |
+
|
| 284 |
+
$\overline { { 2 \times \left\{ \begin{array} { l } { c o n \nu 2 d 6 4 } \end{array} \right. } }$ feature maps with $3 \times 3$ kernels and ELU activations } conv2d 64 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \left\{ c o n \nu 2 d 1 2 \ 8 \right.$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 128 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \{ c o n \nu 2 d 2 5 6$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 256 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations
|
| 285 |
+
|
| 286 |
+
Statistic network $q ( c | D ; \phi ) : h _ { 1 } , \ldots , h _ { k } \to \mu _ { c } , \sigma _ { c } ^ { 2 }$ fully-connected layer with 256 units and ELU activations sample-dropout and concatenation with number of samples average pooling within each dataset $2 \times$ {fully-connected layer with 256 units and ELU activations $\}$ fully-connected linear layers to $\mu _ { c }$ and $\log \sigma _ { c } ^ { 2 }$
|
| 287 |
+
|
| 288 |
+
# Inference network $q ( z | x , c ; \phi ) : h , c \to \mu _ { z } , \sigma _ { z } ^ { 2 }$
|
| 289 |
+
|
| 290 |
+
concatenate c and $\overline { { h } }$ $3 \times$ {fully-connected layer with 256 units and ELU activations $\}$ fully-connected linear layers to $\mu _ { z }$ and $\log \sigma _ { z } ^ { 2 }$
|
| 291 |
+
|
| 292 |
+
Latent decoder network $p ( z | c ; \theta ) : c \mu _ { z } , \sigma _ { z } ^ { 2 }$ $\overline { { 3 \times } }$ {fully-connected layer with 256 units and ELU activations } fully-connected linear layers to $\mu _ { z }$ and $\log \sigma _ { z } ^ { 2 }$
|
| 293 |
+
|
| 294 |
+
# Observation decoder network $p ( x | c , z ; \theta ) : c , z \to \mu _ { x }$
|
| 295 |
+
|
| 296 |
+
concatenate $z$ and $c$ fully-connected linear layers with $4 \cdot 4 \cdot 2 5 6$ units $2 \times \ \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 256 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv2d 256 feature maps with $2 \times 2$ kernels, stride 2, ELU activations $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 128 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv2d 128 feature maps with $2 \times 2$ kernels, stride 2, ELU activations $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 64 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv $2 d 6 4$ feature maps with $2 \times 2$ kernels, stride 2, ELU activations conv2d 1 feature map with $1 \times 1$ kernels, sigmoid activations
|
| 297 |
+
|
| 298 |
+
# B.2 YOUTUBE FACES
|
| 299 |
+
|
| 300 |
+
# Shared encoder $x \to h$
|
| 301 |
+
|
| 302 |
+
$\overline { { 2 \times \{ \ c o n \nu 2 d \} 3 2 } }$ feature maps with $\overline { { 3 \times 3 } }$ kernels and ELU activations $ { \mathfrak { J } }$ conv2d 32 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \left\{ c o n \nu 2 d \ : 6 4 \right.$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 64 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \left\{ \begin{array} { l l } { c o n \nu 2 d 1 2 8 } \end{array} \right.$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 128 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \{ c o n \nu 2 d 2 5 6$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 256 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations
|
| 303 |
+
|
| 304 |
+
Statistic network $q ( c | D , \phi ) : h _ { 1 } , \ldots , h _ { k } \to \mu _ { c } , \sigma _ { c } ^ { 2 }$ fully-connected layer with 1000 units and ELU activations average pooling within each dataset fully-connected linear layers to $\mu _ { c }$ and $\log \sigma _ { c } ^ { 2 }$
|
| 305 |
+
|
| 306 |
+
Inference network $q ( z | x , c , \phi ) : h , c \to \mu _ { z } , \sigma _ { z } ^ { 2 }$ concatenate c and $\overline { { h } }$ fully-connected layer with 1000 units and ELU activations fully-connected linear layers to $\mu _ { z }$ and $\log \sigma _ { z } ^ { 2 }$
|
| 307 |
+
|
| 308 |
+
Latent decoder network $p ( z | c , ; \theta ) : c \mu _ { z } , \sigma _ { z } ^ { 2 }$ fully-connected layer with 1000 units and ELU activations fully-connected linear layers to $\mu _ { z }$ and $\log \sigma _ { z } ^ { 2 }$
|
| 309 |
+
|
| 310 |
+
# Observation decoder network $p ( x | c , z ; \theta ) : c , z \mu _ { x }$
|
| 311 |
+
|
| 312 |
+
concatenate $z$ and $c$ fully-connected layer with 1000 units and ELU activations fully-connected linear layer with $8 \cdot 8 \cdot 2 5 6$ units $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 256 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv2d 256 feature maps with $2 \times 2$ kernels, stride 2, ELU activations $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 128 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv2d 128 feature maps with $2 \times 2$ kernels, stride 2, ELU activations $\gtrsim \gtrsim \left\{ c o n \nu 2 d 6 4 \right.$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv $2 d 6 4$ feature maps with $2 \times 2$ kernels, stride 2, ELU activations $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 32 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv $2 d 3 2$ feature maps with $2 \times 2$ kernels, stride 2, ELU activations conv2d 3 feature maps with $1 \times 1$ kernels, sigmoid activations
|
md/train/HJgEMpVFwB/HJgEMpVFwB.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ADVERSARIAL POLICIES: ATTACKING DEEP REINFORCEMENT LEARNING
|
| 2 |
+
|
| 3 |
+
Adam Gleave1 Michael Dennis Cody Wild Neel Kant Sergey Levine Stuart Russell University of California, Berkeley
|
| 4 |
+
|
| 5 |
+
ABSTRACT
|
| 6 |
+
|
| 7 |
+
Deep reinforcement learning (RL) policies are known to be vulnerable to adversarial perturbations to their observations, similar to adversarial examples for classifiers. However, an attacker is not usually able to directly modify another agent’s observations. This might lead one to wonder: is it possible to attack an RL agent simply by choosing an adversarial policy acting in a multi-agent environment so as to create natural observations that are adversarial? We demonstrate the existence of adversarial policies in zero-sum games between simulated humanoid robots with proprioceptive observations, against state-of-the-art victims trained via self-play to be robust to opponents. The adversarial policies reliably win against the victims but generate seemingly random and uncoordinated behavior. We find that these policies are more successful in high-dimensional environments, and induce substantially different activations in the victim policy network than when the victim plays against a normal opponent. Fine-tuning protects a victim against a specific adversary, but the attack method can be successfully reapplied to find a new adversarial policy. Videos are available at https://adversarialpolicies.github.io/.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The discovery of adversarial examples for image classifiers prompted a new field of research into adversarial attacks and defenses (Szegedy et al., 2014). Recent work has shown that deep RL policies are also vulnerable to adversarial perturbations of image observations (Huang et al., 2017; Kos and Song, 2017). However, real-world RL agents inhabit natural environments populated by other agents, including humans, who can only modify another agent’s observations via their actions. We explore whether it’s possible to attack a victim policy by building an adversarial policy that takes actions in a shared environment, inducing natural observations which have adversarial effects on the victim.
|
| 12 |
+
|
| 13 |
+
RL has been applied in settings as varied as autonomous driving (Dosovitskiy et al., 2017), negotiation (Lewis et al., 2017) and automated trading (Noonan, 2017). In domains such as these, an attacker cannot usually directly modify the victim policy’s input. For example, in autonomous driving pedestrians and other drivers can take actions in the world that affect the camera image, but only in a physically realistic fashion. They cannot add noise to arbitrary pixels, or make a building disappear. Similarly, in financial trading an attacker can send orders to an exchange which will appear in the victim’s market data feed, but the attacker cannot modify observations of a third party’s orders.
|
| 14 |
+
|
| 15 |
+
As a proof of concept, we show the existence of adversarial policies in zero-sum simulated robotics games with proprioceptive observations (Bansal et al., 2018a). The state-of-the-art victim policies were trained via self-play to be robust to opponents. We train each adversarial policy using model-free RL against a fixed black-box victim. We find the adversarial policies reliably beat their victim, despite training for less than $3 \%$ of the timesteps initially used to train the victim policies.
|
| 16 |
+
|
| 17 |
+
Critically, we find the adversaries win by creating natural observations that are adversarial, and not by becoming generally strong opponents. Qualitatively, the adversaries fall to the ground in contorted positions, as illustrated in Figure 1, rather than learning to run, kick or block like normal opponents. This strategy does not work when the victim is ‘masked’ and cannot see the adversary’s position, suggesting that the adversary succeeds by manipulating a victim’s observations through its actions.
|
| 18 |
+
|
| 19 |
+
Having observed these results, we wanted to understand the sensitivity of the attack to the dimensionality of the victim’s observations. We find that victim policies in higher-dimensional Humanoid environments are substantially more vulnerable to adversarial policies than in lower-dimensional Ant environments. To gain insight into why adversarial policies succeed, we analyze the activations of the victim’s policy network using a Gaussian Mixture Model and t-SNE (Maaten and Hinton, 2008). We find adversarial policies induce significantly different activations than normal opponents, and that the adversarial activations are typically more widely dispersed between timesteps than normal activations.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Illustrative snapshots of a victim (in blue) against normal and adversarial opponents (in red). The victim wins if it crosses the finish line; otherwise, the opponent wins. Despite never standing up, the adversarial opponent wins $86 \%$ of episodes, far above the normal opponent’s $47 \%$ win rate.
|
| 23 |
+
|
| 24 |
+
A natural defense is to fine-tune the victim against the adversary. We find this protects against that particular adversary, but that repeating the attack method finds a new adversary the fine-tuned victim is vulnerable to. However, this new adversary differs qualitatively by physically interfering with the victim. This suggests repeated fine-tuning might provide protection against a range of adversaries.
|
| 25 |
+
|
| 26 |
+
Our paper makes three contributions. First, we propose a novel, physically realistic threat model for adversarial examples in RL. Second, we demonstrate the existence of adversarial policies in this threat model for several simulated robotics games. Our adversarial policies reliably beat the victim, despite training with less than $3 \%$ as many timesteps and generating seemingly random behavior. Third, we conduct a detailed analysis of why the adversarial policies work. We show they create natural observations that are adversarial to the victim and push the activations of the victim’s policy network off-distribution. Additionally, we find policies are easier to attack in high-dimensional environments.
|
| 27 |
+
|
| 28 |
+
As deep RL is increasingly deployed in environments with potential adversaries, we believe it is important that practitioners are aware of this previously unrecognized threat model. Moreover, even in benign settings, we believe adversarial policies can be a useful tool for uncovering unexpected policy failure modes. Finally, we are excited by the potential of adversarial training using adversarial policies, which could improve robustness relative to conventional self-play by training against adversaries that exploit weaknesses undiscovered by the distribution of similar opponents present during self-play.
|
| 29 |
+
|
| 30 |
+
# 2 RELATED WORK
|
| 31 |
+
|
| 32 |
+
Most study of adversarial examples has focused on small $\ell _ { p }$ norm perturbations to images, which Szegedy et al. (2014) discovered cause a variety of models to confidently misclassify the image, even though the changes are visually imperceptible to a human. Gilmer et al. (2018a) argued that attackers are not limited to small perturbations, and can instead construct new images or search for naturally misclassified images. Similarly, Uesato et al. (2018) argue that the near-ubiquitous $\ell _ { p }$ model is merely a convenient local approximation for the true worst-case risk. We follow Goodfellow et al. (2017) in viewing adversarial examples more broadly, as “inputs to machine learning models that an attacker has intentionally designed to cause the model to make a mistake.”
|
| 33 |
+
|
| 34 |
+
The little prior work studying adversarial examples in RL has assumed an $\ell _ { p }$ -norm threat model. Huang et al. (2017) and Kos and Song (2017) showed that deep RL policies are vulnerable to small perturbations in image observations. Recent work by Lin et al. (2017) generates a sequence of perturbations guiding the victim to a target state. Our work differs from these previous approaches by using a physically realistic threat model that disallows direct modification of the victim’s observations.
|
| 35 |
+
|
| 36 |
+
Lanctot et al. (2017) showed agents may become tightly coupled to the agents they were trained with. Like adversarial policies, this results in seemingly strong polices failing against new opponents. However, the victims we attack win against a range of opponents, and so are not coupled in this way.
|
| 37 |
+
|
| 38 |
+
Adversarial training is a common defense to adversarial examples, achieving state-of-the-art robustness in image classification (Xie et al., 2019). Prior work has also applied adversarial training to improve the robustness of deep RL policies, where the adversary exerts a force vector on the victim or varies dynamics parameters such as friction (Pinto et al., 2017; Mandlekar et al., 2017; Pattanaik et al., 2018). Our defense of fine-tuning the victim against the adversary is inspired by this work.
|
| 39 |
+
|
| 40 |
+
This work follows a rich tradition of worst-case analysis in RL. In robust MDPs, the transition function is chosen adversarially from an uncertainty set (Bagnell et al., 2001; Tamar et al., 2014). Doyle et al. (1996) solve the converse problem: finding the set of transition functions for which a policy is optimal. Methods also exist to verify controllers or find a counterexample to a specification. Bastani et al. (2018) verify decision trees distilled from RL policies, while Ghosh et al. (2018) test black-box closedloop simulations. Ravanbakhsh et al (2016) can even synthesize controllers robust to adversarial disturbances. Unfortunately, these techniques are only practical in simple environments with lowdimensional adversarial disturbances. By contrast, while our method lacks formal guarantees, it can test policies in complex multi-agent tasks and naturally scales with improvements in RL algorithms.
|
| 41 |
+
|
| 42 |
+
# 3 FRAMEWORK
|
| 43 |
+
|
| 44 |
+
We model the victim as playing against an opponent in a two-player Markov game (Shapley, 1953). Our threat model assumes the attacker can control the opponent, in which case we call the opponent an adversary. We denote the adversary and victim by subscript $\alpha$ and $\nu$ respectively. The game $M = ( S , ( \bar { A } _ { \alpha } , A _ { \nu } ) , T , ( R _ { \alpha } , R _ { \nu } ) )$ consists of state set $S$ , action sets $A _ { \alpha }$ and $A _ { \nu }$ , and a joint state transition function $T : S \times A _ { \alpha } \times A _ { \nu } \to \Delta ( S )$ where $\Delta \left( S \right)$ is a probability distribution on $S$ . The reward function $R _ { i } : S \times A _ { \alpha } \times A _ { \nu } \times S \to \mathbb { R }$ for player $i \in \{ \alpha , \nu \}$ depends on the current state, next state and both player’s actions. Each player wishes to maximize their (discounted) sum of rewards.
|
| 45 |
+
|
| 46 |
+
The adversary is allowed unlimited black-box access to actions sampled from $\pi _ { v }$ , but is not given any white-box information such as weights or activations. We further assume the victim agent follows a fixed stochastic policy $\pi _ { v }$ , corresponding to the common case of a pre-trained model deployed with static weights. Note that in safety critical systems, where attacks like these would be most concerning, it is standard practice to validate a model and then freeze it, so as to ensure that the deployed model does not develop any new issues due to retraining. Therefore, a fixed victim is a realistic reflection of what we might see with RL-trained policies in real-world settings, such as with autonomous vehicles.
|
| 47 |
+
|
| 48 |
+
Since the victim policy $\pi _ { \nu }$ is held fixed, the two-player Markov game $M$ reduces to a single-player MDP $M _ { \alpha } = ( S , A _ { \alpha } , T _ { \alpha } , R _ { \alpha } ^ { \prime } )$ that the attacker must solve. The state and action space of the adversary are the same as in $M$ , while the transition and reward function have the victim policy $\pi _ { \nu }$ embedded:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
T _ { \alpha } \left( s , a _ { \alpha } \right) = T \left( s , a _ { \alpha } , a _ { \nu } \right) \qquad \mathrm { a n d } \qquad R _ { \alpha } ^ { \prime } ( s , a _ { \alpha } , s ^ { \prime } ) = R _ { \alpha } ( s , a _ { \alpha } , a _ { \nu } , s ^ { \prime } ) ,
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where the victim’s action is sampled from the stochastic policy $a _ { \nu } \sim \pi _ { \nu } ( \cdot \mid s )$ . The goal of the attacker is to find an adversarial policy $\pi _ { \alpha }$ maximizing the sum of discounted rewards:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R _ { \alpha } \big ( s ^ { ( t ) } , a _ { \alpha } ^ { ( t ) } , s ^ { ( t + 1 ) } \big ) , \quad \mathrm { w h e r e ~ } s ^ { ( t + 1 ) } \sim T _ { \alpha } \big ( s ^ { ( t ) } , a _ { \alpha } ^ { ( t ) } \big ) \mathrm { ~ a n d ~ } a _ { \alpha } \sim \pi _ { \alpha } \big ( \cdot \big \vert s ^ { ( t ) } \big ) .
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
Note the MDP’s dynamics $T _ { \alpha }$ will be unknown even if the Markov game’s dynamics $T$ are known since the victim policy $\pi _ { \nu }$ is a black-box. Consequently, the attacker must solve an RL problem.
|
| 61 |
+
|
| 62 |
+
# 4 FINDING ADVERSARIAL POLICIES
|
| 63 |
+
|
| 64 |
+
We demonstrate the existence of adversarial policies in zero-sum simulated robotics games. First, we describe how the victim policies were trained and the environments they operate in. Subsequently, we provide details of our attack method in these environments, and describe several baselines. Finally, we present a quantitative and qualitative evaluation of the adversarial policies and baseline opponents.
|
| 65 |
+
|
| 66 |
+

|
| 67 |
+
Figure 2: Illustrations of the zero-sum simulated robotics games from Bansal et al. (2018a) we use for evaluation. Environments are further described in Section 4.1.
|
| 68 |
+
|
| 69 |
+
# 4.1 ENVIRONMENTS AND VICTIM POLICIES
|
| 70 |
+
|
| 71 |
+
We attack victim policies for the zero-sum simulated robotics games created by Bansal et al. (2018a), illustrated in Figure 2. The victims were trained in pairs via self-play against random old versions of their opponent, for between 680 and 1360 million timesteps. We use the pre-trained policy weights released in the “agent zoo” of Bansal et al. (2018b). In symmetric environments, the zoo agents are labeled ZooN where $N$ is a random seed. In asymmetric environments, they are labeled ZooVN and ZooON representing the Victim and Opponent agents.
|
| 72 |
+
|
| 73 |
+
All environments are two-player games in the MuJoCo robotics simulator. Both agents observe the position, velocity and contact forces of joints in their body, and the position of their opponent’s joints. The episodes end when a win condition is triggered, or after a time limit, in which case the agents draw. We evaluate in all environments from Bansal et al. (2018a) except for Run to Goal, which we omit as the setup is identical to You Shall Not Pass except for the win condition. We describe the environments below, and specify the number of trained zoo policies and their type (MLP or LSTM):
|
| 74 |
+
|
| 75 |
+
Kick and Defend (3, LSTM). A soccer penalty shootout between two Humanoid robots. The positions of the kicker, goalie and ball are randomly initialized. The kicker wins if the ball goes between the goalposts; otherwise, the goalie wins, provided it remains within 3 units of the goal.
|
| 76 |
+
|
| 77 |
+
You Shall Not Pass (1, MLP). Two Humanoid agents are initialized facing each other. The runner wins if it reaches the finish line; the blocker wins if it does not.
|
| 78 |
+
|
| 79 |
+
Sumo Humans (3, LSTM). Two Humanoid agents compete on a round arena. The players’ positions are randomly initialized. A player wins by remaining standing after their opponent has fallen.2
|
| 80 |
+
|
| 81 |
+
Sumo Ants (4, LSTM). The same task as Sumo Humans, but with ‘Ant’ quadrupedal robot bodies.
|
| 82 |
+
We use this task in Section 5.2 to investigate the importance of dimensionality to this attack method.
|
| 83 |
+
|
| 84 |
+
# 4.2 METHODS EVALUATED
|
| 85 |
+
|
| 86 |
+
Following the RL formulation in Section 3, we train an adversarial policy to maximize Equation 1 using Proximal Policy Optimization (PPO; Schulman et al., 2017). We give a sparse reward at the end of the episode, positive when the adversary wins the game and negative when it loses or ties. Bansal et al. (2018a) trained the victim policies using a similar reward, with an additional dense component at the start of training. We train for 20 million timesteps using the PPO implementation from Stable Baselines (Hill et al., 2019). The hyperparameters were selected through a combination of manual tuning and a random search of 100 samples; see Section A in the appendix for details. We compare our methods to three baselines: a policy Rand taking random actions; a lifeless policy Zero that exerts zero control; and all pre-trained policies $\operatorname { Z O O } \star$ from Bansal et al. (2018a).
|
| 87 |
+
|
| 88 |
+
# 4.3 RESULTS
|
| 89 |
+
|
| 90 |
+
Quantitative Evaluation We find the adversarial policies reliably win against most victim policies, and outperform the pre-trained $\mathrm { { } } Z \circ \circ$ baseline for a majority of environments and victims. We report
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 3: Win rates while training adversary Adv against the median victim in each environment (based on the difference between the win rate for Adv and Zoo). The adversary outperforms the $\mathrm { { } ^ { \it { Z } O O } }$ baseline against the median victim in Kick and Defend and You Shall Not Pass, and is competitive on Sumo Humans. For full results, see figure 4 below or figure C.1 in the supplementary material.
|
| 94 |
+
|
| 95 |
+
Key: The solid line shows the median win rate for Adv across 5 random seeds, with the shaded region representing the minimum and maximum. The win rate is smoothed with a rolling average over 100 000 timesteps. Baselines are shown as horizontal dashed lines. Agents Rand and Zero take random and zero actions respectively. The $\mathrm { { } ^ { \it { Z } O O } }$ baseline is whichever ZooM (Sumo) or ZooOM (other environments) agent achieves the highest win rate. The victim is ZooN (Sumo) or ZooVN (other environments), where $N$ is given in the title above each figure.
|
| 96 |
+
|
| 97 |
+
the win rate over time against the median victim in each environment in Figure 3, with full results in Figure C.1 in the supplementary material. Win rates against all victims are summarized in Figure 4.
|
| 98 |
+
|
| 99 |
+
Qualitative Evaluation The adversarial policies beat the victim not by performing the intended task (e.g. blocking a goal), but rather by exploiting weaknesses in the victim’s policy. This effect is best seen by watching the videos at https://adversarialpolicies.github.io/. In Kick and Defend and You Shall Not Pass, the adversarial policy never stands up. The adversary instead wins by positioning their body to induce adversarial observations that cause the victim’s policy to take poor actions. A robust victim could easily win, a result we demonstrate in Section 5.1.
|
| 100 |
+
|
| 101 |
+
This flavor of attacks is impossible in Sumo Humans, since the adversarial policy immediately loses if it falls over. Faced with this control constraint, the adversarial policy learns a more high-level strategy: it kneels in the center in a stable position. Surprisingly, this is very effective against victim 1, which in $8 8 \%$ of cases falls over attempting to tackle the adversary. However, it proves less effective against victims 2 and 3, achieving only a $62 \%$ and $45 \%$ win rate, below $\mathrm { { } } Z \circ \circ$ baselines. We further explore the importance of the number of dimensions the adversary can safely manipulate in Section 5.2.
|
| 102 |
+
|
| 103 |
+
Distribution Shift One might wonder if the adversarial policies win because they are outside the training distribution of the victim. To test this, we evaluate victims against two simple off-distribution baselines: a random policy Rand (green) and a lifeless policy Zero (red). These baselines win as often as $30 \%$ to $50 \%$ in Kick and Defend, but less than $1 \%$ of the time in Sumo and You Shall Not Pass. This is well below the performance of our adversarial policies. We conclude that most victim policies are robust to off-distribution observations that are not adversarially optimized.
|
| 104 |
+
|
| 105 |
+
# 5 UNDERSTANDING ADVERSARIAL POLICIES
|
| 106 |
+
|
| 107 |
+
In the previous section we demonstrated adversarial policies exist for victims in a range of competitive simulated robotics environments. In this section, we focus on understanding why these policies exist. Specifically, we establish that adversarial policies manipulate the victim through their body position; that victims are more vulnerable to adversarial policies in high-dimensional environments; and that activations of the victim’s policy network differ substantially when playing an adversarial opponent.
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
Figure 4: Percentage of games won by opponent (out of 1000), the maximal cell in each row is in red. Key: Agents ZooYN are pre-trained policies from Bansal et al. (2018a), where $Y \in \{ { } ^ { \cdot } V ^ { \prime } , { } ^ { \cdot } O ^ { \prime } , { } ^ { \cdot \prime } \}$ denotes the agent plays as (V)ictim, (O)pponent or either side, and $N$ is a random seed. Opponents AdvN are the best adversarial policy of 5 seeds trained against the corresponding Zoo[V]N. Agents Rand and $\mathtt { Z e r o }$ are baseline agents taking random and zero actions respectively. Defended victims ZooXYN, where $X \in \{ \cdot S ^ { \prime } , \cdot \bar { D ^ { \prime } } , \cdot M ^ { \prime } \}$ , are derived from ZooYN by fine-tuning against a (S)ingle opponent AdvN, $\mathbf { ( D ) }$ ual opponents AdvN and Zoo[O]N, or by (M)asking the observations.
|
| 111 |
+
|
| 112 |
+
(a) Gaussian Mixture Model (GMM): likelihood the activations of a victim’s policy network are “normal”. We collect activations for 20, 000 timesteps of victim Zoo[V]1 playing against each opponent. We fit a 20-component GMM to activations induced by Zoo[O]1. Error bars are a $9 5 \%$ confidence interval.
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
(b) t-SNE activations of Kick and Defend victim ZooV2 playing against different opponents. Model fitted with a perplexity of 250 to activations from 5000 timesteps against each opponent. See Figures C.3 and C.4 in the supplementary results for visualizations of other environments and victims.
|
| 116 |
+
|
| 117 |
+
Figure 5: Analysis of activations of the victim’s policy network. Both figures show the adversary Adv induces off-distribution activations. Key: legends specify opponent the victim played against. Adv is the best adversary trained against the victim, and Rand is a policy taking random actions. $\mathrm { ~ Z 0 O } \star \mathrm { N }$ corresponds to ZooN (Sumo) or ZooON (otherwise). ${ \mathrm { 2 0 0 } } \star { \mathrm { 1 T } }$ and ${ \mathsf { Z } } { \mathsf { O } } { \mathsf { O } } \star { \mathsf { 1 } } { \mathsf { V } }$ are the train and validation datasets, drawn from Zoo1 (Sumo) or ZooO1 (otherwise).
|
| 118 |
+
|
| 119 |
+
# 5.1 MASKED POLICIES
|
| 120 |
+
|
| 121 |
+
We have previously shown that adversarial policies are able to reliably win against victims. In this section, we demonstrate that they win by taking actions to induce natural observations that are adversarial to the victim, and not by physically interfering with the victim. To test this, we introduce a ‘masked‘ victim (labeled ZooMN or ZooMVN) that is the same as the normal victim ZooN or ZooVN, except the observation of the adversary’s position is set to a static value corresponding to a typical initial position. We use the same adversarial policy against the normal and masked victim.
|
| 122 |
+
|
| 123 |
+
One would expect it to be beneficial to be able to see your opponent. Indeed, the masked victims do worse than a normal victim when playing normal opponents. For example, Figure 4b shows that in You Shall Not Pass the normal opponent ZooO1 wins $78 \%$ of the time against the masked victim ZooMV1 but only $47 \%$ of the time against the normal victim ZooV1. However, the relationship is reversed when playing an adversary. The normal victim $\mathrm { ~ Z o o V 1 }$ loses $86 \%$ of the time to adversary Adv1 whereas the masked victim ZooMV1 wins $9 9 \%$ of the time. This pattern is particularly clear in You Shall Not Pass, but the trend is similar in other environments.
|
| 124 |
+
|
| 125 |
+
This result is surprising as it implies highly non-transitive relationships may exist between policies even in games that seem to be transitive. A game is said to be transitive if policies can be ranked such that higher-ranked policies beat lower-ranked policies. Prima facie, the games in this paper seem transitive: professional human soccer players and sumo wrestlers can reliably beat amateurs. Despite this, there is a non-transitive relationship between adversarial policies, victims and masked victims. Consequently, we urge caution when using methods such as self-play that assume transitivity, and would recommend more general methods where practical (Balduzzi et al., 2019; Brown et al., 2019).
|
| 126 |
+
|
| 127 |
+
Our findings also suggest a trade-off in the size of the observation space. In benign environments, allowing more observation of the environment increases performance. However, this also makes the agent more vulnerable to adversaries. This is in contrast to an idealized Bayesian agent, where the value of information is always non-negative (Good, 1967). In the following section, we investigate further the connection between vulnerability to attack and the size of the observation space.
|
| 128 |
+
|
| 129 |
+
# 5.2 DIMENSIONALITY
|
| 130 |
+
|
| 131 |
+
A variety of work has concluded that classifiers are more vulnerable to adversarial examples on highdimensional inputs (Gilmer et al., 2018b; Khoury and Hadfield-Menell, 2018; Shafahi et al., 2019). We hypothesize a similar result for RL policies: the greater the dimensionality of the component $P$ of the observation space under control of the adversary, the more vulnerable the victim is to attack. We test this hypothesis in the Sumo environment, varying whether the agents are Ants or Humanoids. The results in Figures 4c and 4d support the hypothesis. The adversary has a much lower win-rate in the low-dimensional Sumo Ants (dim $1 P = 1 5$ ) environment than in the higher dimensional Sumo Humans (d $\operatorname* { l i m } P = 2 4$ ) environment, where $P$ is the position of the adversary’s joints.
|
| 132 |
+
|
| 133 |
+
# 5.3 VICTIM ACTIVATIONS
|
| 134 |
+
|
| 135 |
+
In Section 5.1 we showed that adversarial policies win by creating natural observations that are adversarial to the victim. In this section, we seek to better understand why these observations are adversarial. We record activations from each victim’s policy network playing a range of opponents, and analyze these using a Gaussian Mixture Model (GMM) and a t-SNE visualization. See Section B in the supplementary material for details of training and hyperparameters.
|
| 136 |
+
|
| 137 |
+
We fit a GMM on activations ${ \mathrm { Z o o } } \star 1 { \mathrm { T } }$ collected playing against a normal opponent, Zoo1 or ZooV1, holding out ${ \mathrm { 2 0 0 + 1 0 } }$ for validation. Figure 5a shows that the adversarial policy Adv induces activations with the lowest log-likelihood, with random baseline Rand only slightly more probable. Normal opponents ${ \mathrm { Z o o } } \star 2$ and $\mathrm { Z o o } { \star 3 }$ induce activations with almost as high likelihood as the validation set ${ \mathrm { 2 0 0 \star 1 0 } }$ , except in Sumo Humans where they are as unlikely as Rand.
|
| 138 |
+
|
| 139 |
+
We plot a t-SNE visualization of the activations of Kick and Defend victim ZooV2 in Figure 5b. As expected from the density model results, there is a clear separation between between Adv, Rand and the normal opponent ZooO2. Intriguingly, Adv induces activations more widely dispersed than the random policy Rand, which in turn are more widely dispersed than ZooO2. We report on the full set of victim policies in Figures C.3 and C.4 in the supplementary material.
|
| 140 |
+
|
| 141 |
+
# 6 DEFENDING AGAINST ADVERSARIAL POLICIES
|
| 142 |
+
|
| 143 |
+
The ease with which policies can be attacked highlights the need for effective defenses. A natural defense is to fine-tune the victim zoo policy against an adversary, which we term single training. We also investigate dual training, randomly picking either an adversary or a zoo policy at the start of each episode. The training procedure is otherwise the same as for adversaries, described in Section 4.2.
|
| 144 |
+
|
| 145 |
+
We report on the win rates in You Shall Not Pass in Figure 4b. We find both the single ZooSV1 and dual ZooDV1 fine-tuned victims are robust to adversary Adv1, with the adversary win rate dropping from $87 \%$ to around $10 \%$ . However, ZooSV1 catastrophically forgets how to play against the normal opponent ZooO1. The dual fine-tuned victim ZooDV1 fares better, with opponent ZooO1 winning only $57 \%$ of the time. However, this is still an increase from ZooO1’s $48 \%$ win rate against the original victim ZooV1. This suggests ZooV1 may use features that are helpful against a normal opponent but which are easily manipulable (Ilyas et al., 2019).
|
| 146 |
+
|
| 147 |
+
Although the fine-tuned victims are robust to the original adversarial policy Adv1, they are still vulnerable to our attack method. New adversaries AdvS1 and AdvD1 trained against ZooSV1 and ZooDV1 win at equal or greater rates than before, and transfer successfully to the original victim. However, the new adversaries AdvS1 and AdvD1 are qualitatively different, tripping the victim up by lying prone on the ground, whereas Adv1 causes ZooV1 to fall without ever touching it.
|
| 148 |
+
|
| 149 |
+
# 7 DISCUSSION
|
| 150 |
+
|
| 151 |
+
Contributions. Our paper makes three key contributions. First, we have proposed a novel threat model of natural adversarial observations produced by an adversarial policy taking actions in a shared environment. Second, we demonstrate that adversarial policies exist in a range of zero-sum simulated robotics games against state-of-the-art victims trained via self-play to be robust to adversaries. Third, we verify the adversarial policies win by confusing the victim, not by learning a generally strong policy. Specifically, we find the adversary induces highly off-distribution activations in the victim, and that victim performance increases when it is blind to the adversary’s position.
|
| 152 |
+
|
| 153 |
+
Self-play. While it may at first appear unsurprising that a policy trained as an adversary against another RL policy would be able to exploit it, we believe that this observation is highly significant. The policies we have attacked were explicitly trained via self-play to be robust. Although it is known that self-play with deep RL may not converge, or converge only to a local rather than global Nash, self-play has been used with great success in a number of works focused on playing adversarial games directly against humans (Silver et al., 2018; OpenAI, 2018). Our work shows that even apparently strong self-play policies can harbor serious but hard to find failure modes, demonstrating these theoretical limitations are practically relevant and highlighting the need for careful testing.
|
| 154 |
+
|
| 155 |
+
Our attack provides some amount of testing by constructively lower-bounding the exploitability of a victim policy – its performance against its worst-case opponent – by training an adversary. Since the victim’s win rate declines against our adversarial policy, we can confirm that the victim and its self-play opponent were not in a global Nash. Notably we expect our attack to succeed even for policies in a local Nash, as the adversary is trained starting from a random point that is likely outside the victim’s attractive basin.
|
| 156 |
+
|
| 157 |
+
Defense. We implemented a simple defense: fine-tuning the victim against the adversary. We find our attack can be successfully reapplied to beat this defense, suggesting adversarial policies are difficult to eliminate. However, the defense does appear to protect against attacks that rely on confusing the victim: the new adversarial policy is forced to instead trip the victim up. We therefore believe that scaling up this defense is a promising direction for future work. In particular, we envisage a variant of population-based training where new agents are continually added to the pool to promote diversity, and agents train against a fixed opponent for a prolonged period of time to avoid local equilibria.
|
| 158 |
+
|
| 159 |
+
Conclusion. Overall, we are excited about the implications the adversarial policy model has for the robustness, security and understanding of deep RL policies. Our results show the existence of a previously unrecognized problem in deep RL, and we hope this work encourages other researchers to investigate this area further. Videos and other supplementary material are available online at https://adversarialpolicies.github.io/ and our source code is available on GitHub at https://github.com/HumanCompatibleAI/adversarial-policies.
|
| 160 |
+
|
| 161 |
+
# ACKNOWLEDGMENTS
|
| 162 |
+
|
| 163 |
+
We thank Jakob Foerster, Matthew Rahtz, Dylan Hadfield-Menell, Catherine Olsson, Jan Leike, Rohin Shah, Victoria Krakovna, Daniel Filan, Steven Wang, Dawn Song, Sam Toyer and Dan Hendrycks for their suggestion and helpful feedback on earlier drafts of this paper. We thank Chris Northwood for assistance developing the website accompanying this paper. We are also grateful to our anonymous reviewers for valuable feedback and encouragement to explore defenses in this paper.
|
| 164 |
+
|
| 165 |
+
# REFERENCES
|
| 166 |
+
|
| 167 |
+
J. Andrew Bagnell, Andrew Y. Ng, and Jeff G. Schneider. Solving uncertain Markov decision processes. Technical Report CMU-RI-TR-01-25, August 2001.
|
| 168 |
+
David Balduzzi, Marta Garnelo, Yoram Bachrach, Wojciech M. Czarnecki, Julien Pérolat, Max Jaderberg, and Thore Graepel. Open-ended learning in symmetric zero-sum games. arXiv:1901.08106v1 [cs.LG], 2019.
|
| 169 |
+
Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. In Proceedings of the International Conference on Learning Representations (ICLR), 2018a.
|
| 170 |
+
Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Source code and model weights for emergent complexity via multi-agent competition, 2018b. URL https: //github.com/openai/multiagent-competition.
|
| 171 |
+
Osbert Bastani, Yewen Pu, and Armando Solar-Lezama. Verifiable reinforcement learning via policy extraction. In Advances in Neural Information Processing Systems (NeurIPS), pages 2494–2504. 2018.
|
| 172 |
+
Noam Brown, Adam Lerer, Sam Gross, and Tuomas Sandholm. Deep counterfactual regret minimization. In Proceedings of the International Conference on Machine Learning (ICML), 2019.
|
| 173 |
+
Alexey Dosovitskiy, German Ros, Felipe Codevilla, Antonio Lopez, and Vladlen Koltun. CARLA: An open urban driving simulator. In Proceedings of the Conference on Robot Learning (CoRL), volume 78, pages 1–16, 2017.
|
| 174 |
+
John Doyle, James A. Primbs, Benjamin Shapiro, and Vesna Nevistic. Nonlinear games: examples ´ and counterexamples. In Proceedings of IEEE Conference on Decision and Control (CDC), volume 4, pages 3915–3920, 1996.
|
| 175 |
+
Shromona Ghosh, Felix Berkenkamp, Gireeja Ranade, Shaz Qadeer, and Ashish Kapoor. Verifying controllers against adversarial examples with Bayesian optimization. In IEEE International Conference on Robotics and Automation (ICRA), pages 7306–7313, 2018.
|
| 176 |
+
Justin Gilmer, Ryan P. Adams, Ian Goodfellow, David Andersen, and George E. Dahl. Motivating the rules of the game for adversarial example research. arXiv:1807.06732v2 [cs.LG], 2018a.
|
| 177 |
+
Justin Gilmer, Luke Metz, Fartash Faghri, Samuel S. Schoenholz, Maithra Raghu, Martin Wattenberg, and Ian Goodfellow. Adversarial spheres. arXiv:1801.02774v3 [cs.CV], 2018b.
|
| 178 |
+
I.J. Good. On the principle of total evidence. The British Journal for the Philosophy of Science, 17 (4):319–321, 1967.
|
| 179 |
+
Ian Goodfellow, Nicolas Papernot, Sandy Huang, Yan Duan, Pieter Abbeel, and Jack Clark. Attacking machine learning with adversarial examples. https://openai.com/blog/ adversarial-example-research/, 2017.
|
| 180 |
+
Ashley Hill, Antonin Raffin, Maximilian Ernestus, Adam Gleave, Anssi Kanervisto, 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, 2019.
|
| 181 |
+
Sandy H. Huang, Nicolas Papernot, Ian J. Goodfellow, Yan Duan, and Pieter Abbeel. Adversarial attacks on neural network policies. arXiv:1702.02284v1 [cs.LG], 2017.
|
| 182 |
+
|
| 183 |
+
Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Logan Engstrom, Brandon Tran, and Aleksander Madry. Adversarial examples are not bugs, they are features. arXiv:1905.02175v4 [stat.ML], 2019.
|
| 184 |
+
|
| 185 |
+
Marc Khoury and Dylan Hadfield-Menell. On the geometry of adversarial examples. arXiv:1811.00525v1 [cs.LG], 2018.
|
| 186 |
+
|
| 187 |
+
Jernej Kos and Dawn Song. Delving into adversarial attacks on deep policies. arXiv:1705.06452v1 [stat.ML], 2017.
|
| 188 |
+
|
| 189 |
+
Marc Lanctot, Vinicius Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Karl Tuyls, Julien Perolat, David Silver, and Thore Graepel. A unified game-theoretic approach to multiagent reinforcement learning. In Advances in Neural Information Processing Systems (NeurIPS), pages 4190–4203, 2017.
|
| 190 |
+
|
| 191 |
+
Mike Lewis, Denis Yarats, Yann Dauphin, Devi Parikh, and Dhruv Batra. Deal or no deal? End-to-end learning of negotiation dialogues. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), 2017.
|
| 192 |
+
|
| 193 |
+
Yen-Chen Lin, Zhang-Wei Hong, Yuan-Hong Liao, Meng-Li Shih, Ming-Yu Liu, and Min Sun. Tactics of adversarial attack on deep reinforcement learning agents. In Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI), pages 3756–3762, 2017.
|
| 194 |
+
|
| 195 |
+
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of Machine Learning Research (JMLR), 9(Nov):2579–2605, 2008.
|
| 196 |
+
|
| 197 |
+
Ajay Mandlekar, Yuke Zhu, Animesh Garg, Li Fei-Fei, and Silvio Savarese. Adversarially robust policy learning: Active construction of physically-plausible perturbations. In Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 3932–3939, 2017.
|
| 198 |
+
|
| 199 |
+
Laura Noonan. JPMorgan develops robot to execute trades. Financial Times, July 2017.
|
| 200 |
+
|
| 201 |
+
OpenAI. OpenAI Five. https://blog.openai.com/openai-five/, 2018.
|
| 202 |
+
|
| 203 |
+
Anay Pattanaik, Zhenyi Tang, Shuijing Liu, Gautham Bommannan, and Girish Chowdhary. Robust deep reinforcement learning with adversarial attacks. In Proceedings of the International Conference on Autonomous Agents and MultiAgent System (AAMAS), pages 2040–2042, 2018.
|
| 204 |
+
|
| 205 |
+
Lerrel Pinto, James Davidson, Rahul Sukthankar, and Abhinav Gupta. Robust adversarial reinforcement learning. In Proceedings of the International Conference on Machine Learning (ICML), volume 70, pages 2817–2826, 2017.
|
| 206 |
+
|
| 207 |
+
Hadi Ravanbakhsh and Sriram Sankaranarayanan. Robust controller synthesis of switched systems using counterexample guided framework. In Proceedings of the International Conference on Embedded Software (EMSOFT), pages 8:1–8:10, 2016.
|
| 208 |
+
|
| 209 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv:1707.06347v2 [cs.LG], 2017.
|
| 210 |
+
|
| 211 |
+
Ali Shafahi, W. Ronny Huang, Christoph Studer, Soheil Feizi, and Tom Goldstein. Are adversarial examples inevitable? In Proceedings of the International Conference on Learning Representations (ICLR), 2019.
|
| 212 |
+
|
| 213 |
+
Lloyd S. Shapley. Stochastic games. Proceedings of the National Academy of Sciences, 39(10): 1095–1100, 1953.
|
| 214 |
+
|
| 215 |
+
David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy Lillicrap, Karen Simonyan, and Demis Hassabis. A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play. Science, 362(6419):1140–1144, 2018.
|
| 216 |
+
|
| 217 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In Proceedings of the International Conference on Learning Representations (ICLR), 2014.
|
| 218 |
+
|
| 219 |
+
Aviv Tamar, Shie Mannor, and Huan Xu. Scaling up robust MDPs using function approximation. In Proceedings of the International Conference on Machine Learning (ICML), pages II–181–II–189, 2014.
|
| 220 |
+
|
| 221 |
+
Jonathan Uesato, Brendan O’Donoghue, Pushmeet Kohli, and Aaron van den Oord. Adversarial risk and the dangers of evaluating against weak attacks. In Proceedings of the International Conference on Machine Learning (ICML), volume 80, pages 5025–5034, 2018.
|
| 222 |
+
|
| 223 |
+
Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 224 |
+
|
| 225 |
+
A TRAINING: HYPERPARAMETERS AND COMPUTATIONAL INFRASTRUCTURE
|
| 226 |
+
Table A.1: Hyperparameters for Proximal Policy Optimization.
|
| 227 |
+
|
| 228 |
+
<table><tr><td>Parameter</td><td>Value</td><td>Search Range</td><td>Search Distribution</td></tr><tr><td>Total Timesteps</td><td>20 ×106</td><td>[0,40 × 106]</td><td>Manual</td></tr><tr><td>Batch size</td><td>16 384</td><td>[2048, 65 536]</td><td>Log uniform</td></tr><tr><td>Number of environments</td><td>8</td><td>[1,16]</td><td>Manual</td></tr><tr><td>Mini-batches</td><td>4</td><td>[1,128]</td><td>Log uniform</td></tr><tr><td>Epochs per update</td><td>4</td><td>[1,11]</td><td>Uniform</td></tr><tr><td>Learning rate</td><td>3×10-4</td><td>[1 × i0-5,1 × 10-2]</td><td>Log uniform</td></tr><tr><td>Discount</td><td>0.99</td><td></td><td></td></tr><tr><td>Maximum Gradient Norm</td><td>0.5</td><td></td><td></td></tr><tr><td>Clip Range</td><td>0.2</td><td></td><td></td></tr><tr><td>Advantage Estimation Discount</td><td>0.95</td><td></td><td></td></tr><tr><td>Entropy coefficient</td><td>0.0</td><td></td><td></td></tr><tr><td>Value Function Loss Coefficient</td><td>0.5</td><td></td><td></td></tr></table>
|
| 229 |
+
|
| 230 |
+
Table A.1 specifies the hyperparameters used for training. The number of environments was chosen for performance reasons after observing diminishing returns from using more than 8 parallel environments. The total timesteps was chosen by inspection after observing diminishing returns to additional training. The batch size, mini-batches, epochs per update, entropy coefficient and learning rate were tuned via a random search with 100 samples on two environments, Kick and Defend and Sumo Humans. All other hyperparameters are the defaults in the PPO2 implementation in Stable Baselines (Hill et al., 2019).
|
| 231 |
+
|
| 232 |
+
We repeated the hyperparameter sweep for fine-tuning victim policies for the defense experiments, but obtained similar results. For simplicity, we therefore chose to use the same hyperparameters throughout.
|
| 233 |
+
|
| 234 |
+
We used a mixture of in-house and cloud infrastructure to perform these experiments. It takes around 8 hours to train an adversary for a single victim using 4 cores of an Intel Xeon Platinum 8000 (Skylake) processor.
|
| 235 |
+
|
| 236 |
+
# B ACTIVATION ANALYSIS: T-SNE AND GMM
|
| 237 |
+
|
| 238 |
+
We collect activations from all feed forward layers of the victim’s policy network. This gives two 64-length vectors, which we concatenate into a single 128-dimension vector for analysis with a Gaussian Mixture Model and a t-SNE representation.
|
| 239 |
+
|
| 240 |
+
# B.1 T-SNE HYPERPARAMETER SELECTION
|
| 241 |
+
|
| 242 |
+
We fit models with perplexity 5, 10, 20, 50, 75, 100, 250 and 1000. We chose 250 since qualitatively it produced the clearest visualization of data with a moderate number of distinct clusters.
|
| 243 |
+
|
| 244 |
+
B.2 GAUSSIAN MIXTURE MODEL HYPERPARAMETER SELECTION
|
| 245 |
+
|
| 246 |
+
We fit models with 5, 10, 20, 40 and 80 components with a full (unrestricted) and diagonal covariance matrix. We used the Bayesian Information Criterion (BIC) and average log-likelihood on a heldout validation set as criteria for selecting hyperparameters. We found 20 components with a full covariance matrix achieved the lowest BIC and highest validation log-likelihood in the majority of environment-victim pairs, and was the runner-up in the remainder.
|
| 247 |
+
|
| 248 |
+
# C FIGURES
|
| 249 |
+
|
| 250 |
+
Supplementary figures are provided on the subsequent pages.
|
| 251 |
+
|
| 252 |
+

|
| 253 |
+
Figure C.1: Win rates while training adversary Adv. The adversary exceeds baseline win rates against most victims in Kick and Defend and You Shall Not Pass, is competitive on Sumo Humans, but performs poorly in the low-dimensional Sumo Ants environment. Key: The solid line shows the median win rate for Adv across 5 random seeds, with the shaded region representing the minimum and maximum. The win rate is smoothed with a rolling average over 100 000 timesteps. Baselines are shown as horizontal dashed lines. Agents Rand and Zero take random and zero actions respectively. The Zoo baseline is whichever ZooM (Sumo) or ZooOM (other environments) agent achieves the highest win rate. The victim is ZooN (Sumo) or ZooVN (other environments), where $N$ is given in the title above each figure.
|
| 254 |
+
|
| 255 |
+
(a) Kick and Defend
|
| 256 |
+
|
| 257 |
+
<table><tr><td></td><td colspan="7">Opponent Win</td><td colspan="7">Victim Win</td><td colspan="7">Ties</td><td></td><td></td><td></td></tr><tr><td>ZooV1</td><td>79 53 50</td><td></td><td></td><td>32</td><td>四</td><td>42</td><td>30 30</td><td>21</td><td>4650</td><td></td><td>67</td><td>10</td><td>57</td><td>6461</td><td>0</td><td></td><td>0</td><td>0</td><td>2</td><td>1</td><td>1</td><td>6</td><td>9</td><td>100</td></tr><tr><td>ZooV2</td><td>54</td><td>因</td><td>63</td><td>9</td><td>80</td><td>63</td><td>50 46</td><td>46</td><td>6</td><td>37</td><td>90</td><td>20</td><td>36</td><td>45 44</td><td>0</td><td>0</td><td>0</td><td></td><td>0</td><td>1</td><td>0</td><td>5 10</td><td></td><td>80</td></tr><tr><td>ZooV3</td><td>31 31</td><td></td><td>4</td><td>50</td><td>66</td><td>64</td><td>2629</td><td></td><td>68 67</td><td>回</td><td>47</td><td>33</td><td>35</td><td>68 62</td><td>1</td><td>2</td><td></td><td>0</td><td>3</td><td>0</td><td>2</td><td>5 8</td><td></td><td>60</td></tr><tr><td>ZooMV1</td><td>1517</td><td></td><td>18</td><td>58</td><td>四</td><td>31</td><td>12 13</td><td>84</td><td>83</td><td>82</td><td>40</td><td>19</td><td>69</td><td>8478</td><td>0</td><td>0</td><td></td><td>0</td><td>2</td><td>2</td><td>0</td><td>4 9</td><td></td><td>40</td></tr><tr><td>ZooMV2</td><td>2728</td><td></td><td>27</td><td>36</td><td>因</td><td>42</td><td>2521</td><td></td><td>73 72</td><td>73</td><td>63</td><td>24</td><td>58</td><td>72</td><td>72</td><td>0</td><td>0</td><td>0</td><td>1</td><td>4</td><td>0</td><td>4</td><td>8</td><td></td></tr><tr><td rowspan="3">ZooMV3</td><td>262423</td><td></td><td></td><td></td><td>47 50</td><td>61</td><td>2119</td><td>74</td><td>75</td><td>77</td><td></td><td>51 48</td><td>36</td><td>74 72</td><td></td><td>0</td><td>1</td><td>0</td><td>2</td><td>1</td><td>3</td><td>5</td><td>10</td><td>20</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>1</td><td></td><td></td><td></td><td></td><td></td><td></td><td>1</td><td>1</td><td>1</td><td>1</td><td></td><td>1</td><td>1</td><td></td><td>0</td></tr><tr><td>[APA</td><td>£APA</td><td>1000Z 7000Z</td><td></td><td></td><td>£000Z</td><td>purd</td><td></td><td></td><td>3</td><td>1000Z</td><td>7000Z</td><td>£000Z</td><td>Purd </td><td>[APV</td><td>2</td><td>3</td><td>1000Z</td><td>7000Z</td><td>£000Z</td><td>Pury</td><td></td><td></td><td></td></tr></table>
|
| 258 |
+
|
| 259 |
+
(b) You Shall Not Pass
|
| 260 |
+
|
| 261 |
+
<table><tr><td rowspan=1 colspan=1>ZooV1</td><td rowspan=1 colspan=1>87</td><td rowspan=1 colspan=1>81</td><td rowspan=1 colspan=1>76</td><td rowspan=1 colspan=1>48</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>13</td><td rowspan=1 colspan=1>19</td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1>52</td><td rowspan=1 colspan=1>97 99</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0 0</td></tr><tr><td rowspan=1 colspan=1>ZooSV1</td><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>84</td><td rowspan=1 colspan=1>84</td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>18</td><td rowspan=1 colspan=1>91</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>16</td><td rowspan=1 colspan=1>16</td><td rowspan=1 colspan=1>88 82</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0 0</td></tr><tr><td rowspan=1 colspan=1>ZooDV1</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>91</td><td rowspan=1 colspan=1>88</td><td rowspan=1 colspan=1>57</td><td rowspan=1 colspan=2>8 6</td><td rowspan=1 colspan=1>89</td><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>43</td><td rowspan=1 colspan=1>9294</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0 0</td></tr><tr><td rowspan=1 colspan=1>ZooMV1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>83</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>78</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>17</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>9999</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0 0</td></tr><tr><td rowspan=3 colspan=2>1</td><td rowspan=3 colspan=1>ISAPT</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=2 colspan=1>A</td><td rowspan=2 colspan=1>0</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=1 colspan=2>Pard o.I9z</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Pard o.az</td><td rowspan=1 colspan=1>APV</td><td rowspan=1 colspan=1>AAAPT</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td></td></tr></table>
|
| 262 |
+
|
| 263 |
+
(c) Sumo Humans
|
| 264 |
+
|
| 265 |
+
<table><tr><td></td><td colspan="6">Opponent Win</td><td colspan="6">Victim Win</td><td colspan="6">Ties</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Z001</td><td>87</td><td>9</td><td>37</td><td>15</td><td>80</td><td>80</td><td>0</td><td>0</td><td>12</td><td>91</td><td>63</td><td>85</td><td>19 18</td><td></td><td>100100</td><td>0</td><td>0</td><td>0</td><td>0</td><td>1</td><td>2</td><td></td><td>0</td><td>0</td><td></td><td>100</td></tr><tr><td>Z002</td><td>10</td><td>63</td><td>14</td><td>34</td><td>54</td><td>71</td><td>0</td><td>0</td><td>76</td><td>19</td><td>64</td><td>62</td><td>35 回</td><td></td><td>100100</td><td>141</td><td>18</td><td>22</td><td>4</td><td>11</td><td>13</td><td></td><td>0</td><td>0</td><td></td><td>80</td></tr><tr><td>Z003</td><td>1718</td><td></td><td>44</td><td>10 31</td><td></td><td>57</td><td>0</td><td>1</td><td>81</td><td>79</td><td>2</td><td>88</td><td>61</td><td>34</td><td>100 99</td><td>2</td><td>4</td><td>33</td><td></td><td>1</td><td>8</td><td>9</td><td>0</td><td>0</td><td></td><td>60</td></tr><tr><td>ZooM1</td><td></td><td>8724</td><td>58</td><td>9391 92</td><td></td><td></td><td>0</td><td>1</td><td>12</td><td>76</td><td>42</td><td>□</td><td>9</td><td>8</td><td>100 99</td><td>0</td><td>0</td><td></td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td></td><td>40</td></tr><tr><td>Z0oM2</td><td></td><td>3239</td><td>39</td><td>46</td><td></td><td>69</td><td>0</td><td>0</td><td>39</td><td>30</td><td>23</td><td>50</td><td>四</td><td>17</td><td>100100</td><td></td><td>29 3238</td><td></td><td></td><td>4</td><td>6</td><td>14</td><td>0</td><td>0</td><td></td><td>20</td></tr><tr><td>ZooM3</td><td></td><td>6268</td><td>75</td><td>66</td><td>82</td><td>四</td><td>1</td><td>1</td><td>30</td><td>20</td><td>10</td><td>31</td><td>13</td><td>□</td><td>99 99</td><td></td><td>9 1215</td><td></td><td></td><td>3</td><td>6</td><td>2</td><td>0</td><td>0</td><td></td><td></td></tr><tr><td colspan="2"></td><td></td><td></td><td></td><td></td><td></td><td>pury</td><td></td><td></td><td></td><td></td><td>[00Z</td><td>20</td><td>£00Z</td><td>puey</td><td></td><td></td><td></td><td></td><td>1</td><td></td><td>1</td><td></td><td></td><td></td><td>0</td></tr><tr><td></td><td>[APV</td><td>APA</td><td>1</td><td></td><td>2</td><td>2</td><td></td><td>0.I9z</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>00</td><td>[APV</td><td></td><td>3</td><td>[00Z</td><td>20</td><td>20</td><td>pued</td><td>20</td><td></td><td></td></tr></table>
|
| 266 |
+
|
| 267 |
+

|
| 268 |
+
Figure C.2: Percentage of episodes (out of 1000) won by the opponent, the victim or tied. The maximal opponent win rate in each row is in red. Victims are on the $y$ -axis and opponents on the $x$ -axis. Key: Agents ZooYN are pre-trained policies from Bansal et al. (2018a), where $Y \in \{ { } ^ { \cdot } V ^ { \prime } , { } ^ { \cdot } O ^ { \prime } , { } ^ { \cdot \prime } \}$ denotes the agent plays as (V)ictim, $\mathbf { \eta } ^ { ( \mathbf { 0 } ) }$ pponent or either side, and $N$ is a random seed. Opponents AdvN are the best adversarial policy of 5 seeds trained against the corresponding Zoo[V]N. Agents Rand and $\mathtt { Z e r o }$ are baseline agents taking random and zero actions respectively. Defended victims ZooXYN, where $X \in \{ \cdot S ^ { \prime } , \cdot \bar { D ^ { \prime } } , \cdot M ^ { \prime } \}$ , are derived from ZooYN by fine-tuning against a (S)ingle opponent AdvN, $\mathbf { ( D ) }$ ual opponents AdvN and Zoo[O]N, or by $\mathbf { \Psi } ^ { ( \mathbf { M } ) }$ asking the observations.
|
| 269 |
+
|
| 270 |
+

|
| 271 |
+
Figure C.3: t-SNE activations of the victim when playing against different opponents. There is a clear separation between the activations induced by Adv and those of the normal opponent Zoo. Model fitted with a perplexity of 250 to activations from 5000 timesteps against each opponent. The victim is ZooN (Sumo) or ZooVN (other environments), where $N$ is given in the figure caption. Opponent Adv is the best adversary trained against the victim. Opponent $\mathrm { { } ~ \ Z \ O O }$ corresponds to ZooN (Sumo) or ZooON (other environments). See Figure C.4 for activations for a single opponent at a time.
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Figure C.4: t-SNE activations of victim Zoo1 (Sumo) or ZooV1 (other environments). The results are the same as in Figure C.3 but decomposed into individual opponents for clarity. Model fitted with a perplexity of 250 to activations from 5000 timesteps against each opponent. Opponent Adv is the best adversary trained against the victim. Opponent Zoo is Zoo1 (Sumo) or ZooO1 (other environments). See Figure C.3 for results for other victims (one plot per victim).
|
md/train/HJlnC1rKPB/HJlnC1rKPB.md
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ON THE RELATIONSHIP BETWEEN SELF-ATTENTION AND CONVOLUTIONAL LAYERS
|
| 2 |
+
|
| 3 |
+
Jean-Baptiste Cordonnier, Andreas Loukas & Martin Jaggi Ecole Polytechnique F ´ ed´ erale de Lausanne (EPFL) ´ {first.last}@epfl.ch
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Recent trends of incorporating attention mechanisms in vision have led researchers to reconsider the supremacy of convolutional layers as a primary building block. Beyond helping CNNs to handle long-range dependencies, Ramachandran et al. (2019) showed that attention can completely replace convolution and achieve state-of-the-art performance on vision tasks. This raises the question: do learned attention layers operate similarly to convolutional layers? This work provides evidence that attention layers can perform convolution and, indeed, they often learn to do so in practice. Specifically, we prove that a multi-head self-attention layer with sufficient number of heads is at least as expressive as any convolutional layer. Our numerical experiments then show that self-attention layers attend to pixel-grid patterns similarly to CNN layers, corroborating our analysis. Our code is publicly available1.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Recent advances in Natural Language Processing (NLP) are largely attributed to the rise of the transformer (Vaswani et al., 2017). Pre-trained to solve an unsupervised task on large corpora of text, transformer-based architectures, such as GPT-2 (Radford et al., 2018), BERT (Devlin et al., 2018) and Transformer-XL (Dai et al., 2019), seem to possess the capacity to learn the underlying structure of text and, as a consequence, to learn representations that generalize across tasks. The key difference between transformers and previous methods, such as recurrent neural networks (Hochreiter & Schmidhuber, 1997) and convolutional neural networks (CNN), is that the former can simultaneously attend to every word of their input sequence. This is made possible thanks to the attention mechanism—originally introduced in Neural Machine Translation to better handle long-range dependencies (Bahdanau et al., 2015). With self-attention in particular, the similarity of two words in a sequence is captured by an attention score measuring the distance of their representations. The representation of each word is then updated based on those words whose attention score is highest.
|
| 12 |
+
|
| 13 |
+
Inspired by its capacity to learn meaningful inter-dependencies between words, researchers have recently considered utilizing self-attention in vision tasks. Self-attention was first added to CNN by either using channel-based attention (Hu et al., 2018) or non-local relationships across the image (Wang et al., 2018). More recently, Bello et al. (2019) augmented CNNs by replacing some convolutional layers with self-attention layers, leading to improvements on image classification and object detection tasks. Interestingly, Ramachandran et al. (2019) noticed that, even though state-of-the art results are reached when attention and convolutional features are combined, under same computation and model size constraints, self-attention-only architectures also reach competitive image classification accuracy.
|
| 14 |
+
|
| 15 |
+
These findings raise the question, do self-attention layers process images in a similar manner to convolutional layers? From a theoretical perspective, one could argue that transfomers have the capacity to simulate any function—including a CNN. Indeed, Perez et al. (2019) showed that a multi- ´ layer attention-based architecture with additive positional encodings is Turing complete under some strong theoretical assumptions, such as unbounded precision arithmetic. Unfortunately, universality results do not reveal how a machine solves a task, only that it has the capacity to do so. Thus, the question of how self-attention layers actually process images remains open.
|
| 16 |
+
|
| 17 |
+
Contributions. In this work, we put forth theoretical and empirical evidence that self-attention layers can (and do) learn to behave similar to convolutional layers:
|
| 18 |
+
|
| 19 |
+
I. From a theoretical perspective, we provide a constructive proof showing that self-attention layers can express any convolutional layers.
|
| 20 |
+
|
| 21 |
+
Specifically, we show that a single multi-head self-attention layer using relative positional encoding can be re-parametrized to express any convolutional layer.
|
| 22 |
+
|
| 23 |
+
II. Our experiments show that the first few layers of attention-only architectures (Ramachandran et al., 2019) do learn to attend on grid-like pattern around each query pixel, similar to our theoretical construction.
|
| 24 |
+
|
| 25 |
+
Strikingly, this behavior is confirmed both for our quadratic encoding, but also for relative encoding that is learned. Our results seem to suggest that localized convolution is the right inductive bias for the first few layers of an image classifying network. We provide an interactive website2 to explore how self-attention exploits localized position-based attention in lower layers and contentbased attention in deeper layers. For reproducibility purposes, our code is publicly available.
|
| 26 |
+
|
| 27 |
+
# 2 BACKGROUND ON ATTENTION MECHANISMS FOR VISION
|
| 28 |
+
|
| 29 |
+
We here recall the mathematical formulation of self-attention layers and emphasize the role of positional encodings.
|
| 30 |
+
|
| 31 |
+
# 2.1 THE MULTI-HEAD SELF-ATTENTION LAYER
|
| 32 |
+
|
| 33 |
+
Let $\pmb { X } \in \mathbb { R } ^ { T \times D _ { i n } }$ be an input matrix consisting of $T$ tokens in of $D _ { i n }$ dimensions each. While in NLP each token corresponds to a word in a sentence, the same formalism can be applied to any sequence of $T$ discrete objects, e.g. pixels. A self-attention layer maps any query token $t \in [ \bar { T } ]$ from $D _ { i n }$ to $D _ { o u t }$ dimensions as follows:
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
{ \mathrm { S e l f - A t t e n t i o n } } ( X ) _ { t , : } : = { \mathrm { s o f t m a x } } \left( A _ { t , : } \right) X W _ { v a l } ,
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
where we refer to the elements of the $T \times T$ matrix
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
A : = X W _ { q r y } W _ { k e y } ^ { \top } X ^ { \top }
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
as attention scores and the softmax output3 as attention probabilities. The layer is parametrized by a query matrix $W _ { q r y } \in \mathbb { R } ^ { D _ { i n } \times D _ { k } }$ , a key matrix $W _ { k e y } ^ { \mathrm { ~ ~ } } \in \mathbb { R } ^ { D _ { i n } \times D _ { k } }$ and a value matrix $W _ { \nu a l } ~ \in$ $\mathbb { R } ^ { D _ { i n } \times D _ { o u t } }$ .For simplicity, we exclude any residual connections, batch normalization and constant factors.
|
| 46 |
+
|
| 47 |
+
A key property of the self-attention model described above is that it is equivariant to reordering, that is, it gives the same output independently of how the $T$ input tokens are shuffled. This is problematic for cases we expect the order of things to matter. To alleviate the limitation, a positional encoding is learned for each token in the sequence (or pixel in an image), and added to the representation of the token itself before applying self-attention
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\pmb { A } : = ( \pmb { X } + \pmb { P } ) \pmb { W } _ { q r y } \pmb { W } _ { k e y } ^ { \top } ( \pmb { X } + \pmb { P } ) ^ { \top } ,
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $P \in \mathbb { R } ^ { T \times D _ { i n } }$ contains the embedding vectors for each position. More generally, $_ { r }$ may be substituted by any function that returns a vector representation of the position.
|
| 54 |
+
|
| 55 |
+
It has been found beneficial in practice to replicate this self-attention mechanism into multiple heads, each being able to focus on different parts of the input by using different query, key and value matrices. In multi-head self-attention, the output of the $N _ { h }$ heads of output dimension $D _ { h }$ are concatenated and projected to dimension $D _ { o u t }$ as follows:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\operatorname { M H S A } ( X ) : = \operatorname { c o n c a t } _ { h \in [ N _ { h } ] } \left[ \operatorname { S e l f - A t t e n t i o n } _ { h } ( X ) \right] W _ { o u t } + b _ { o u t }
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
and two new parameters are introduced: the projection matrix $W _ { o u t } \in \mathbb { R } ^ { N _ { h } D _ { h } \times D _ { o u t } }$ and a bias term bout ∈ RDout .
|
| 62 |
+
|
| 63 |
+
# 2.2 ATTENTION FOR IMAGES
|
| 64 |
+
|
| 65 |
+
Convolutional layers are the de facto choice for building neural networks that operate on images. We recall that, given an image tensor $\pmb { \mathsf { X } } \in \mathbb { R } ^ { W \times H \times D _ { i n } }$ of width $W$ , height $H$ and $D _ { i n }$ channels, the output of a convolutional layer for pixel $( i , j )$ is given by
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\mathrm { C o n v } ( \boldsymbol { X } ) _ { i , j , : } : = \sum _ { ( \delta _ { 1 } , \delta _ { 2 } ) \in \Delta _ { K } } \mathsf { X } _ { i + \delta _ { 1 } , j + \delta _ { 2 } , : } \mathsf { W } _ { \delta _ { 1 } , \delta _ { 2 } , : , : } + \boldsymbol { b } ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $\boldsymbol { \mathsf { W } }$ is the $K \times K \times D _ { i n } \times D _ { o u t }$ weight tensor 4, $\pmb { b } \in \mathbb { R } ^ { D _ { o u t } }$ is the bias vector and the set
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\mathbb { \Delta } _ { K } : = \left[ - \left\lfloor { \frac { K } { 2 } } \right\rfloor , \cdots , \left\lfloor { \frac { K } { 2 } } \right\rfloor \right] \times \left[ - \left\lfloor { \frac { K } { 2 } } \right\rfloor , \cdots , \left\lfloor { \frac { K } { 2 } } \right\rfloor \right]
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
contains all possible shifts appearing when convolving the image with a $K \times K$ kernel.
|
| 78 |
+
|
| 79 |
+
In the following, we review how self-attention can be adapted from 1D sequences to images.
|
| 80 |
+
|
| 81 |
+
With images, rather than tokens, we have query and key pixels $q , k \in [ W ] \times [ H ]$ . Accordingly, the input is a tensor $\pmb { \chi }$ of dimension $W \times H \times D _ { i n }$ and each attention score associates a query and a key pixel.
|
| 82 |
+
|
| 83 |
+
To keep the formulas consistent with the 1D case, we abuse notation and slice tensors by using a 2D index vector: if $\mathbf { \boldsymbol { p } } = ( i , j )$ , we write $\mathsf { \pmb X } _ { p } ,$ : and $\mathsf { \pmb { A } } _ { p } ,$ : to mean $\mathsf { X } _ { i , j } ,$ : and $\mathsf { \pmb { A } } _ { i , j , : , : }$ , respectively. With this notation in place, the multi-head self attention layer output at pixel $\pmb q$ can be expressed as follows:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\mathrm { S e l f - A t t e n t i o n } ( X ) _ { q , : } = \sum _ { k } \mathrm { s o f t m a x } \left( \mathbb { A } _ { q , : } \right) _ { k } \mathbb { X } _ { k , : } W _ { \nu a l }
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
and accordingly for the multi-head case.
|
| 90 |
+
|
| 91 |
+
# 2.3 POSITIONAL ENCODING FOR IMAGES
|
| 92 |
+
|
| 93 |
+
There are two types of positional encoding that has been used in transformer-based architectures: the absolute and relative encoding (see also Table 3 in the Appendix).
|
| 94 |
+
|
| 95 |
+
With absolute encodings, a (fixed or learned) vector $\mathsf { P } _ { p } ,$ ,: is assigned to each pixel $\pmb { p }$ . The computation of the attention scores we saw in eq. (2) can then be decomposed as follows:
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\begin{array} { r l } & { \pmb { \mathrm { A } } _ { q , k } ^ { \mathrm { a b s } } = ( \pmb { \mathrm { X } } _ { q , : } + \pmb { \mathrm { P } } _ { q , : } ) W _ { q r y } W _ { k e y } ^ { \top } ( \pmb { \mathrm { X } } _ { k , : } + \pmb { \mathrm { P } } _ { k , : } ) ^ { \top } } \\ & { \qquad = \pmb { \mathrm { X } } _ { q , : } W _ { q r y } W _ { k e y } ^ { \top } \pmb { \mathrm { X } } _ { k , : } ^ { \top } + \pmb { \mathrm { X } } _ { q , : } W _ { q r y } W _ { k e y } ^ { \top } \pmb { \mathrm { P } } _ { k , : } ^ { \top } + \pmb { \mathrm { P } } _ { q , : } W _ { q r y } W _ { k e y } ^ { \top } \pmb { \mathrm { X } } _ { k , : } + \pmb { \mathrm { P } } _ { q , : } W _ { q r y } W _ { k e y } ^ { \top } \pmb { \mathrm { P } } _ { k , : } } \end{array}
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $\pmb q$ and $\boldsymbol { k }$ correspond to the query and key pixels, respectively.
|
| 102 |
+
|
| 103 |
+
The relative positional encoding was introduced by Dai et al. (2019). The main idea is to only consider the position difference between the query pixel (pixel we compute the representation of) and the key pixel (pixel we attend) instead of the absolute position of the key pixel:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\begin{array} { r } { \pmb { \mathsf { A } } _ { q , k } ^ { \mathrm { r e l } } : = \pmb { \mathsf { X } } _ { q , : } ^ { \top } W _ { q r y } ^ { \top } W _ { k e y } \pmb { \mathsf { X } } _ { k , : } + \pmb { \mathsf { X } } _ { q , : } ^ { \top } W _ { q r y } ^ { \top } \widehat { W } _ { k e y } \pmb { r } _ { \delta } + \boldsymbol { u } ^ { \top } W _ { k e y } \pmb { \mathsf { X } } _ { k , : } + \boldsymbol { v } ^ { \top } \widehat { W } _ { k e y } \pmb { r } _ { \delta } } \end{array}
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
In this manner, the attention scores only depend on the shift $\delta : = k - q$ . Above, the learnable vectors $\textbf { \em u }$ and $\pmb { v }$ are unique for each head, whereas for every shift $\delta$ the relative positional encoding $\boldsymbol { r } _ { \delta } \in \mathbb { R } ^ { D _ { p } }$ is shared by all layers and heads. Moreover, now the key weights are split into two types: $W _ { k e y }$ pertain to the input and $\widehat { W } _ { k e y }$ to the relative position of pixels.
|
| 110 |
+
|
| 111 |
+
# 3 SELF-ATTENTION AS A CONVOLUTIONAL LAYER
|
| 112 |
+
|
| 113 |
+
This section derives sufficient conditions such that a multi-head self-attention layer can simulate a convolutional layer. Our main result is the following:
|
| 114 |
+
|
| 115 |
+
Theorem 1. A multi-head self-attention layer with $N _ { h }$ heads of dimension $D _ { h }$ , output dimension $D _ { o u t }$ and a relative positional encoding of dimension $D _ { p } \geq 3$ can express any convolutional layer of kernel size $\sqrt { N _ { h } } \times \sqrt { N _ { h } }$ and $\operatorname* { m i n } ( D _ { h } , D _ { o u t } )$ output channels.
|
| 116 |
+
|
| 117 |
+
4To simplify notation, we index the first two dimensions of the tensor from $- \lfloor K / 2 \rfloor$ to $\lfloor K / 2 \rfloor$
|
| 118 |
+
|
| 119 |
+
The theorem is proven constructively by selecting the parameters of the multi-head self-attention layer so that the latter acts like a convolutional layer. In the proposed construction, the attention scores of each self-attention head should attend to a different relative shift within the set $\Delta _ { K } =$ $\{ - \lfloor K / 2 \rfloor , \ldots , \lfloor K / 2 \rfloor \} ^ { 2 }$ of all pixel shifts in a $K \times K$ kernel. The exact condition can be found in the statement of Lemma 1.
|
| 120 |
+
|
| 121 |
+
Then, Lemma 2 shows that the aforementioned condition is satisfied for the relative positional encoding that we refer to as the quadratic encoding:
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
\pmb { v } ^ { ( h ) } : = - \alpha ^ { ( h ) } \left( 1 , - 2 \pmb { \Delta } _ { 1 } ^ { ( h ) } , - 2 \pmb { \Delta } _ { 2 } ^ { ( h ) } \right) \quad r _ { \delta } : = \left( \| \delta \| ^ { 2 } , \delta _ { 1 } , \delta _ { 2 } \right) \quad W _ { q r \gamma } = W _ { k e \gamma } : = \mathbf { 0 } \quad \widehat { W _ { k e \gamma } } : = I
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
The learned parameters $\Delta ^ { ( h ) } = ( \Delta _ { 1 } ^ { ( h ) } , \Delta _ { 2 } ^ { ( h ) } )$ and $\alpha ^ { ( h ) }$ determine the center and width of attention of each head, respectively. On the other hand, $\pmb { \delta } = ( \delta _ { 1 } , \delta _ { 2 } )$ is fixed and expresses the relative shift between query and key pixels.
|
| 128 |
+
|
| 129 |
+
It is important to stress that the above encoding is not the only one for which the conditions of Lemma 1 are satisfied. In fact, in our experiments, the relative encoding learned by the neural network also matched the conditions of the lemma (despite being different from the quadratic encoding). Nevertheless, the encoding defined above is very efficient in terms of size, as only $D _ { p } = 3$ dimensions suffice to encode the relative position of pixels, while also reaching similar or better empirical performance (than the learned one).
|
| 130 |
+
|
| 131 |
+
The theorem covers the general convolution operator as defined in eq. (17). However, machine learning practitioners using differential programming frameworks (Paszke et al., 2017; Abadi et al., 2015) might question if the theorem holds for all hyper-parameters of 2D convolutional layers:
|
| 132 |
+
|
| 133 |
+
• Padding: a multi-head self-attention layer uses by default the "SAME" padding while a convolutional layer would decrease the image size by $K - 1$ pixels. The correct way to alleviate these boundary effects is to pad the input image with $\lfloor K / 2 \rfloor$ zeros on each side. In this case, the cropped output of a MHSA and a convolutional layer are the same. • Stride: a strided convolution can be seen as a convolution followed by a fixed pooling operation—with computational optimizations. Theorem 1 is defined for stride 1, but a fixed pooling layer could be appended to the Self-Attention layer to simulate any stride. • Dilation: a multi-head self-attention layer can express any dilated convolution as each head can attend a value at any pixel shift and form a (dilated) grid pattern.
|
| 134 |
+
|
| 135 |
+
Remark for the 1D case. Convolutional layers acting on sequences are commonly used in the literature for text (Kim, 2014), as well as audio (van den Oord et al., 2016) and time series (Franceschi et al., 2019). Theorem 1 can be straightforwardly extended to show that multi-head self-attention with $N _ { h }$ heads can also simulate a 1D convolutional layer with a kernel of size $K \ : = \ : N _ { h }$ with $\operatorname* { m i n } ( D _ { h } , D _ { o u t } )$ output channels using a positional encoding of dimension $D _ { p } \geq 2$ . Since we have not tested empirically if the preceding construction matches the behavior of 1D self-attention in practice, we cannot claim that it actually learns to convolve an input sequence—only that it has the capacity to do so.
|
| 136 |
+
|
| 137 |
+
# PROOF OF MAIN THEOREM
|
| 138 |
+
|
| 139 |
+
The proof follows directly from Lemmas 1 and 2 stated below:
|
| 140 |
+
|
| 141 |
+
Lemma 1. Consider a multi-head self-attention layer consisting of $N _ { h } = K ^ { 2 }$ heads, $D _ { h } \geq D _ { o u t }$ and let $f ~ : ~ [ N _ { h } ] ~ ~ \mathbb { \Delta } _ { K }$ be a bijective mapping of heads onto shifts. Further, suppose that for every head the following holds:
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\mathrm { s o f t m a x } ( A _ { q , : } ^ { ( h ) } ) _ { k } = \left\{ \begin{array} { l l } { { 1 } } & { { \ i f f ( h ) = q - k } } \\ { { 0 } } & { { \ o t h e r w i s e . } } \end{array} \right.
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
Then, for any convolutional layer with a $K \times K$ kernel and $D _ { o u t }$ output channels, there exists $\{ W _ { \nu a l } ^ { ( h ) } \} _ { h \in [ N _ { h } ] }$ such that $\mathrm { M H S A } ( X ) = \operatorname { C o n v } ( X )$ for every $\pmb { X } \in \mathbb { R } ^ { W \times H \times D _ { i n } }$ .
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
Figure 1: Illustration of a Multi-Head Self-Attention layer applied to a tensor image $\pmb { \chi }$ . Each head $h$ attends pixel values around shift ∆(h) and learn a filter matrix W (h)val . We show attention maps computed for a query pixel at position $\pmb q$ .
|
| 151 |
+
|
| 152 |
+
Proof. Our first step will be to rework the expression of the Multi-Head Self-Attention operator from equation (1) and equation (4) such that the effect of the multiple heads becomes more transparent:
|
| 153 |
+
|
| 154 |
+
$$
|
| 155 |
+
\mathrm { M H S A } ( { \pmb X } ) = b _ { o u t } + \sum _ { h \in [ N _ { h } ] } \mathrm { s o f t m a x } ( { \pmb A } ^ { ( h ) } ) { \pmb X } \underbrace { W _ { v a l } ^ { ( h ) } W _ { o u t } [ ( h - 1 ) D _ { h } + 1 : h D _ { h } + 1 ] } _ { { \pmb W } ^ { ( h ) } }
|
| 156 |
+
$$
|
| 157 |
+
|
| 158 |
+
Note that each head’s value matrix W (h)val $W _ { \nu a l } ^ { ( h ) } \in \mathbb { R } ^ { D _ { i n } \times D _ { h } }$ and each block of the projection matrix $W _ { o u t }$ of dimension $D _ { h } \times D _ { o u t }$ are learned. Assuming that $D _ { h } \ \ge \ D _ { o u t }$ , we can replace each pair of matrices by a learned matrix $W ^ { ( h ) }$ for each head. We consider one output pixel of the multi-head self-attention:
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
\mathrm { M H S A } ( \boldsymbol { X } ) _ { q , : } = \sum _ { h \in [ N _ { h } ] } \left( \sum _ { k } \mathrm { s o f t m a x } ( \pmb { \mathscr { A } } _ { q , : } ^ { ( h ) } ) _ { k } \pmb { \mathscr { X } } _ { k , : } \right) \boldsymbol { W } ^ { ( h ) } + b _ { o u t }
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
Due to the conditions of the Lemma, for the $h$ -th attention head the attention probability is one when $\pmb { k } = \pmb { q } - \pmb { f } ( h )$ and zero otherwise. The layer’s output at pixel $\pmb q$ is thus equal to
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
\mathrm { M H S A } ( \mathbf { X } ) _ { q } = \sum _ { h \in [ N _ { h } ] } \mathbf { X } _ { q - f ( h ) , : } \mathbf { { { W } } } ^ { ( h ) } + \pmb { b } _ { o u t }
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
For $K = \sqrt { N _ { h } }$ , the above can be seen to be equivalent to a convolutional layer expressed in eq. 17: there is a one to one mapping (implied by map $f$ ) between the matrices $W ^ { ( \bar { h } ) }$ for $h = [ N _ { h } ]$ and the matrices $\mathsf { W } _ { k _ { 1 } , k _ { 2 } , : , : }$ for all $( k _ { 1 } , k _ { 2 } ) \in [ K ] ^ { 2 }$ . □
|
| 171 |
+
|
| 172 |
+
Remark about $D _ { h }$ and $D _ { o u t }$ . It is frequent in transformer-based architectures to set $D _ { h } ~ = ~ D _ { o u t } / N _ { h }$ , hence $D _ { h } < D _ { o u t }$ . In that case, $W ^ { ( h ) }$ can be seen to be of rank $D _ { o u t } - D _ { h }$ , which does not suffice to express every convolutional layer with $D _ { o u t }$ channels. Nevertheless, it can be seen that any $D _ { h }$ out of $D _ { o u t }$ outputs of $\operatorname { M H S A } ( X )$ can express the output of any convolutional layer with $D _ { h }$ output channels. To cover both cases, in the statement of the main theorem we assert that the output channels of the convolutional layer should be $\operatorname* { m i n } ( D _ { h } , D _ { o u t } )$ . In practice, we advise to concatenate heads of dimension $D _ { h } = D _ { o u t }$ instead of splitting the $D _ { o u t }$ dimensions among heads to have exact re-parametrization and no “unused” channels.
|
| 173 |
+
|
| 174 |
+
Lemma 2. There exists a relative encoding scheme $\{ r _ { \delta } \in \mathbb { R } ^ { D _ { p } } \} _ { \pmb { \delta } \in \mathbb { Z } ^ { 2 } }$ with $D _ { p } \geq 3$ and parameters $W _ { q r y }$ , $W _ { k e y }$ , $\widehat { W } _ { k e y } , u$ with $D _ { p } \leq D _ { k }$ such that, for every $\pmb { \Delta } \in \mathbb { \Delta } _ { K }$ there exists some vector $\textbf { { v } }$ (conditioned on $\pmb { \Delta }$ ) yielding softm $\arg ( \mathbf { A } _ { q , : } ) _ { k } = 1 i f k - q = \Delta$ and zero, otherwise.
|
| 175 |
+
|
| 176 |
+
Proof. We show by construction the existence of a $D _ { p } = 3$ dimensional relative encoding scheme yielding the required attention probabilities.
|
| 177 |
+
|
| 178 |
+
As the attention probabilities are independent of the input tensor $\pmb { \chi }$ , we set $\boldsymbol { W _ { k e y } } = \boldsymbol { W _ { q r y } } = \mathbf { 0 }$ which leaves only the last term of eq. (8). Setting $\widehat { \pmb { W } } _ { k e y } \in \mathbb { R } ^ { D _ { k } \times D _ { p } }$ to the identity matrix (with appropriate row padding), yields $\pmb { \mathsf { A } } _ { q , \pmb { k } } = \pmb { v } ^ { \top } \pmb { r } _ { \delta }$ where $\delta : = k - q$ . Above, we have assumed that $D _ { p } \leq D _ { k }$ such that no information from $\mathbf { \Delta } _ { \pmb { r } \delta }$ is lost.
|
| 179 |
+
|
| 180 |
+
Now, suppose that we could write:
|
| 181 |
+
|
| 182 |
+
$$
|
| 183 |
+
\mathsf { \pmb { A } } _ { q , k } = - \alpha ( \| \pmb { \delta } - \pmb { \Delta } \| ^ { 2 } + c )
|
| 184 |
+
$$
|
| 185 |
+
|
| 186 |
+
for some constant $c$ . In the above expression, the maximum attention score over $\mathsf { \pmb { A } } _ { \pmb { q } , }$ ,: is $- \alpha c$ and it is reached for $\pmb { \Delta } _ { q , k }$ with $\delta = \Delta$ . On the other hand, the $\alpha$ coefficient can be used to scale arbitrarily the difference between $\mathsf { \pmb { A } } _ { q , \Delta }$ and the other attention scores.
|
| 187 |
+
|
| 188 |
+
In this way, for $\delta = \Delta$ , we have
|
| 189 |
+
|
| 190 |
+
$$
|
| 191 |
+
\begin{array} { l } { { \displaystyle \operatorname* { l i m } _ { \imath \to \infty } \mathrm { s o f t m a x } ( \mathbb { A } _ { q , : } ) _ { k } = \operatorname* { l i m } _ { \alpha \to \infty } \frac { e ^ { - \alpha ( \| \delta - \Delta \| ^ { 2 } + c ) } } { \sum _ { k ^ { \prime } } e ^ { - \alpha ( \| ( k - q ^ { \prime } ) - \Delta \| ^ { 2 } + c ) } } } \ ~ } \\ { { \displaystyle = \operatorname* { l i m } _ { \alpha \to \infty } \frac { e ^ { - \alpha \| \delta - \Delta \| ^ { 2 } } } { \sum _ { k ^ { \prime } } e ^ { - \alpha \| ( k - q ^ { \prime } ) - \Delta \| ^ { 2 } } } = \frac { 1 } { 1 + \operatorname* { l i m } _ { \alpha \to \infty } \sum _ { k ^ { \prime } \neq k } e ^ { - \alpha \| ( k - q ^ { \prime } ) - \Delta \| ^ { 2 } } } = 1 } } \end{array}
|
| 192 |
+
$$
|
| 193 |
+
|
| 194 |
+
and for $\delta \neq \Delta$ , the equation becomes $\begin{array} { r } { \operatorname* { l i m } _ { \alpha \infty } \mathrm { s o f t m a x } ( \pmb { \mathsf { A } } _ { q , : } ) _ { k } = 0 } \end{array}$ , exactly as needed to satisfy the lemma statement.
|
| 195 |
+
|
| 196 |
+
What remains is to prove that there exist $\textbf { { v } }$ and $\{ r _ { \delta } \} _ { \delta \in \mathbb { Z } ^ { 2 } }$ for which eq. (14) holds. Expanding the RHS of the equation, we have $- \alpha ( \| \pmb { \delta } - \pmb { \Delta } \| ^ { 2 } + \underline { { { c } } } ) = - \alpha ( \| \pmb { \delta } \| ^ { 2 } + \| \pmb { \Delta } \| ^ { 2 } - 2 \langle \pmb { \delta } , \pmb { \Delta } \rangle + c )$ . Now if we set $v = - \alpha \left( 1 , - 2 \Delta _ { 1 } , - 2 \Delta _ { 2 } \right)$ and $r _ { \delta } = ( \| \delta \| ^ { 2 } , \delta _ { 1 } , \delta _ { 2 } )$ , then
|
| 197 |
+
|
| 198 |
+
$$
|
| 199 |
+
\lambda _ { q , k } = v ^ { \top } r _ { \delta } = - \alpha \big ( \| \delta \| ^ { 2 } - 2 \Delta _ { 1 } \delta _ { 1 } - 2 \Delta _ { 2 } \delta _ { 2 } \big ) = - \alpha \big ( \| \delta \| ^ { 2 } - 2 \langle \delta , \Delta \rangle \big ) = - \alpha \big ( \| \delta - \Delta \| ^ { 2 } - \| \Delta \| ^ { 2 } \big ) ,
|
| 200 |
+
$$
|
| 201 |
+
|
| 202 |
+
which matches eq. (14) with $c = - \| \Delta \| ^ { 2 }$ and the proof is concluded.
|
| 203 |
+
|
| 204 |
+
Remark on the magnitude of $\alpha$ . The exact representation of one pixel requires $\alpha$ (or the matrices $W _ { q r y }$ and $W _ { k e y , }$ ) to be arbitrary large, despite the fact that the attention probabilities of all other pixels converge exponentially to 0 as $\alpha$ grows. Nevertheless, practical implementations always rely on finite precision arithmetic for which a constant $\alpha$ suffices to satisfy our construction. For instance, since the smallest positive float32 scalar is approximately $1 0 ^ { - 4 \bar { 5 } }$ , setting $\alpha = 4 6$ would suffice to obtain hard attention.
|
| 205 |
+
|
| 206 |
+
# 4 EXPERIMENTS
|
| 207 |
+
|
| 208 |
+
The aim of this section is to validate the applicability of our theoretical results—which state that self-attention can perform convolution—and to examine whether self-attention layers in practice do actually learn to operate like convolutional layers when trained on standard image classification tasks. In particular, we study the relationship between self-attention and convolution with quadratic and learned relative positional encodings. We find that, for both cases, the attention probabilities learned tend to respect the conditions of Lemma 1, supporting our hypothesis.
|
| 209 |
+
|
| 210 |
+
# 4.1 IMPLEMENTATION DETAILS
|
| 211 |
+
|
| 212 |
+
We study a fully attentional model consisting of six multi-head self-attention layers. As it has already been shown by Bello et al. (2019) that combining attention features with convolutional features improves performance on Cifar-100 and ImageNet, we do not focus on attaining state-of-the-art performance. Nevertheless, to validate that our model learns a meaningful classifier, we compare it to the standard ResNet18 (He et al., 2015) on the CIFAR-10 dataset (Krizhevsky et al.). In all experiments, we use a $2 \times 2$ invertible down-sampling (Jacobsen et al., 2018) on the input to reduce the size of the image. As the size of the attention coefficient tensors (stored during forward) scales quadratically with the size of the input image, full attention cannot be applied to bigger images. The fixed size representation of the input image is computed as the average pooling of the last layer representations and given to a linear classifier.
|
| 213 |
+
|
| 214 |
+

|
| 215 |
+
Figure 2: Test accuracy on CIFAR-10.
|
| 216 |
+
|
| 217 |
+
Table 1: Test accuracy on CIFAR-10 and model sizes. SA stands for Self-Attention.
|
| 218 |
+
|
| 219 |
+
<table><tr><td>Models</td><td>accuracy</td><td># of params</td><td># of FLOPS</td></tr><tr><td>ResNet18</td><td>0.938</td><td>11.2M</td><td>1.1B</td></tr><tr><td>SA quadratic emb.</td><td>0.938</td><td>12.1M</td><td>6.2B</td></tr><tr><td>SA learned emb.</td><td>0.918</td><td>12.3M</td><td>6.2B</td></tr><tr><td>SA learned emb.+ content</td><td>0.871</td><td>29.5M</td><td>15B</td></tr></table>
|
| 220 |
+
|
| 221 |
+

|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
Figure 3: Centers of attention of each attention head (different colors) at layer 4 during the training with quadratic relative positional encoding. The central black square is the query pixel, whereas solid and dotted circles represent the $50 \%$ and $90 \%$ percentiles of each Gaussian, respectively.
|
| 225 |
+
|
| 226 |
+
We used the PyTorch library (Paszke et al., 2017) and based our implementation on PyTorch Transformers5. We release our code on Github6 and hyper-parameters are listed in Table 2 (Appendix).
|
| 227 |
+
|
| 228 |
+
Remark on accuracy. To verify that our self-attention models perform reasonably well, we display in Figure 6 the evolution of the test accuracy on CIFAR-10 over the 300 epochs of training for our self-attention models against a small ResNet (Table 1). The ResNet is faster to converge, but we cannot ascertain whether this corresponds to an inherent property of the architecture or an artifact of the adopted optimization procedures. Our implementation could be optimized to exploit the locality of Gaussian attention probabilities and reduce significantly the number of FLOPS. We observed that learned embeddings with content-based attention were harder to train probably due to their increased number of parameters. We believe that the performance gap can be bridged to match the ResNet performance, but this is not the focus of this work.
|
| 229 |
+
|
| 230 |
+
# 4.2 QUADRATIC ENCODING
|
| 231 |
+
|
| 232 |
+
As a first step, we aim to verify that, with the relative position encoding introduced in equation (9), attention layers learn to behave like convolutional layers. We train nine attention heads at each layer to be on par with the $3 \times 3$ kernels used predominantly by the ResNet architecture. The center of attention of each head $h$ is initialized to $\bar { \Delta ^ { ( h ) } } \sim \mathcal { N } ( \mathbf { 0 } , \bar { 2 } I _ { 2 } )$ .
|
| 233 |
+
|
| 234 |
+
Figure 3 shows how the initial positions of the heads (different colors) at layer 4 changed during training. We can see that after optimization, the heads attend on specific pixel of the image forming a grid around the query pixel. Our intuition that Self-Attention applied to images learns convolutional filters around the queried pixel is confirmed.
|
| 235 |
+
|
| 236 |
+
Figure 4 displays all attention head at each layer of the model at the end of the training. It can be seen that in the first few layers the heads tend to focus on local patterns (layers 1 and 2), while deeper layers (layers 3-6) also attend to larger patterns by positioning the center of attention further from the queried pixel position. We also include in the Appendix a plot of the attention positions for a higher number of heads $N _ { h } = 1 6$ ). Figure 14 displays both local patterns similar to CNN and long range dependencies. Interestingly, attention heads do not overlap and seem to take an arrangement maximizing the coverage of the input space.
|
| 237 |
+
|
| 238 |
+

|
| 239 |
+
Figure 4: Centers of attention of each attention head (different colors) for the 6 self-attention layers using quadratic positional encoding. The central black square is the query pixel, whereas solid and dotted circles represent the $50 \%$ and $90 \%$ percentiles of each Gaussian, respectively.
|
| 240 |
+
|
| 241 |
+
# 4.3 LEARNED RELATIVE POSITIONAL ENCODING
|
| 242 |
+
|
| 243 |
+
We move on to study the positional encoding used in practice by fully-attentional models on images.
|
| 244 |
+
|
| 245 |
+
We implemented the 2D relative positional encoding scheme used by (Ramachandran et al., 2019; Bello et al., 2019): we learn a $\lfloor D _ { p } / 2 \rfloor$ position encoding vector for each row and each column pixel shift. Hence, the relative positional encoding of a key pixel at position $\boldsymbol { k }$ with a query pixel at position $\pmb q$ is the concatenation of the row shift embedding $\delta _ { 1 }$ and the column shift embedding $\delta _ { 2 }$ (where $\pmb { \delta } = \pmb { k } - \pmb { q } )$ . We chose $D _ { p } = D _ { o u t } = 4 0 0$ in the experiment. We differ from their (unpublished) implementation in the following points: $( i )$ we do not use convolution stem and ResNet bottlenecks for downsampling, but only a $2 \times 2$ invertible downsampling layer (Jacobsen et al., 2018) at input, $( i i )$ we use $D _ { h } = D _ { o u t }$ instead of $D _ { h } = D _ { o u t } / N _ { h }$ backed by our theory that the effective number of learned filters is $\operatorname* { m i n } ( D _ { h } , D _ { o u t } )$ .
|
| 246 |
+
|
| 247 |
+
At first, we discard the input data and compute the attention scores solely as the last term of eq. (8). The attention probabilities of each head at each layer are displayed on Figure 5. The figure confirms our hypothesis for the first two layers and partially for the third: even when left to learn the positional encoding scheme from randomly initialized vectors, certain self-attention heads (depicted on the left) learn to attend to individual pixels, closely matching the condition of Lemma 1 and thus Theorem 1. At the same time, other heads pay attention to horizontally-symmetric but non-localized patterns, as well as to long-range pixel inter-dependencies.
|
| 248 |
+
|
| 249 |
+
We move on to a more realistic setting where the attention scores are computed using both positional and content-based attention (i.e., $q ^ { \top } \bar { k } + q ^ { \top } r$ in (Ramachandran et al., 2019)) which corresponds to a full-blown standalone self-attention model.
|
| 250 |
+
|
| 251 |
+
The attention probabilities of each head at each layer are displayed in Figure 6. We average the attention probabilities over a batch of 100 test images to outline the focus of each head and remove the dependency on the input image. Our hypothesis is confirmed for some heads of layer 2 and 3: even when left to learn the encoding from the data, certain self-attention heads only exploit positionbased attention to attend to distinct pixels at a fixed shift from the query pixel reproducing the receptive field of a convolutional kernel. Other heads use more content-based attention (see Figures 8 to 10 in Appendix for non-averaged probabilities) leveraging the advantage of Self-Attention over CNN which does not contradict our theory. In practice, it was shown by Bello et al. (2019) that combining CNN and self-attention features outperforms each taken separately. Our experiments shows that such combination is learned when optimizing an unconstrained fully-attentional model.
|
| 252 |
+
|
| 253 |
+
The similarity between convolution and multi-head self-attention is striking when the query pixel is slid over the image: the localized attention patterns visible in Figure 6 follow the query pixel. This characteristic behavior materializes when comparing Figure 6 with the attention probabilities at a different query pixel (see Figure 7 in Appendix). Attention patterns in layers 2 and 3 are not only localized but stand at a constant shift from the query pixel, similarly to convolving the receptive field of a convolutional kernel over an image. This phenomenon is made evident on our interactive website7. This tool is designed to explore different components of attention for diverse images with or without content-based attention. We believe that it is a useful instrument to further understand how MHSA learns to process images.
|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
Figure 5: Attention probabilities of each head (column) at each layer $( r o w )$ using learned relative positional encoding without content-based attention. The central black square is the query pixel. We reordered the heads for visualization and zoomed on the $7 \mathbf { x } 7$ pixels around the query pixel.
|
| 257 |
+
|
| 258 |
+

|
| 259 |
+
Figure 6: Attention probabilities for a model with 6 layers (rows) and 9 heads (columns) using learned relative positional encoding and content-content based attention. Attention maps are averaged over 100 test images to display head behavior and remove the dependence on the input content. The black square is the query pixel. More examples are presented in Appendix A.
|
| 260 |
+
|
| 261 |
+
# 5 RELATED WORK
|
| 262 |
+
|
| 263 |
+
In this section, we review the known differences and similarities between CNNs and transformers.
|
| 264 |
+
|
| 265 |
+
The use of CNN networks for text—at word level (Gehring et al., 2017) or character level (Kim, 2014)—is more seldom than transformers (or RNN). Transformers and convolutional models have been extensively compared empirically on tasks of Natural Language Processing and Neural Machine Translation. It was observed that transformers have a competitive advantage over convolutional model applied to text (Vaswani et al., 2017). It is only recently that Bello et al. (2019); Ramachandran et al. (2019) used transformers on images and showed that they achieve similar accuracy as ResNets. However, their comparison only covers performance and number of parameters and FLOPS but not expressive power.
|
| 266 |
+
|
| 267 |
+
Beyond performance and computational-cost comparisons of transformers and CNN, the study of expressiveness of these architectures has focused on their ability to capture long-term dependencies (Dai et al., 2019). Another interesting line of research has demonstrated that transformers are Turingcomplete (Dehghani et al., 2018; Perez et al., 2019), which is an important theoretical result but is ´ not informative for practitioners. To the best of our knowledge, we are the first to show that the class of functions expressed by a layer of self-attention encloses all convolutional filters.
|
| 268 |
+
|
| 269 |
+
The closest work in bridging the gap between attention and convolution is due to Andreoli (2019). They cast attention and convolution into a unified framework leveraging tensor outerproduct. In this framework, the receptive field of a convolution is represented by a “basis” tensor $\mathbf { \lambda } \mathbf { A } ~ \in ~ \mathbb { R } ^ { K \times K \times H \times W \times H \times W }$ . For instance, the receptive field of a classical $K \times K$ convolutional kernel would be encoded by $\mathsf { A } _ { \Delta , q , k } = \mathbb { 1 } \{ k - q \overset { - } { = } \Delta \}$ for $\pmb { \Delta } \in \mathbb { \Delta } _ { K }$ . The author distinguishes this index-based convolution with content-based convolution where $\pmb { \mathsf { A } }$ is computed from the value of the input, e.g., using a key/query dot-product attention. Our work moves further and presents sufficient conditions for relative positional encoding injected into the input content (as done in practice) to allow content-based convolution to express any index-based convolution. We further show experimentally that such behavior is learned in practice.
|
| 270 |
+
|
| 271 |
+
# 6 CONCLUSION
|
| 272 |
+
|
| 273 |
+
We showed that self-attention layers applied to images can express any convolutional layer (given sufficiently many heads) and that fully-attentional models learn to combine local behavior (similar to convolution) and global attention based on input content. More generally, fully-attentional models seem to learn a generalization of CNNs where the kernel pattern is learned at the same time as the filters—similar to deformable convolutions (Dai et al., 2017; Zampieri, 2019). Interesting directions for future work include translating existing insights from the rich CNNs literature back to transformers on various data modalities, including images, text and time series.
|
| 274 |
+
|
| 275 |
+
# ACKNOWLEDGMENTS
|
| 276 |
+
|
| 277 |
+
Jean-Baptiste Cordonnier is thankful to the Swiss Data Science Center (SDSC) for funding this work. Andreas Loukas was supported by the Swiss National Science Foundation (project “Deep Learning for Graph Structured Data”, grant number PZ00P2 179981).
|
| 278 |
+
|
| 279 |
+
# REFERENCES
|
| 280 |
+
|
| 281 |
+
Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, ´ Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Watten- ´ berg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. Software available from tensorflow.org.
|
| 282 |
+
|
| 283 |
+
Jean-Marc Andreoli. Convolution, attention and structure embedding. NeurIPS 2019 workshop on Graph Representation Learning, Dec 13, 2019, Vancouver, BC, Canada, 2019.
|
| 284 |
+
|
| 285 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015.
|
| 286 |
+
|
| 287 |
+
Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoc V. Le. Attention Augmented Convolutional Networks. arXiv:1904.09925 [cs], April 2019.
|
| 288 |
+
|
| 289 |
+
Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, and Yichen Wei. Deformable convolutional networks. CoRR, abs/1703.06211, 2017.
|
| 290 |
+
|
| 291 |
+
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G. Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context. CoRR, abs/1901.02860, 2019.
|
| 292 |
+
|
| 293 |
+
Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. CoRR, abs/1807.03819, 2018.
|
| 294 |
+
|
| 295 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018.
|
| 296 |
+
|
| 297 |
+
Jean-Yves Franceschi, Aymeric Dieuleveut, and Martin Jaggi. Unsupervised scalable representation learning for multivariate time series. In NeurIPS 2019, 2019.
|
| 298 |
+
|
| 299 |
+
Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. Convolutional sequence to sequence learning. CoRR, abs/1705.03122, 2017.
|
| 300 |
+
|
| 301 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015.
|
| 302 |
+
|
| 303 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, 1997.
|
| 304 |
+
|
| 305 |
+
Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 7132–7141, 2018.
|
| 306 |
+
|
| 307 |
+
Jorn-Henrik Jacobsen, Arnold W.M. Smeulders, and Edouard Oyallon. i-revnet: Deep invertible ¨ networks. In International Conference on Learning Representations, 2018.
|
| 308 |
+
|
| 309 |
+
Yoon Kim. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1746– 1751, Doha, Qatar, October 2014. Association for Computational Linguistics. doi: 10.3115/v1/ D14-1181.
|
| 310 |
+
|
| 311 |
+
Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research).
|
| 312 |
+
|
| 313 |
+
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in PyTorch. In NIPS Autodiff Workshop, 2017.
|
| 314 |
+
|
| 315 |
+
Jorge Perez, Javier Marinkovic, and Pablo Barcel ´ o. On the turing completeness of modern neural ´ network architectures. CoRR, abs/1901.03429, 2019.
|
| 316 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2018.
|
| 317 |
+
Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. CoRR, abs/1906.05909, 2019.
|
| 318 |
+
Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alexander ¨ Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
|
| 319 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. CoRR, abs/1706.03762, 2017.
|
| 320 |
+
Xiaolong Wang, Ross B. Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 7794–7803, 2018.
|
| 321 |
+
Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. Xlnet: Generalized autoregressive pretraining for language understanding. CoRR, abs/1906.08237, 2019.
|
| 322 |
+
Luca Zampieri. Geometric deep learning for volumetric computational fluid dynamics. pp. 67, 2019.
|
| 323 |
+
|
| 324 |
+
# APPENDIX
|
| 325 |
+
|
| 326 |
+
# A MORE EXAMPLES WITH CONTENT-BASED ATTENTION
|
| 327 |
+
|
| 328 |
+
We present more examples of attention probabilities computed by self-attention model. Figure 7 shows average attention at a different query pixel than Figure 6. Figures 8 to 10 display attention for single images.
|
| 329 |
+
|
| 330 |
+

|
| 331 |
+
Figure 7: Attention probabilities for a model with 6 layers (rows) and 9 heads (columns) using learned relative positional encoding and content-content attention. We present the average of 100 test images. The black square is the query pixel.
|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Figure 8: Attention probabilities for a model with 6 layers (rows) and 9 heads (columns) using learned relative positional encoding and content-content based attention. The query pixel (black square) is on the frog head.
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
Figure 9: Attention probabilities for a model with 6 layers (rows) and 9 heads (columns) using learned relative positional encoding and content-content based attention. The query pixel (black square) is on the horse head.
|
| 338 |
+
|
| 339 |
+

|
| 340 |
+
Figure 10: Attention probabilities for a model with 6 layers (rows) and 9 heads (columns) using learned relative positional encoding and content-content based attention. The query pixel (black square) is on the building in the background.
|
| 341 |
+
|
| 342 |
+
B HYPER-PARAMETERS USED IN OUR EXPERIMENTS
|
| 343 |
+
Table 2: Self-attention network parameters
|
| 344 |
+
|
| 345 |
+
<table><tr><td colspan="2">Hyper-parameters</td></tr><tr><td>number of layers number of heads hidden dimension intermediate dimension invertible pooling width dropout probability</td><td>6 9 400 512 2 0.1</td></tr><tr><td>layer normalization epsilon number of epochs batch size learning rate weight decay</td><td>10-12 300 100 0.1 0.0001 0.9</td></tr></table>
|
| 346 |
+
|
| 347 |
+
C POSITIONAL ENCODING REFERENCES
|
| 348 |
+
Table 3: Types of positional encoding used by transformers models applied to text (top) and images (bottom). When multiple encoding types have been tried, we report the one advised by the authors.
|
| 349 |
+
|
| 350 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">type of positional encoding</td><td rowspan="2">relative</td></tr><tr><td>sinusoids</td><td>learned</td><td>quadratic</td></tr><tr><td>Vaswani et al. (2017)</td><td>√</td><td></td><td></td><td></td></tr><tr><td>Radford et al. (2018)</td><td></td><td></td><td></td><td></td></tr><tr><td>Devlin et al. (2018)</td><td></td><td>√</td><td></td><td></td></tr><tr><td>Dai et al. (2019)</td><td>4</td><td></td><td></td><td>√</td></tr><tr><td>Yang et al. (2019)</td><td></td><td></td><td></td><td>√</td></tr><tr><td>Bello et al. (2019)</td><td></td><td>√</td><td></td><td>√</td></tr><tr><td>Ramachandran et al. (2019)</td><td></td><td></td><td></td><td>√</td></tr><tr><td>Our work</td><td></td><td><</td><td>√</td><td>√</td></tr></table>
|
| 351 |
+
|
| 352 |
+
# D GENERALIZED LEMMA 1
|
| 353 |
+
|
| 354 |
+
We present a generalization of Lemma 1 that replaces the necessity of hard attention (to single pixels) by a milder assumption: the attention probabilities should span the grid receptive field. The conditions of this Lemma are still satisfied by Lemma 2, hence Theorem 1 follows.
|
| 355 |
+
|
| 356 |
+
Lemma 3. Consider a multi-head self-attention layer consisting of $N _ { h } \ge K ^ { 2 }$ heads, $D _ { h } \geq D _ { o u t }$ and let $\omega : [ H ] \times [ W ] \to [ H W ]$ be a pixel indexing. Then, for any convolutional layer with a $K \times$ $K$ kernel and $D _ { o u t }$ output channels, there exists $\{ W _ { \nu a l } ^ { ( h ) } \} _ { h \in [ N _ { h } ] }$ and $W _ { o u t }$ such that $\mathrm { M H S A } ( { \pmb X } ) =$ $\mathrm { C o n v } ( { \pmb X } )$ for every $\pmb { \chi } \in \mathbb { R } ^ { W \times H \times D _ { i n } }$ if and only $i f ,$ for all $\pmb q \in [ H ] \times [ W ]$ , 8
|
| 357 |
+
|
| 358 |
+
$$
|
| 359 |
+
\mathrm { s p a n } ( \{ e _ { \omega ( \mathbf { q } + \Delta ) } \in \mathbb { R } ^ { H W } : \Delta \in \mathbb { \Delta } _ { K } \} ) \subseteq \mathrm { s p a n } ( \{ \mathrm { v e c t } ( \mathrm { s o f t m a x } ( \pmb { \hat { a } } _ { \mathbf { q } ; \cdot } ^ { ( h ) } ) ) : h \in [ N _ { h } ] \} ) .
|
| 360 |
+
$$
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 11: Factorization of the vectorized weight matrices $V _ { \pmb { q } } ^ { \mathrm { c o n v } }$ and $V _ { q } ^ { \mathrm { S A } }$ used to compute the output at position $\pmb q$ for an input image of dimension $H \times W$ . On the left: a convolution of kernel $2 \times 2$ , on the right: a self-attention with $N _ { h } = 5$ heads. $D _ { i n } = 2$ , $D _ { o u t } = 3$ in both cases.
|
| 364 |
+
|
| 365 |
+
Proof. Our first step will be to rework the expression of the Multi-Head Self-Attention operator from equation (1) and equation (4) such that the effect of the multiple heads becomes more transparent:
|
| 366 |
+
|
| 367 |
+
$$
|
| 368 |
+
\mathrm { M H S A } ( \mathbf { X } ) = b _ { o u t } + \sum _ { h \in [ N _ { h } ] } \mathrm { s o f t m a x } ( \mathbf { A } ^ { ( h ) } ) \mathbf { X } \underbrace { W _ { v a l } ^ { ( h ) } W _ { o u t } [ ( h - 1 ) D _ { h } + 1 : h D _ { h } + 1 ] } _ { W ^ { ( h ) } }
|
| 369 |
+
$$
|
| 370 |
+
|
| 371 |
+
Note that each head’s value matrix $W _ { \nu a l } ^ { ( h ) } \in \mathbb { R } ^ { D _ { i n } \times D _ { h } }$ and each block of the projection matrix $W _ { o u t }$ of dimension $D _ { h } \times D _ { o u t }$ are learned. Assuming that $D _ { h } \ \ge \ D _ { o u t }$ , we can replace each pair of matrices by a learned matrix $W ^ { ( h ) }$ for each head. We consider one output pixel of the multi-head self-attention and drop the bias term for simplicity:
|
| 372 |
+
|
| 373 |
+
$$
|
| 374 |
+
\mathrm { M H S A } ( \pmb { \mathsf { X } } ) _ { q ; \mathit { = } } \sum _ { h \in [ N _ { h } ] } \Big ( \sum _ { k } a _ { q , k } ^ { ( h ) } \pmb { \mathsf { X } } _ { k , : } \Big ) \pmb { W } ^ { ( h ) } = \sum _ { k } \pmb { \mathsf { X } } _ { k , : } \underbrace { \Big ( \sum _ { h \in [ N _ { h } ] } a _ { q , k } ^ { ( h ) } \pmb { W } ^ { ( h ) } \Big ) } _ { W _ { q , k } ^ { \mathrm { S A } } \in \mathbb { R } ^ { D _ { i n } \times D _ { o u t } } } ,
|
| 375 |
+
$$
|
| 376 |
+
|
| 377 |
+
with a(h)q,k $a _ { \pmb { q } , \pmb { k } } ^ { ( h ) } = \mathrm { s o f t m a x } ( \pmb { \mathsf { A } } _ { \pmb { q } , \colon } ^ { ( h ) } ) _ { \pmb { k } }$ . We rewrite the output of a convolution at pixel $\pmb q$ in the same manner:
|
| 378 |
+
|
| 379 |
+
$$
|
| 380 |
+
\operatorname { C o n v } ( \mathbf { X } ) _ { q , : } = \sum _ { \Delta \in \Delta _ { K } } \mathbf { X } _ { q + \Delta , : } \mathsf { W } _ { \Delta , : , : } = \sum _ { k \in [ H ] \times [ W ] } \mathbf { X } _ { k , : } \underbrace { \mathbb { 1 } _ { \{ k - q \in \Delta _ { K } \} } \mathbf { W } _ { k - q , : , : } } _ { W _ { q , k } ^ { \mathrm { c o n v } } \in \mathbb { R } ^ { D _ { i n } \times D _ { o u t } } } .
|
| 381 |
+
$$
|
| 382 |
+
|
| 383 |
+
Equality between equations (16) and (17) holds for any input $\pmb { \chi }$ if and only if the linear transformations for each pair of key/query pixels aweight matrices into matrices of dimension $\dot { W } _ { q , k } ^ { \mathrm { c o n v } } = W _ { q , k } ^ { \mathrm { S A } } \dot { \forall q } , k$ $D _ { i n } D _ { o u t } \times H W$ $V _ { \pmb { q } } ^ { \mathrm { c o n v } } : = [ \mathrm { v e c t } ( { W } _ { \pmb { q } , \pmb { k } } ^ { \mathrm { c o n v } } ) ] _ { { \pmb { k } } \in [ H ] \times [ W ] }$ and $V _ { \pmb { q } } ^ { \mathrm { S A } } : = [ \mathrm { v e c t } ( { W } _ { \pmb { q } , \pmb { k } } ^ { \mathrm { S A } } ) ] _ { \pmb { k } \in [ H ] \times [ W ] }$ . Hence, to show that $\mathrm { C o n v } ( \pmb { \mathsf { X } } ) = \mathrm { M H S A } ( \pmb { \mathsf { X } } )$ for all $\pmb { \chi }$ , we must show that $V _ { q } ^ { \mathrm { c o n v } } = V _ { q } ^ { \mathrm { S A } }$ for all $\pmb q$ .
|
| 384 |
+
|
| 385 |
+
q in the receptive field of pixel The matrix has a restricted support: only the columns associated with a pixel shift $\pmb q$ can be non-zero. This leads to the factorization $V _ { q } ^ { \mathrm { c o n v } } = W ^ { \mathrm { c o n v } } E _ { q }$ $\pmb { \Delta } \in \mathbb { \Delta } _ { K }$ displayed in Figure 11 where $W ^ { \mathrm { c o n v } } \in \mathbb R ^ { D _ { i n } D _ { o u t } \times K ^ { 2 } }$ and $E _ { q } \in \mathbb { R } ^ { K ^ { 2 } \times H W }$ . Given an ordering of the shifts $\pmb { \Delta } \in \mathbb { \Delta } _ { K }$ indexed by $j$ , set $( W ^ { \mathrm { c o n v } } ) _ { : , j } = \mathrm { v e c t } ( \mathbf { W } _ { \Delta , : , : } )$ and $( E _ { q } ) _ { j , : } = e _ { \omega ( q + \Delta ) } .$ . On the other hand, we decompose $V _ { q } ^ { \mathrm { S A } } = W ^ { \mathrm { S A } } A _ { q }$ with $( W ^ { \mathrm { S A } } ) _ { : , h } = \mathrm { v e c t } ( W ^ { ( h ) } )$ and $( \boldsymbol { A } _ { q } ) _ { h , i } = \boldsymbol { a } _ { \boldsymbol { q } , \omega ( i ) } ^ { ( h ) }$ .
|
| 386 |
+
|
| 387 |
+
The proof is concluded by showing that $\operatorname { r o w } ( E _ { q } ) \subseteq \operatorname { r o w } ( A _ { q } )$ is a necessary and sufficient condition for the existence of a $W ^ { \mathrm { S A } }$ such that any $V _ { q } ^ { \mathrm { c o n v } } = W ^ { \mathrm { c o n v } } E _ { q }$ can be written as $W ^ { \mathrm { S A } } A _ { q }$ .
|
| 388 |
+
|
| 389 |
+
Sufficient. Given that $\operatorname { r o w } ( E _ { q } ) \subseteq \operatorname { r o w } ( A _ { q } )$ , there exists $\Phi \in \mathbb { R } ^ { K ^ { 2 } \times N _ { h } }$ such that $E _ { q } = \Phi A _ { q }$ and a valid decomposition is $W ^ { \mathrm { S A } } = W ^ { \mathrm { c o n v } } \Phi$ which gives $W ^ { \mathrm { S A } } A _ { q } = V _ { q } ^ { \mathrm { c o n v } }$ .
|
| 390 |
+
|
| 391 |
+
Necessary. Assume there exists $\boldsymbol { x } \in \mathbb { R } ^ { H W }$ such that $\pmb { x } \in \operatorname { r o w } ( E _ { q } )$ and $\pmb { x } \not \in \operatorname { r o w } ( A _ { q } )$ and set $\pmb { x } ^ { \top }$ to be a row of $V _ { q } ^ { \mathrm { c o n v } }$ . Then, $W ^ { \mathrm { S A } } A _ { q } \ne V _ { q } ^ { \mathrm { c o n v } }$ for any $W ^ { \mathrm { S A } }$ and there is no possible decomposition.
|
| 392 |
+
|
| 393 |
+
# E GENERALIZED QUADRATIC POSITIONAL ENCODING
|
| 394 |
+
|
| 395 |
+
We noticed the similarity of the attention probabilities in the quadratic positional encoding (Section 3) to isotropic bivariate Gaussian distributions with bounded support:
|
| 396 |
+
|
| 397 |
+
$$
|
| 398 |
+
\mathrm { s o f t m a x } ( \pmb { \mathsf { A } } _ { q , : } ) _ { \pmb { k } } = \frac { e ^ { - \alpha \parallel ( \pmb { k } - \pmb { q } ) - \pmb { \Delta } \parallel ^ { 2 } } } { \sum _ { \pmb { k } ^ { \prime } \in [ W ] \times [ H ] } e ^ { - \alpha \parallel ( \pmb { k } ^ { \prime } - \pmb { q } ) - \pmb { \Delta } \parallel ^ { 2 } } } .
|
| 399 |
+
$$
|
| 400 |
+
|
| 401 |
+
Building on this observation, we further extended our attention mechanism to non-isotropic Gaussian distribution over pixel positions. Each head is parametrized by a center of attention $\pmb { \Delta }$ and a covariance matrix $\pmb { \Sigma }$ to obtain the following attention scores,
|
| 402 |
+
|
| 403 |
+
$$
|
| 404 |
+
{ \pmb A } _ { q , k } = - \frac { 1 } { 2 } ( { \pmb \delta } - { \pmb \Delta } ) ^ { \top } { \pmb \Sigma } ^ { - 1 } ( { \pmb \delta } - { \pmb \Delta } ) = - \frac { 1 } { 2 } { \pmb \delta } ^ { \top } { \pmb \Sigma } ^ { - 1 } { \pmb \delta } + { \pmb \delta } ^ { \top } { \pmb \Sigma } ^ { - 1 } { \pmb \Delta } - \frac { 1 } { 2 } { \pmb \Delta } ^ { \top } { \pmb \Sigma } ^ { - 1 } { \pmb \Delta } ,
|
| 405 |
+
$$
|
| 406 |
+
|
| 407 |
+
where, once more, $\delta = k - q$ . The last term can be discarded because the softmax is shift invariant and we rewrite the attention coefficient as a dot product between the head target vector $\textbf { { v } }$ and the relative position encoding $\mathbf { \Delta } _ { \pmb { r } \delta }$ (consisting of the first and second order combinations of the shift in pixels $\pmb { \delta }$ ):
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
\boldsymbol { v } = \frac { 1 } { 2 } ( 2 ( \boldsymbol { \Sigma } ^ { - 1 } \boldsymbol { \Delta } ) _ { 1 } , 2 ( \boldsymbol { \Sigma } ^ { - 1 } \boldsymbol { \Delta } ) _ { 2 } , - \boldsymbol { \Sigma } _ { 1 , 1 } ^ { - 1 } , - \boldsymbol { \Sigma } _ { 2 , 2 } ^ { - 1 } , - 2 \cdot \boldsymbol { \Sigma } _ { 1 , 2 } ^ { - 1 } ) ^ { \top } \mathrm { ~ a n d ~ } \boldsymbol { r } _ { \delta } = ( \delta _ { 1 } , \delta _ { 2 } , \delta _ { 1 } ^ { 2 } , \delta _ { 2 } ^ { 2 } , \delta _ { 1 } \delta _ { 2 } ) ^ { \top } .
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
Evaluation. We trained our model using this generalized quadratic relative position encoding. We were curious to see if, using the above encoding the self-attention model would learn to attend to non-isotropic groups of pixels—thus forming unseen patterns in CNNs. Each head was parametrized by $\pmb { \Delta } \in \mathbb { R } ^ { 2 }$ and $\bar { \mathbf { \boldsymbol { \Sigma } } } ^ { - 1 / 2 } \in \mathbb { R } ^ { 2 \times 2 }$ to ensure that the covariance matrix remained positive semi-definite. We initialized the center of attention to $\Delta ^ { ( h ) } \sim \mathcal { N } ( \mathbf { 0 } , 2 I _ { 2 } )$ and $\pmb { \Sigma } ^ { - 1 / 2 } = \pmb { I } _ { 2 } + \pmb { \mathcal { N } } ( \mathbf { 0 } , 0 . 0 1 \pmb { I } _ { 2 } )$ so that initial attention probabilities were close to an isotropic Gaussian. Figure 12 shows that the network did learn non-isotropic attention probability patterns, especially in high layers. Nevertheless, the fact that we do not obtain any performance improvement seems to suggest that attention non-isotropy is not particularly helpful in practice—the quadratic positional encoding suffices.
|
| 414 |
+
|
| 415 |
+

|
| 416 |
+
Figure 12: Centers of attention of each attention head (different colors) for the 6 self-attention layers using non-isotropic Gaussian parametrization. The central black square is the query pixel, whereas solid and dotted circles represent the $50 \%$ and $90 \%$ percentiles of each Gaussian, respectively.
|
| 417 |
+
|
| 418 |
+
Pruning degenerated heads. Some non-isotropic attention heads attend on “non-intuitive” patches of pixels: either attending a very thin stripe of pixels, when $\Sigma ^ { - 1 }$ was almost singular, or attending all pixels uniformly, when $\pmb { \Sigma } ^ { - 1 }$ was close to 0 (i.e. constant attention scores). We asked ourselves, are such attention patterns indeed useful for the model or are these heads degenerated and unused? To find out, we pruned all heads having largest eigen-values smaller than $1 0 ^ { - 5 }$ or condition number (ratio of the biggest and smallest eigen-values) greater than $1 0 ^ { 5 }$ . Specifically in our model with 6-layer and 9-heads each, we pruned $[ 2 , 4 , 1 , 2 , 6 , 0 ]$ heads from the first to the last layer. This means that these layers cannot express a $3 \times 3$ kernel anymore. As shown in yellow on fig. 2, this ablation initially hurts a bit the performance, probably due to off biases, but after a few epochs of continued training with a smaller learning rate (divided by 10) the accuracy recovers its unpruned value. Hence, without sacrificing performance, we reduce the size of the parameters and the number of FLOPS by a fourth.
|
| 419 |
+
|
| 420 |
+
# F INCREASING THE NUMBER OF HEADS
|
| 421 |
+
|
| 422 |
+
For completeness, we also tested increasing the number of heads of our architecture from 9 to 16.
|
| 423 |
+
|
| 424 |
+

|
| 425 |
+
Figure 13: Evolution of test accuracy on CIFAR10. Pruned model (yellow) is continued training of the non-isotropic model (orange).
|
| 426 |
+
|
| 427 |
+
<table><tr><td>Models</td><td>accuracy</td><td># of params</td><td># of FLOPS</td></tr><tr><td>ResNet18</td><td>0.938</td><td>11.2M</td><td>1.1B</td></tr><tr><td>SA quadratic emb.</td><td>0.938</td><td>12.1M</td><td>6.2B</td></tr><tr><td>SA quadratic emb. gen.</td><td>0.934</td><td>12.1M</td><td>6.2B</td></tr><tr><td>SA quadratic emb. gen. pruned</td><td>0.934</td><td>9.7M</td><td>4.9B</td></tr><tr><td>SA learned emb.</td><td>0.918</td><td>12.3M</td><td>6.2B</td></tr><tr><td>SA learned emb. + content</td><td>0.871</td><td>29.5M</td><td>15B</td></tr></table>
|
| 428 |
+
|
| 429 |
+

|
| 430 |
+
Table 4: Number of parameters and accuracy on CIFAR-10 per model. SA stands for SelfAttention.
|
| 431 |
+
Figure 14: Centers of attention for 16 attention heads (different colors) for the 6 self-attention layers using quadratic positional encoding. The central black square is the query pixel, whereas solid and dotted circles represent the $50 \%$ and $90 \%$ percentiles of each Gaussian, respectively.
|
| 432 |
+
|
| 433 |
+
Similar to Figure 4, we see that the network distinguishes two main types of attention patterns. Localized heads (i.e., those that attend to nearly individual pixels) appear more frequently in the first few layers. The self-attention layer uses these heads to act in a manner similar to how convolutional layers do. Heads with less-localized attention become more common at higher layers.
|
md/train/HJx38iC5KX/HJx38iC5KX.md
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DOMAIN GENERALIZATION VIA INVARIANT REPRESENTATION UNDER DOMAIN-CLASS DEPENDENCY
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Learning domain-invariant representation is a dominant approach for domain generalization, where we need to build a classifier that is robust toward domain shifts induced by change of users, acoustic or lighting conditions, etc. However, prior domain-invariance-based methods overlooked the underlying dependency of classes (target variable) on source domains during optimization, which causes the trade-off between classification accuracy and domain-invariance, and often interferes with the domain generalization performance. This study first provides the notion of domain generalization under domain-class dependency and elaborates on the importance of considering the dependency by expanding the analysis of Xie et al. (2017). We then propose a method, invariant feature learning under optimal classifier constrains (IFLOC), which explicitly considers the dependency and maintains accuracy while improving domain-invariance. Specifically, the proposed method regularizes the representation so that it has as much domain information as the class labels, unlike prior methods that remove all domain information. Empirical validations show the superior performance of IFLOC to baseline methods, supporting the importance of the domain-class dependency in domain generalization and the efficacy of the proposed method for overcoming the issue.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
In supervised learning problems we typically assume that samples are obtained from the same distribution in training and testing; however, such an assumption does not hold in many practical situations, depressing the classification accuracy for the test data (Torralba & Efros (2011)). One typical situation is domain generalization (e.g., Blanchard et al. (2011)): we have labeled data from several source domains and collectively exploit them so that the trained system generalizes to other, unseen but somewhat similar, target domains. Such challenges arise in many applications, e.g., hand-writing recognition (Shankar et al. (2018)), robust speech recognition (Sriram et al. (2018)), and sensor data interpretation (Erfani et al. (2016)).
|
| 12 |
+
|
| 13 |
+
To address domain generalization, many methods take advantage of invariant feature learning (Muandet et al. (2013); Erfani et al. (2016); Ghifary et al. (2017); Xie et al. (2017)). Such methods assume that learning the representation $( h )$ that is invariant to domains $( d )$ from input data $( x )$ prevents $h$ to overfit to source domains and leads to higher classification accuracy for unseen domains. To obtain such $h$ , we used various methods to measure the invariance of $h$ to $d$ and imposed some regularization on the measurement. For example, domain adversarial networks (DAN) (Ganin et al. (2016); Xie et al. (2017)) measure the invariance using a domain classifier (also called a discriminator) parameterized by deep neural networks and impose regularization by deceiving it.
|
| 14 |
+
|
| 15 |
+
Most prior works, however, overlooked the underlying dependency of classes on source domains, which we refer to as domain-class dependency. More specifically, we define domain-class dependency as the situation where domain and class labels are statistically dependent due to some common latent factor $( z )$ of $y$ and $d$ (Figure 1-right). Under the domain-class dependency, merely forcing the optimal domain-invariance harms the classification accuracy, as shown in Figure 1-(c). Intuitively speaking, since $y$ contains information about $d$ under domain-class dependency, $h$ must keep at least as much domain information as $y$ to achieve the optimal classification accuracy; however, invariant feature learning attempts to remove all domain information from $h$ , which causes the trade-off. It might be similar to the situation where $p ( y | x )$ and $p ( x )$ change across domains due to the causal structure $y x$ (Zhang et al. (2013); Gong et al. (2016) in domain adaptation and Li et al. (2018c) in domain generalization), which we call conditional probability shift. However, the shift does not cause the trade-off as long as $y$ and $\cdot$ are independent (Figure 1-left), so it is necessary to focus on the relationship between $\cdot$ and $\cdot$ .
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: The illustration of the domain-class dependency problem. While Li et al. (2018c) focused on the causal relationship between $x$ and $y$ , we focus on the relationship between $\cdot$ and $\cdot$ because it causes the following trade-off problem. (a) When domain and class are independent, domain invariance and classification accuracy can be optimized at the same time. (b,c) In domain-class dependency, there is a trade-off between these two: (b) optimal invariance cannot be achieved when optimal classification accuracy is achieved, and (c) vice versa. We propose a method to lead explicitly to (b) rather than (c), because the primary purpose for domain generalization is classification, not domain-invariance itself.
|
| 19 |
+
|
| 20 |
+
Unfortunately, domain-class dependency is common in real-world datasets as shown in Zhang et al. (2013). The dependency can be caused by both the characteristics of data and errors in collecting data. For example, the WISDM Activity Prediction dataset (Kwapisz et al. (2011)), where classes and domains correspond to activities and users, exhibits the dependency because (1) some activities (jogging and climbing stairs) are strenuous (data characteristics) and (2) other activities (sitting and standing) and some users were added only after the study began (data-collection errors).
|
| 21 |
+
|
| 22 |
+
In this paper, we address domain generalization under domain-class dependency. We first expand the analysis about DAN by Xie et al. (2017), show that domain-class dependency causes the tradeoff problem, and then derive a way to evade the trade-off. Specifically, we investigate the condition where the domain-invariance is maximized under the constraint that it does not interfere with classification accuracy (Figure 1 (b)), because the primary purpose of domain generalization is classification rather than domain-invariance itself. We then propose a novel method invariant feature learning under optimal classifier constraint (IFLOC), modifying DAN’s regularization term to make the learned representation have as much domain information as the class labels, i.e., $H ( d | h ) = H ( d | y )$ holds (here $H$ denotes entropy). Like DAN, IFLOC has an encoder, classifier, and domain discriminator, and also takes over the good properties of DAN: it does not depend on pre-defined metrics (e.g., maximum mean discrepancy (Tzeng et al. (2014))), and it can be trained in an end-to-end manner. Empirical validations show the superior performance of IFLOC to baseline methods, supporting the importance of considering domain-class dependency in domain generalization tasks and the efficacy of the proposed approach for overcoming the issue.
|
| 23 |
+
|
| 24 |
+
The main contributions of this paper can be summarized as follows. Firstly, we elaborate on the trade-off problem under domain-class dependency, both theoretically and experimentally, for the first time in domain generalization context. Secondly, to address the issue we provide theoretical analysis, which shows to what extent latent representations can become invariant to domains without interfering with classification accuracy. Finally, based on the analysis we propose a novel method IFLOC, and validated its efficacy by the experiments on both synthetic and real world datasets.
|
| 25 |
+
|
| 26 |
+
# 2 RELATED WORKS
|
| 27 |
+
|
| 28 |
+
Invariant feature learning is a general-purpose method applicable to domain generalization as well as to domain adaptation (e.g., Tzeng et al. (2014); Ganin et al. (2016)), style transfer (e.g., Lample et al. (2017); Chou et al. (2018)), and fairness-aware classification (e.g., Zemel et al. (2013);
|
| 29 |
+
|
| 30 |
+
Louizos et al. (2016); Madras et al. (2018)). However, it is likely that adjusting it to each specific task can improve performance. For example, in the fairness-aware classification task Madras et al. (2018) proposed to optimize the fairness criterion directly instead of applying invariance to sensitive variables. By analogy, we adapted invariant feature learning for domain generalization so as to address the domain-class dependency problem.
|
| 31 |
+
|
| 32 |
+
Domain generalization has been attracting considerable attention in recent years (Blanchard et al. (2011); Muandet et al. (2013); Shankar et al. (2018)). Note that it is different from domain adaptation in that we cannot obtain input and label data from target domain(s). Although the efficacy of domain-invariance-based methods had been known, Li et al. (2017) showed that non end-to-end methods such as DICA (Muandet et al. (2013)) and MTAE (Ghifary et al. (2015)) do not tend to outperform even vanilla CNN. Thus, end-to-end methods are desirable and can be divided into two categories: adversarial-learning-based methods such as DAN (Ganin et al. (2016); Xie et al. (2017)) and pre-defined-metric-based methods (e.g., Ghifary et al. (2017); Li et al. (2018b)).
|
| 33 |
+
|
| 34 |
+
In particular, IFLOC closely relates to DAN. Although DAN was originally invented for domain adaptation, Xie et al. (2017) showed its efficacy in domain generalization. Also, Xie et al. (2017) provided the intuitive explanation of the trade-off between classification accuracy and domain invariance. However, they did not provide any way to deal with the problem because its focus is invariant feature learning itself. Louppe et al. (2017) provided the similar analysis with Xie et al. (2017), but differs in that they focused on the relation between nuisance parameters (domains) and output distribution of a domain classifier. IFLOC also relates to domain confusion loss (Tzeng et al. (2015)) in that their encoders attempt to directly minimize Kullback-Leibler divergence (KLD) between output distribution of the discriminators and some domain distribution $( p ( d | y )$ in IFLOC and uniform distribution in domain confusion loss), rather than deceive the discriminator as DAN.
|
| 35 |
+
|
| 36 |
+
There are several studies that address domain generalization without utilizing invariant feature learning. For example, Motiian et al. (2017); Li et al. (2018c) proposed to make use of semantic alignment, which attempts to make latent representation given class label $( p ( h | y ) )$ identical within source domains. This approach was originally proposed in Gong et al. (2016) in domain adaptation context, but its efficacy for domain-class dependency is not obvious because it focuses on conditional probability shift. CrossGrad (Shankar et al. (2018)) is one of the recent state-of-the-art domain generalization methods, which utilizes data augmentation with adversarial examples. However, since the method relies on the assumption that $y$ and $d$ are independent, it might not be directly applicable to our setting. MLDG (Li et al. (2018a)), also one of the state-of-the-art methods, utilizes metalearning. Since it makes no assumption about the relation between $y$ and $d$ , it could be combined with our proposed method, though we have not experimentally confirmed it.
|
| 37 |
+
|
| 38 |
+
There are several kinds of distributional shifts other than domain-class dependency, such as conditional probability shift. Although the distinction between that shift and domain-class dependency is important, it has been received less attention. For example, Li et al. (2018c) claimed that conditional probability shift might harm the performance of domain-invariance-based methods, but our analysis in Sec.4.1.1 suggests that the root cause of the performance degradation is not it but domain-class dependency. They also proposed to correct the shift of $\cdot$ across source domains by aligning sampling frequency of each class across domains. However, this approach is not applicable to when some classes are rarely or never appear in some domains (e.g., as in WISDM dataset). In domain adaptation, Zhang et al. (2013); Gong et al. (2016) address the situation where $p ( y )$ changes across source and target domains by estimating $p ( y )$ change using unlabeled target data. However, this approach is not applicable (or necessary) to domain generalization because our problem setting is different from theirs in that we are agnostic on target domain and aim to care about $\cdot$ change within source domains instead.
|
| 39 |
+
|
| 40 |
+
# 3 PRELIMINARIES
|
| 41 |
+
|
| 42 |
+
# 3.1 PROBLEM STATEMENT OF DOMAIN GENERALIZATION
|
| 43 |
+
|
| 44 |
+
Denote $\mathcal { X } , \mathcal { y }$ , and $\mathcal { D }$ as the input feature, label, and domain spaces, respectively. With random variables $x \in { \mathcal { X } } , \ y \in { \mathcal { Y } }$ , and $d \in \mathcal { D }$ ,we can define the probability distribution for each domain $d$ as $p ( x , y | d )$ . Here, we assume that $y$ and $d$ are discrete variables for simplicity. In domain generalization, we are given a training dataset consisting of $D _ { s } = \{ x _ { i } ^ { s } , y _ { i } ^ { s } \} _ { i = 1 } ^ { n ^ { s } }$ for all $s \in \{ 1 , 2 , . . . , m \}$ . Here, each $D _ { s }$ corresponds to samples drawn from the source domain $p ( x , y | d = s )$ . Using the training dataset, we train a classifier $f : \mathcal { X } \mathcal { Y }$ , and use the classifier to predict labels of samples drawn from the unknown target domain $p ( x , y | d = t )$ .
|
| 45 |
+
|
| 46 |
+
# 3.2 DOMAIN ADVERSARIAL NETWORKS FOR DOMAIN GENERALIZATION
|
| 47 |
+
|
| 48 |
+
In this section, we give a brief overview of DAN (Ganin et al. (2016)) given that our proposed method is an extension of it. DAN trains a domain discriminator that attempts to predict domains from latent representations encoded by an encoder, while simultaneously trains the encoder to remove domain information by deceiving the discriminator. This procedure ensures that there is no or little domain information in the representations, so a label classifier attached to the encoder can make robust predictions regarding unseen target domains.
|
| 49 |
+
|
| 50 |
+
Formally, we denote $f _ { E } ( x ) , q _ { M } ( y | h )$ , and $q _ { D } ( d | h ) \ ( E , M$ , and $D$ are the parameters) as deterministic encoder, probabilistic model of label classifier, and that of domain discriminator, respectively. Then, the objective function of DAN is described as follows:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\operatorname* { m i n } _ { E , M } \operatorname* { m a x } _ { D } J ( E , M , D ) = \mathbb { E } _ { x , d , y \sim p ( x , d , y ) } [ \gamma \log q _ { D } ( d | h = f _ { E } ( x ) ) - \log q _ { M } ( y | h = f _ { E } ( x ) ) ] .
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
Here, the second term in Eq.1 simply maximizes the log likelihood of $q _ { M }$ as well as in standard classification problems. On the other hand, the first term corresponds to a minimax game between the encoder and discriminator, where the decoder $q _ { D } ( d | h )$ tries to predict $d$ from $h$ and the encoder $f _ { E } ( x )$ tries to fool $q _ { D } ( d | h )$ .
|
| 57 |
+
|
| 58 |
+
As Xie et al. (2017) originally showed, the minmax game ensures that the learned representation has no or little domain information, i.e., the representation becomes domain-invariant. Such invariance makes a prediction from $h$ to $y$ independent from $d$ , and therefore hopefully helps to build a classifier that correctly handle samples drawn from unknown domains. Below is a brief explanation.
|
| 59 |
+
|
| 60 |
+
Since $h$ is a deterministic mapping of $x$ , the joint probability distribution of $h , d$ and $y$ can be defined as follows:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\begin{array} { l } { \displaystyle \tilde { p } _ { E } ( h , d , y ) = \int _ { x } \tilde { p } _ { E } ( x , d , h , y ) d x } \\ { \displaystyle = \int _ { x } p ( x , d , y ) \delta ( f _ { E } ( x ) = h ) d x } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
Here, we use the notation of $\tilde { p } _ { E }$ for the true probability distribution that depends on the encoder’s parameter $E$ . Using Eq.2, Eq.1 can be replaced as follows:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\operatorname* { m i n } _ { E , M } \operatorname* { m a x } _ { D } J ( E , M , D ) = \mathbb { E } _ { h , d , y \sim \tilde { p } _ { E } ( h , d , y ) } [ \gamma \log q _ { D } ( d | h ) - \log q _ { M } ( y | h ) ]
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
Assuming $E$ is fixed, the solutions $M ^ { * }$ and $D ^ { * }$ to Eq.3 obviously satisfy $q _ { M ^ { * } } ( y | h ) = \tilde { p } _ { E } ( y | h )$ and $q _ { D ^ { * } } ( d | h ) = \tilde { p } _ { E } ( d | h )$ . Then, substituting $q _ { M ^ { * } }$ and $q _ { D ^ { * } }$ into Eq.3, we can obtain the following optimization problem depending only on $E$ :
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\displaystyle \operatorname* { m i n } _ { E } J ( E ) = - \gamma H _ { \tilde { p } _ { E } } ( d | h ) + H _ { \tilde { p } _ { E } } ( y | h )
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
Solving Eq.4, we can obtain the solutions $M ^ { * } , D ^ { * }$ , and $E ^ { * }$ , which are in Nash equilibrium. Here, $H _ { \tilde { p } _ { E } } ( d | h )$ means conditional entropy with joint probability distribution $\tilde { p } _ { E } ( d , h )$ . Thus, minimizing the second term in Eq.4 intuitively means learning (the mapping function $f _ { E }$ to) the latent representation $h$ which contains as much information about $y$ as possible. On the other hand, the first term can be regarded as a regularizer that attempts to learn $h$ which is invariant to $d$ .
|
| 79 |
+
|
| 80 |
+
# 4 OUR APPROACH
|
| 81 |
+
|
| 82 |
+
# 4.1 ANALYSIS OF DOMAIN-CLASS DEPENDENCY
|
| 83 |
+
|
| 84 |
+
We address domain generalization under domain-class dependency, i.e., the situation where $p ( y | d ) \neq p ( y )$ holds. Although the issue had been overlooked, it is common in real-world datasets given that they can have the dependency in nature, e.g., nocturnal annimals (class) do not tend to appear in daylight (domain), and the dependency in such datasets is often not corrected unlike in standard benchmark datasets. To address the problem, we expand the analysis of Xie et al. (2017) to theoretically show that domain-class dependency causes the trade-off between accuracy and invariance, and to consider to what extent the latent representation should become invariant.
|
| 85 |
+
|
| 86 |
+
# 4.1.1 TRADE-OFF CAUSED BY DOMAIN-CLASS DEPENDENCY
|
| 87 |
+
|
| 88 |
+
We first show that the performance of DAN explained in the previous section suffers from the existence of domain-class dependency. The following analysis also suggests that all of the methods that utilize domain-invariant representation suffer from the dependency. Concretely, we show that the domain-class dependency causes the trade-off between classification accuracy and domain invariance: when $d$ and $y$ are not statistically independent, any $E$ cannot optimize the first and second term in Eq.4 at the same time. In this analysis, for simplicity, we assume that we can obtain any $\tilde { p } _ { E } ( y | h ) , \tilde { p } _ { E } ( d | h )$ , i.e., the models have enough capacity and there are no optimization difficulties.
|
| 89 |
+
|
| 90 |
+
To begin with, we consider only the first term in Eq.4 and address the optimization problem:
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\operatorname* { m i n } _ { E } J _ { 1 } ( E ) = - \gamma H _ { \tilde { p } _ { E } } ( d | h )
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
Using the property of entropy, $H _ { \tilde { p } _ { E } } ( d | h )$ is bounded as follows:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
H _ { \tilde { p } _ { E } } ( d | h ) \leq H ( d )
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
Here, $H _ { \tilde { p } _ { E } } ( d | h ) = H ( d )$ holds only if $h$ and $d$ are independent. Thus, Eq.5 has the solution $E ^ { 1 * }$ , which satisfies the following condition:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
H _ { \tilde { p } _ { E ^ { 1 * } } } ( d | h ) = H ( d )
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
Eq.7 suggests that the regularizer in DAN is intended to remove all information about domains from latent variables, thereby making domains and latent variables independent.
|
| 109 |
+
|
| 110 |
+
Next, we analogically consider only the second term in Eq.4, thereby addressing the following optimization problem:
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\operatorname* { m i n } _ { E } J _ { 2 } ( E ) = H _ { \tilde { p } _ { E } } ( y | h )
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
Since conditional entropy $H ( a | b )$ has a minimum value when $b$ contains all information about $a$ , Eq.8 has the solution $E ^ { 2 * }$ , which satisfies the following equation:
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
H _ { \tilde { p } _ { E ^ { 2 * } } } ( d | h ) = H _ { \tilde { p } _ { E ^ { 2 * } } } ( d | h , y )
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
Using Eq.9 and the property of entropy: $H ( a | b , c ) \leq H ( a | b )$ , we can obtain the following condition:
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
H _ { \tilde { p } _ { E ^ { 2 * } } } ( d | h ) = H _ { \tilde { p } _ { E ^ { 2 * } } } ( d | h , y ) \leq H ( d | y )
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
Eq.10 implies that $h$ has at least as much information about $d$ as $y$ does. Now, we assume that $y$ and $d$ are not independent, i.e., domain-class dependency exists, and obtain the following condition:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
H _ { \tilde { p } _ { E ^ { 2 * } } } ( d | h ) \leq H ( d | y ) < H ( d )
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
Considering Eq.7 and Eq.11, $E ^ { 1 * } \neq E ^ { 2 * }$ holds. This means that when $y$ and $d$ are not independent, there is no solution $E$ that optimizes Eq.5 and Eq.8 at the same time, i.e., there is a trade-off between classification accuracy and domain invariance.
|
| 135 |
+
|
| 136 |
+
It is worth noting that although Li et al. (2018c) claimed that conditional probability shift (the causal structure $\cdot$ ) could harm the domain generalization performance of invariance-based methods, this analysis suggests that it does not harm DAN as long as domain and class are independent. It can be confirmed by considering Eq.7 and Eq.10; even when the shift occurs, i.e., $H ( y | x , d ) < H ( y | x )$ holds and then $H _ { \tilde { p } _ { E } } ( y | h , d ) \le H _ { \tilde { p } _ { E } } ( y | h )$ holds, it does not conflict with $H _ { \tilde { p } _ { E ^ { * } } } ( d | h ) = H ( d | y ) =$ $\cdot$ as long as $H ( d | y ) = H ( d )$ holds. In other words, we only need to infer latent variable $\cdot$ that satisfies the causal structure $y h x$ to avoid the trade-off. Although Gong et al. (2016) showed the similar result in domain adaptation context, it has been overlooked in domain generalization.
|
| 137 |
+
|
| 138 |
+
# 4.1.2 OPTIMAL DOMAIN-INVARIANCE UNDER DOMAIN-CLASS DEPENDENCY
|
| 139 |
+
|
| 140 |
+
If we cannot avoid the trade-off, the next question is how to deal with it, i.e., to what extent the representation should become domain-invariant for domain generalization tasks. We propose to maximize domain-invariance within a range that does not interfere with classification accuracy, rather than merely enforcing domain-invariance without any constraint. The reason for the constraint is that the primary purpose of domain generalization is classification for unseen domains rather than domain-invariance itself, and the improvement of the invariance could harm the classification performance for them. For example, in WISDM, if we know the target activity (class) was performed by not an old but yound man (domain), we can predict it was jogging with higher probability, so we should avoid removing such domain information that is useful in the classification task. As another example, if the target domain has the similar characteristics as a certain source domain (or as an extreme case, $p ( x , \bar { y } | d = s ) = p ( x , y | d = t )$ holds), giving priority to domain-invariance obviously interferes with the domain generalization performance.
|
| 141 |
+
|
| 142 |
+
Given that Eq.10 is the necessary condition where we can build an optimal classifier, we can write the optimization problem of maximizing domain-invariance within a range that does not interfere with classification accuracy as follows:
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
\begin{array} { r l } & { \underset { E } { \operatorname* { m i n } } J ( E ) = - \gamma H _ { \tilde { p } _ { E } } ( d | h ) } \\ & { \qquad s u b j e c t t o \ : H _ { \tilde { p } _ { E } } ( d | h ) \leq H ( d | y ) } \end{array}
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
Continuing, we can obtain the solution $E ^ { * }$ , which obviously satisfies $H _ { \tilde { p } _ { E ^ { * } } } ( d | h ) = H ( d | y )$ . More specifically, when we want to maximize domain-invariance (Eq.12) within the range that does not interfere with accuracy (Eq.13), the solution satisfies $H _ { \tilde { p } _ { E ^ { * } } } ( d | h ) \ : = \ : H ( d | y )$ . So without interfering with classification accuracy we can remove domain information from $h$ to the extent that $\dot { H } _ { \tilde { p } _ { E } } ( d | h ) = H ( \dot { d } | y )$ holds, i.e., $h$ has as much information about $d$ as $y$ does.
|
| 149 |
+
|
| 150 |
+
# 4.2 PROPOSED METHOD
|
| 151 |
+
|
| 152 |
+
Based on the above analysis, the remaining challenge is how to impose such regularization that makes $H _ { \tilde { p } _ { E } } ( d | h ) = H ( d | y )$ hold. Although DAN might be able to achive that condition by carefully tuning the regularizer ( $\langle \gamma$ in Eq.1), such tuning is time-consuming and impracticable as suggested in our experiments. Alternatively, we propose a novel method called IFLOC, modifying DAN’s regularization term: while the encoder of DAN attempts to fool a discriminator, that of IFLOC attempts to directly minimize KLD between $p ( d | y )$ and $q _ { D } ( d | h )$ . Formally, IFLOC solves the following joint optimization problem by alternating gradient descent.
|
| 153 |
+
|
| 154 |
+
$$
|
| 155 |
+
\begin{array} { r l } & { \underset { E , M } { \mathop { \operatorname* { m i n } } } J ( E , M ) = \mathbb { E } _ { x , d , y \sim p ( x , d , y ) } [ \gamma D _ { K L } [ p ( d | y ) | q _ { D } ( d | h - f _ { E } ( x ) ) ] - \log q _ { M } ( y | h - f _ { E } ( x ) ) ] } \\ & { } \\ & { \underset { D } { \mathop { \operatorname* { m i n } } } J ( E , D ) = \mathbb { E } _ { x , d \sim p ( x , d ) } [ - \log q _ { D } ( d | h = f _ { E } ( x ) ) ] } \end{array}
|
| 156 |
+
$$
|
| 157 |
+
|
| 158 |
+
The second term in Eq.14 and Eq.15 respectively means maximization of log-likelihood of $q _ { M }$ and $q _ { D }$ as well as DAN. However, the first term in Eq.14 differs from DAN in that it is intended to satisfy $\bar { q } _ { D } ( d | h ) = p ( d | y )$ for almost every $( y , h )$ pair.
|
| 159 |
+
|
| 160 |
+
Next we show that the regularization of IFLOC is intended to achieve $H _ { \tilde { p } _ { E } } ( d | h ) = H ( d | y )$ . Similarly to Section 3.2, $D ^ { * }$ and $M ^ { * }$ , which are the solutions to Eq.14 and Eq.15 with fixed $E$ , obviously satisfy $q _ { D } ^ { * } = \tilde { p } _ { E } ( d | h ) , q _ { M } ^ { * } = \tilde { p } _ { E } ( y | h )$ . Thus Eq.14 can be written as follows:
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
\displaystyle \operatorname* { m i n } _ { E } J ( E ) = \mathbb { E } _ { h , y \sim \tilde { p } _ { E } ( h , y ) } [ \gamma D _ { K L } [ p ( d | y ) | \tilde { p } _ { E } ( d | h ) ] ] + H _ { \tilde { p } _ { E } } ( y | h )
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
Since the minimization of the KLD term does not interfere with the second term optimization, $E ^ { * }$ , which is the solution to Eq.16 and in Nash equilibrium, satisfies $\mathbb { E } _ { h , y \sim \tilde { p } _ { E ^ { * } } ( h , y ) } [ D _ { K L } [ p ( d | y ) | \tilde { p } _ { E ^ { * } } ( d | h ) ] ] = 0$ . Then, $\tilde { H _ { \tilde { p } _ { E ^ { * } } } } ( d | h ) = H ( d | y )$ obviously holds.
|
| 167 |
+
|
| 168 |
+
Note that we cannot obtain true $p ( d | y )$ , but we can use a maximum likelihood or maximum a posteriori estimator for it. Also, we could use some divergences other than $D _ { K L } [ p ( d | y ) | q _ { D } ( d | h ) ]$ in Eq.14, e.g., $D _ { K L } [ q _ { D } ( d | h ) | p ( d | y ) ]$ , but in doing so, we could not observe performance gain, so we discontinued testing them.
|
| 169 |
+
|
| 170 |
+
Table 1: Sample sizes for each domain-class pair in BMNISTR. Those for the classes $0 { \sim } 4$ are variable across domains, whereas the classes $5 { \sim } 9$ have identical sample sizes across domains.
|
| 171 |
+
|
| 172 |
+
<table><tr><td>Dataset</td><td>Class</td><td>M0</td><td>M15</td><td>M30</td><td>M45</td><td>M60</td><td>M75</td></tr><tr><td>BMNISTR-1</td><td>0~4 5~9</td><td>100 100</td><td>85 100</td><td>70 100</td><td>55 100</td><td>40 100</td><td>25 100</td></tr><tr><td>BMNISTR-2</td><td>0~4 5~9</td><td>100 100</td><td>80 100</td><td>60 100</td><td>40 100</td><td>20 100</td><td>0 100</td></tr><tr><td>BMNISTR-3</td><td>0~4 5~9</td><td>100 100</td><td>90 100</td><td>80 100</td><td>70 100</td><td>60 100</td><td>50 100</td></tr><tr><td>BMNISTR-4</td><td>0~4 5~9</td><td>100 100</td><td>25 100</td><td>100 100</td><td>25 100</td><td>100 100</td><td>25 100</td></tr></table>
|
| 173 |
+
|
| 174 |
+
# 5 EXPERIMENTS
|
| 175 |
+
|
| 176 |
+
# 5.1 DATASETS
|
| 177 |
+
|
| 178 |
+
BMNISTR We created the Biased Rotated MNIST dataset (BMNISTR) by modifying the sample size of MNISTR (Ghifary et al. (2015)) so that class distribution differs among the domains. Specifically, we created four variants of MNISTR that have different types of domain-class dependency, referred to as BMNISTR-1 through BMNISTR-4. As shown in Table 1, BMNISTR-1, -2, and -3 have similar trends but different degrees of dependency; BMNISTR-1 and BMNISTR-4 differ in trends. In MNISTR, each class is represented by 10 digits. Each domain was created by rotating images by 15 degree increments: 0, 15, 30, 45, 60, and 75 (referred to as M0, ..., M75). Each image is cropped to $1 6 \mathrm { ~ x ~ } 1 6$ in accordance with Ghifary et al. (2015). In training, we employed one-domainleave-out setting: trained on five of the six domains and then tested using the remaining one. We used two convolution layers and two fully-connected (FC) layers (with nonlinear activations) as the encoder, three FC layers as the classifier, and two FC layers as the discriminator.
|
| 179 |
+
|
| 180 |
+
PACS The PACS dataset (Li et al. (2017)) has 9991 images across 7 categories (dog, elephant, giraffe, guitar, house, horse, and person) and 4 domains comprising different stylistic depictions (Photo, Art painting, Cartoon, and Sketch). It has domain-class dependency probably because samples in some $<$ <domain, class $>$ pairs are difficult to obtain. For example, $-$ ) is much higher than $-$ , which indicates that photos of person are easier to obtain than those of animals, but sketches of persons are more difficult to obtain than those of animals in the wild. The concrete sample sizes for each category and style is shown in Table 4 in appendix. In training, we employed one-domain-leave-out setting as well as in BMNISTR, and used the ImageNet pre-trained AlexNet CNN (Krizhevsky et al. (2012)) as the base network, following previous studies (Li et al. (2017; 2018a)). The two-FC-layer discriminator was connected to the last FC layer, following Ganin et al. (2016).
|
| 181 |
+
|
| 182 |
+
WISDM The WISDM Activity Prediction dataset contains sensor data of accelerometers for six human activities (walking, jogging, upstairs, downstairs, sitting, and standing) performed by 36 users (domains). WISDM suffers from the dependency due to the reason noted in Sec.1. The concrete sample sizes for each user and activity is shown in Table 5 in appendix. Referring to Andrey (2017), we use the sliding-window procedure with 60 frames $\left( = 3 \right.$ seconds) and 20-frame overlap. The total number of samples was 54455. In training, we used randomly chosen ${ < } 1 0 / 2 6 >$ , ${ < } 1 6 / 2 0 >$ , and ${ < } 2 6 / 1 0 >$ users as $<$ source / target $>$ domains. We parameterized the encoder using three convolution layers followed by one FC layer and the classifier by logistic regression, following previous studies (Yang et al. (2015); Iwasawa et al. (2017)). The two-FC-layer discriminator was connected to the output of the encoder.
|
| 183 |
+
|
| 184 |
+
# 5.2 BASELINES
|
| 185 |
+
|
| 186 |
+
To demonstrate the efficacy of the proposed method IFLOC, we compared it with the following methods. (1) CNN is a vanilla convolutional networks trained on the aggregation of data from all source domains. Although CNN has no special treatments for domain generalization, Li et al. (2017) reports that it outperforms many traditional domain generalization methods. (2) DAN (Xie et al.
|
| 187 |
+
|
| 188 |
+
Table 2: Mean F scores for the classes $0 { \sim } 4$ and classes $5 { \sim } 9$ with the target domain M0.
|
| 189 |
+
|
| 190 |
+
<table><tr><td>Dataset</td><td>Class</td><td>CNN</td><td>DAN</td><td>IFLOC-Abl</td><td>IFLOC</td><td>Relative Improvement of IFLOC to IFLOC-Abl</td></tr><tr><td>BMNISTR-1</td><td>0~4</td><td>83.86</td><td>84.54</td><td>87.46</td><td>90.62</td><td>3.6%</td></tr><tr><td></td><td>5~9</td><td>83.90</td><td>85.24</td><td>86.46</td><td>88.10</td><td>1.9%</td></tr><tr><td>BMNISTR-2</td><td>0~4</td><td>84.76</td><td>86.20</td><td>86.42</td><td>89.58</td><td>3.7%</td></tr><tr><td></td><td>5~9</td><td>83.36</td><td>85.22</td><td>85.62</td><td>86.86</td><td>1.4%</td></tr><tr><td>BMNISTR-3</td><td>0~4</td><td>82.54</td><td>85.30</td><td>88.60</td><td>89.64</td><td>1.2%</td></tr><tr><td></td><td>5~9</td><td>82.18</td><td>85.80</td><td>87.60</td><td>89.04</td><td>1.6%</td></tr><tr><td>BMNISTR-4</td><td>0~4</td><td>71.26</td><td>79.22</td><td>76.56</td><td>80.02</td><td>4.5%</td></tr><tr><td></td><td>5~9</td><td>78.62</td><td>83.14</td><td>82.94</td><td>82.80</td><td>-0.2%</td></tr></table>
|
| 191 |
+
|
| 192 |
+
(2017)) is expected to generalize across domains via invariant feature learning, but it has the tradeoff between domain invariance and classification accuracy as explained in Section 4.1.1. We trained DAN with a gradient reverse layer following Ganin et al. (2016); Xie et al. (2017). Also, we used (3) IFLOC-Abl, which is a version of IFLOC modified for ablation studies. IFLOC-Abl replaces $D _ { K L } [ p ( d | y ) | \tilde { p } _ { E } ( d | h ) ]$ in Eq.14 of $D _ { K L } [ p ( d ) | \tilde { p } _ { E } ( d | h ) ]$ , so it attempts to learn the representation that is completely invariant to domains or make $\begin{array} { r } { H ( d | h ) = H ( d ) } \end{array}$ hold as well as DAN. Comparing IFLOC and IFLOC-Abl, we measured the genuine effect of taking domain-class dependency into account. In training IFLOC and IFLOC-Abl, we cannot obtain true $p ( d | y )$ and $p ( \bar { d } )$ , so we used maximum likelihood estimators of them for calculating the KLD terms.
|
| 193 |
+
|
| 194 |
+
# 5.3 EXPERIMENTAL SETTINGS
|
| 195 |
+
|
| 196 |
+
For all the datasets and methods, we used RMSprop for optimization. And we set the learning rate, batch size, and the number of iterations as 5e-4, 128, and 10k for BMNISTR; 5e-5, 64, and $1 0 \mathrm { k }$ for PACS; 1e-4, 128, and $3 0 \mathrm { k }$ for WISDM, respectively. For DAN, IFLOC-Abl, and IFLOC we optimized the weighting parameter $\gamma$ from $\{ 0 . 0 \bar { 0 0 } 1 , 0 . 0 \bar { 0 1 } , 0 . 0 1 , 0 . 1 , 1 , 1 0 \}$ , and used the $\gamma$ annealing following Ganin et al. (2016). In all the experiments, we split source data into $80 \%$ of training data and $20 \%$ of validation data, assuming that target data are not absolutely available in the training phase. We conducted experiments multiple times with different seeds. Specifically, we trained on 10 and 25 seeds in BMNISTR and WISDM, chose the best hyperparameter that achieved the highest validation accuracies measured in each epoch, and reported the mean scores (accuracies and f-values) for the hyperparameter. In PACS, since it requires a long time to train on, we chose the best $\gamma$ from $\{ 0 . 0 0 \dot { 0 } \dot { 1 } , \dot { 0 } . 0 0 1 , 0 . 0 1 , 0 . 1 \}$ with three experiment, and reported the mean scores in experiments with 20 seeds in total. Also, we empirically measured the level of domain-invariance by training a post-hoc classifier that is intended to predict $d$ over learned representation, following previous studies (Xie et al. (2017); Iwasawa et al. (2017); Moyer et al. (2018)). Specifically, we trained the classifier with 400 hidden units on $1 0 \mathrm { k }$ iterations (by RMSprop optimizer with a 0.001 learning rate and 128 batch size) with the data that is used for training the models. We then evaluated the domain classification accuracy (referred to as D-Acc) 10 times at equal intervals during training, and reported D-Acc in the nearest time when the validation accuracy is maximized.
|
| 197 |
+
|
| 198 |
+
# 5.4 RESULTS
|
| 199 |
+
|
| 200 |
+
We first investigated how domain-class dependency affects the performance of domain-invariancebased methods. In Table 2, we compared mean f-scores for the classes 0 through 4 and classes 5 through 9 in BMNISTR with the target domain M0. Recall that sample sizes for the classes $0 { \sim } 4$ are variable across domains, whereas the classes $5 { \sim } 9$ has identical sample sizes across domains (Table 1). The f-scores show that IFLOC outperformed DAN and IFLOC-Abl in most datasetclass pairs, which supports that domain-class dependency depresses the performance of domaininvariance-based methods and that IFLOC can mitigate the problem. Futher, relative improvement of IFLOC to IFLOC-Abl is more significant for the classes $0 { \sim } 4$ than $5 { \sim } 9$ in BMNISTR-1, BMNISTR2, and BMNISTR-4, suggesting that IFLOC tends to increase performance more significantly for classes where the domain-class dependency occurs. Also, the improvement is more significant in
|
| 201 |
+
|
| 202 |
+

|
| 203 |
+
Figure 2: Class accuracy (Y-Acc) and domain accuracy (D-Acc) with various $\gamma$ in BMNISTR-1. Each caption shows the metric name (Y-Acc or D-Acc) and target domain.
|
| 204 |
+
|
| 205 |
+

|
| 206 |
+
Figure 3: Class accuracy (Y-Acc) and domain accuracy (D-Acc) with various $\gamma$ in WISDM. Each caption shows the metric name (Y-Acc or D-Acc) and target domain.
|
| 207 |
+
|
| 208 |
+
BMNISTR-1 than in BMNISTR-3, suggesting that the stronger the domain-class dependency is, the lower the performance of domain-invariance-based methods becomes. Finally, although the dependencies of BMNISTR-1 and BMNISTR-4 have different trends as described in Table 1, IFLOC improved f-scores in both datasets.
|
| 209 |
+
|
| 210 |
+
Next we investigated the relationship between the strength of regularization and performance. Figures 2 and 3 show the hyperparameter sensitivity of class accuracies (Y-Acc) and domain accuracies (D-Acc) for DAN, IFLOC-Abl, and IFLOC. Note that the gray line in Figures 2-(c) and 3-(c) shows the trivial baseline predicting the majority label. From these figures, we can make the following observations. (1) All the methods including IFLOC could improve the invariance by using stronger regularizer. Concretely, Figures 2-(c) and 3-(c) show D-Acc tends to become low (invariance becomes high) for all the models when the regularizer becomes strong (such as $\gamma = 1$ or 10) except that IFLOC-Abl has high D-Acc with $\gamma = 1 0$ in Figure 3-(c). That high D-Acc might be because the validation accuracy achieved the highest value before the domain-invariance matured. (Recall that the more the representation becomes invariant, the lower the accurary becomes under the trade-off). (2) The training of IFLOC tends to be more stable than that of DAN when the regularizer becomes strong. Figures 2-(a,b) and 3-(a,b) show that IFLOC and IFLOC-Abl could achieve higher Y-Acc than DAN when $\gamma = 1$ or 10, i.e., the regularization is strong, except for IFLOC-Abl with $\gamma = 1$ in Figure 3-(b). This tendency might be because the regularizer of IFLOC is KLD and thus bounded by 0, in contrast to that of DAN that can increase to infinity and destabilize the traininig. (3) IFLOC, as it was designed, does not tend to decrease classification accuracy with strong regularizer, and thus IFLOC is robust toward hyperparameter choice. Figures 2-(b) and 3-(a,b) show that while Y-Acc of IFLOC-Abl decreases with strong regularization (such as when $\gamma = 1$ or 10), that of IFLOC does not decrease as much.
|
| 211 |
+
|
| 212 |
+
Finally, we compared mean accuracies (with standard errors) in both synthetic (BMNISTR) and standard benchmark (PACS and WISDM) datasets (Table 3). Note that the $H ( d ) / H ( d | y )$ column is estimated from source data, which indicates the strength of domain-class dependency. IFLOC outperformed IFLOC-Abl in BMNISTR with all the target domains; PACS with photo, art painting, and sketch target domains; and WISDM with 26- and 20-target-user domains. Also, IFLOC outperformed DAN in BMNISTR with all the target domains; PACS with photo and art painting target domains; and WISDM with 26- and 10-target-user domains. This supports the importance of considering domain-class dependency in real-world datasets and the efficacy of the proposed model.
|
| 213 |
+
|
| 214 |
+
Table 3: Accuracies for each dataset and target domain
|
| 215 |
+
|
| 216 |
+
<table><tr><td>Dataset</td><td>Target</td><td>H(d)/H(dly) (%)</td><td>CNN</td><td>DAN</td><td>IFLOC-Abl</td><td>IFLOC</td></tr><tr><td>BMNISTR-1</td><td>M0 M15</td><td>101.2</td><td>83.9 ± 0.4</td><td>85.0± 0.4</td><td>87.0 ± 0.4</td><td>89.3± 0.4</td></tr><tr><td></td><td>M30</td><td>101.5</td><td>98.5± 0.2 97.5 ± 0.1</td><td>98.5± 0.1</td><td>98.3 ± 0.2</td><td>98.8 ± 0.1</td></tr><tr><td></td><td>M45</td><td>101.6</td><td></td><td>97.4± 0.1</td><td>97.6± 0.1</td><td>98.3 ± 0.2</td></tr><tr><td></td><td></td><td>101.6</td><td>89.9 ± 0.9</td><td>90.2 ± 0.6</td><td>92.8 ± 0.5</td><td>93.3 ± 0.6</td></tr><tr><td></td><td>M60</td><td>101.3</td><td>96.7 ± 0.3</td><td>97.0 ± 0.2</td><td>96.6± 0.2</td><td>97.4 ± 0.2</td></tr><tr><td></td><td>M75</td><td>100.7</td><td>87.1 ± 0.5</td><td>87.3± 0.4</td><td>87.7± 0.5</td><td>88.1 ± 0.4</td></tr><tr><td>BMNISTR-2</td><td>Avg</td><td></td><td>92.3</td><td>92.6</td><td>93.3</td><td>94.2</td></tr><tr><td>BMNISTR-3</td><td>Avg Avg</td><td></td><td>92.3</td><td>92.2</td><td>93</td><td>94.2</td></tr><tr><td>BMNISTR-4</td><td></td><td></td><td>92.2</td><td>92.7</td><td>94</td><td>94.5</td></tr><tr><td>PACS</td><td>Avg</td><td></td><td>90.6</td><td>91.7</td><td>91.6</td><td>92.9</td></tr><tr><td></td><td>photo</td><td>107.2</td><td>80.6± 0.3</td><td>81.1 ± 0.3</td><td>81.6± 0.3</td><td>82.9 ± 0.2</td></tr><tr><td></td><td>art_painting</td><td>108.5</td><td>59.2± 0.4</td><td>60.1± 0.3</td><td>60.5± 0.4</td><td>61.2 ± 0.2</td></tr><tr><td></td><td>cartoon</td><td>109.7</td><td>63.2± 0.3</td><td>64.3 ± 0.3</td><td>64.4 ± 0.4</td><td>63.8± 0.3</td></tr><tr><td></td><td>sketch</td><td>101.5</td><td>58.2± 0.5</td><td>58.9± 0.4</td><td>58.1± 0.6</td><td>59.0 ± 0.5</td></tr><tr><td>WISDM</td><td>Avg</td><td></td><td>65.3</td><td>66.1</td><td>66.2</td><td>66.7</td></tr><tr><td></td><td>26users</td><td>107.1</td><td>78.3± 0.3</td><td>78.2± 0.3</td><td>78.4± 0.2</td><td>78.9 ± 0.3</td></tr><tr><td></td><td>20 users</td><td>104.2</td><td>79.7 ± 0.2</td><td>80.2 ± 0.3</td><td>79.7 ± 0.3</td><td>80.0± 0.3</td></tr><tr><td></td><td>10 users</td><td>103.5</td><td>80.6± 0.2</td><td>80.6± 0.2</td><td>81.2 ± 0.3</td><td>81.2 ± 0.3</td></tr></table>
|
| 217 |
+
|
| 218 |
+
Table 3 also shows that when the number of source domains increased from 10 to 26 in WISDM, the improvement of IFLOC from IFLOC-Abl became insignificant. One possible reason is that WISDM with 10 target users has low domain-class dependency than with 26 target users as shown in the $H ( d ) / H ( d | y )$ column. Another possible reason is the optimization difficulty. As Moyer et al. (2018) reported, in adversarial invariant feature learning, an encoder often overfits to the discriminator trained alongside that encoder, and does not provide truly invariant representation (the same problem can be observed in Figures 2-(c) and 3-(c)). We suspect that when the number of source domains increases, the optimization of the domain discriminator becomes difficult, which makes the encoder overfit to that poor discriminator and worsen the problem. Also, the improvement of IFLOC from IFLOC-Abl is less significant in WISDM than that in BMNISTR and PACS, which could be related to the same problem since the number of source domains for BMNISTR and PACS is smaller than that for WISDM. If the optimization difficulty prevents IFLOC from working properly, we might be able to mitigate it by using ideas from the studies that investigate the convergence and optimization difficulty in adversarial training (e.g., Nagarajan & Kolter (2017); Heusel et al. (2017); Balduzzi et al. (2018)).
|
| 219 |
+
|
| 220 |
+
# 6 CONCLUSION
|
| 221 |
+
|
| 222 |
+
In this paper, we addressed domain generalization under domain-class dependency, which was overlooked by most prior domain generalization methods relying on domain-invariant representation. We theoretically showed the importance of considering the dependency and the way to overcome the problem by expanding the analysis of Xie et al. (2017). We then proposed a novel method IFLOC, which maximizes domain-invariance within a range that does not interfere with classification accuracy. Empirical validations show the superior performance of IFLOC to the baseline methods, supporting the importance of the domain-class dependency in domain generalization tasks and the efficacy of the proposed method for overcoming the issue. Future work includes applying the reguralization idea of making $\_$ to other methods, e.g., Conditional VAE (Louizos et al. (2016)) or CrossGrad (Shankar et al. (2018)) because they have clear and tractable data generating process but assume the independence of and $\cdot$ . Also intended is to use it for transfer learning tasks $\cdot$
|
| 223 |
+
in a few-shot setting (e.g., life-long learning) where domain-class dependency is likely to occur due to scarce sample size.
|
| 224 |
+
|
| 225 |
+
# REFERENCES
|
| 226 |
+
|
| 227 |
+
Ignatov Andrey. Real-time human activity recognition from accelerometer data using convolutional neural networks. Applied Soft Computing, 2017.
|
| 228 |
+
|
| 229 |
+
David Balduzzi, Sebastien Racaniere, James Martens, Jakob Foerster, Karl Tuyls, and Thore Grae- ´ pel. The mechanics of n-player differentiable games. In Proc. of the 35th International Conference on Machine Learning, 2018.
|
| 230 |
+
|
| 231 |
+
Gilles Blanchard, Gyemin Lee, and Clayton Scott. Generalizing from several related classification tasks to a new unlabeled sample. In Proc. of the 24th International Conference on Neural Information Processing Systems. 2011.
|
| 232 |
+
|
| 233 |
+
Ju-Chieh Chou, Cheng chieh Yeh, Hung yi Lee, and Lin shan Lee. Multi-target voice conversion without parallel data by adversarially learning disentangled audio representations. In Proc. Interspeech, 2018.
|
| 234 |
+
|
| 235 |
+
Sarah Erfani, Mahsa Baktashmotlagh, Masoud Moshtaghi, Vinh Nguyen, Christopher Leckie, James Bailey, and Ramamohanarao Kotagiri. Robust domain generalisation by enforcing distribution invariance. In 25th International Joint Conference on Artificial Intelligence, 2016.
|
| 236 |
+
|
| 237 |
+
Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. J. Mach. Learn. Res., 2016.
|
| 238 |
+
|
| 239 |
+
M. Ghifary, D. Balduzzi, W. B. Kleijn, and M. Zhang. Scatter component analysis: A unified framework for domain adaptation and domain generalization. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017.
|
| 240 |
+
|
| 241 |
+
Muhammad Ghifary, W. Bastiaan Kleijn, Mengjie Zhang, and David Balduzzi. Domain generalization for object recognition with multi-task autoencoders. In Proc. of the IEEE International Conference on Computer Vision (ICCV), 2015.
|
| 242 |
+
|
| 243 |
+
Mingming Gong, Kun Zhang, Tongliang Liu, Dacheng Tao, Clark Glymour, and Bernhard Scholkopf. Domain adaptation with conditional transferable components. In ¨ Proc. of the $3 3 r d$ International Conference on International Conference on Machine Learning, 2016.
|
| 244 |
+
|
| 245 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Proc. of the 30th International Conference on Neural Information Processing Systems, 2017.
|
| 246 |
+
|
| 247 |
+
Yusuke Iwasawa, Kotaro Nakayama, Ikuko Yairi, and Yutaka Matsuo. Privacy issues regarding the application of dnns to activity-recognition using wearables and its countermeasures by use of adversarial training. In Proc. of the 26th International Joint Conference on Artificial Intelligence, pp. 1930–1936, 2017.
|
| 248 |
+
|
| 249 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Proc. of the 25th International Conference on Neural Information Processing Systems, pp. 1097–1105, 2012.
|
| 250 |
+
|
| 251 |
+
Jennifer R. Kwapisz, Gary M. Weiss, and Samuel A. Moore. Activity recognition using cell phone accelerometers. SIGKDD Explor. Newsl., 2011.
|
| 252 |
+
|
| 253 |
+
Guillaume Lample, Neil Zeghidour, Nicolas Usunier, Antoine Bordes, Ludovic Denoyer, and Marc’Aurelio Ranzato. Fader networks:manipulating images by sliding attributes. In Proc. of the 30th Neural Information Processing Systems. 2017.
|
| 254 |
+
|
| 255 |
+
D. Li, Y. Yang, Y. Z. Song, and T. M. Hospedales. Deeper, broader and artier domain generalization. In Proc. of the IEEE International Conference on Computer Vision (ICCV), 2017.
|
| 256 |
+
|
| 257 |
+
Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M. Hospedales. Learning to generalize: Metalearning for domain generalization. In Proc. of the 32nd AAAI Conference on Artificial Intelligence, 2018a.
|
| 258 |
+
|
| 259 |
+
Haoliang Li, Sinno Jialin Pan, Shiqi Wang, and Alex C. Kot. Domain generalization with adversarial feature learning. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018b.
|
| 260 |
+
|
| 261 |
+
Ya Li, Mingming Gong, Xinmei Tian, Tongliang Liu, and Dacheng Tao. Domain generalization via conditional invariant representations. In Proc. of the 32nd AAAI Conference on Artificial Intelligence, 2018c.
|
| 262 |
+
|
| 263 |
+
Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard S. Zemel. The variational fair autoencoder. In Proc. International Conference on Representation Learning, 2016.
|
| 264 |
+
|
| 265 |
+
Gilles Louppe, Michael Kagan, and Kyle Cranmer. Learning to pivot with adversarial networks. In Proc. of the 30th Neural Information Processing Systems. 2017.
|
| 266 |
+
|
| 267 |
+
David Madras, Elliot Creager, Toniann Pitassi, and Richard S. Zemel. Learning adversarially fair and transferable representations. In Proc. of the 35th International Conference on Machine Learning, 2018.
|
| 268 |
+
|
| 269 |
+
Saeid Motiian, Marco Piccirilli, Donald A. Adjeroh, and Gianfranco Doretto. Unified deep supervised domain adaptation and generalization. In Proc. of the IEEE International Conference on Computer Vision (ICCV), 2017.
|
| 270 |
+
|
| 271 |
+
Daniel Moyer, Shuyang Gao, Rob Brekelmans, Greg Ver Steeg, and Aram Galstyan. Evading the adversary in invariant representation. In Proc. of the 31st International Conference on Neural Information Processing Systems, 2018.
|
| 272 |
+
|
| 273 |
+
Krikamol Muandet, David Balduzzi, and Bernhard Schlkopf. Domain generalization via invariant feature representation. In Proc. of the 30th International Conference on Machine Learning, 2013.
|
| 274 |
+
|
| 275 |
+
Vaishnavh Nagarajan and J. Zico Kolter. Gradient descent gan optimization is locally stable. In Proc. of the 30th International Conference on Neural Information Processing Systems, 2017.
|
| 276 |
+
|
| 277 |
+
Shiv Shankar, Vihari Piratla, Soumen Chakrabarti, Siddhartha Chaudhuri, Preethi Jyothi, and Sunita Sarawagi. Generalizing across domains via cross-gradient training. In Proc. International Conference on Learning Representations, 2018.
|
| 278 |
+
|
| 279 |
+
Anuroop Sriram, Heewoo Jun, Yashesh Gaur, and Sanjeev Satheesh. Robust speech recognition using generative adversarial networks. In The IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2018.
|
| 280 |
+
|
| 281 |
+
A. Torralba and A. A. Efros. Unbiased look at dataset bias. In Proceedings of the 2011 IEEE Conference on Computer Vision and Pattern Recognition, 2011.
|
| 282 |
+
|
| 283 |
+
Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. CoRR, abs/1412.3474, 2014. URL http://arxiv.org/abs/1412.3474.
|
| 284 |
+
|
| 285 |
+
Eric Tzeng, Judy Hoffman, Trevor Darrell, and Kate Saenko. Simultaneous deep transfer across domains and tasks. In Proc. of the IEEE International Conference on Computer Vision (ICCV), 2015.
|
| 286 |
+
|
| 287 |
+
Qizhe Xie, Zihang Dai, Yulun Du, Eduard Hovy, and Graham Neubig. Controllable invariance through adversarial feature learning. In Proc. of the 30th International Conference on Neural Information Processing Systems. 2017.
|
| 288 |
+
|
| 289 |
+
Jianbo Yang, Minh Nhut Nguyen, Phyo Phyo San, Xiaoli Li, and Shonali Krishnaswamy. Deep convolutional neural networks on multichannel time series for human activity recognition. In Proc. of the 24th International Joint Conference on Artificial Intelligence, 2015.
|
| 290 |
+
|
| 291 |
+
Rich Zemel, Yu Wu, Kevin Swersky, Toni Pitassi, and Cynthia Dwork. Learning fair representations. In Proc. of the 30th International Conference on Machine Learning, 2013.
|
| 292 |
+
|
| 293 |
+
Kun Zhang, Bernhard Schlkopf, Krikamol Muandet, and Zhikun Wang. Domain adaptation under target and conditional shift. In Proc. of the 30th International Conference on Machine Learning, 2013.
|
| 294 |
+
|
| 295 |
+
# A DOMAIN-CLASS DEPENDENCY IN PACS AND WISDM
|
| 296 |
+
|
| 297 |
+
Table 4: Sample sizes for each $<$ <domain, class $>$ pair in PACS dataset. The column shows category name while and index shows style.
|
| 298 |
+
|
| 299 |
+
<table><tr><td></td><td>Guitar</td><td>House</td><td>Giraffe</td><td>Person</td><td>Horse</td><td>Dog</td><td>Elephant</td></tr><tr><td>Art Painting</td><td>184</td><td>295</td><td>285</td><td>449</td><td>201</td><td>379</td><td>255</td></tr><tr><td>Cartoon</td><td>135</td><td>288</td><td>346</td><td>405</td><td>324</td><td>389</td><td>457</td></tr><tr><td>Photo</td><td>186</td><td>280</td><td>182</td><td>432</td><td>199</td><td>189</td><td>202</td></tr><tr><td>Sketch</td><td>608</td><td>80</td><td>753</td><td>160</td><td>816</td><td>772</td><td>740</td></tr></table>
|
| 300 |
+
|
| 301 |
+
Table 5: Sample sizes for each <domain, class $>$ pair in WISDM dataset. The column shows activity name and the index shows user id.
|
| 302 |
+
|
| 303 |
+
<table><tr><td></td><td>Jogging</td><td>Walking</td><td>Upstairs</td><td>Downstairs</td><td>Sitting</td><td>Standing</td></tr><tr><td>User 1</td><td>145</td><td>742</td><td>108</td><td>224</td><td>160</td><td>78</td></tr><tr><td>User 2</td><td>142</td><td>481</td><td>282</td><td>186</td><td>0</td><td>0</td></tr><tr><td>User 3</td><td>645</td><td>654</td><td>240</td><td>231</td><td>780</td><td>267</td></tr><tr><td>User 4</td><td>637</td><td>619</td><td>237</td><td>214</td><td>113</td><td>78</td></tr><tr><td>User 5</td><td>614</td><td>650</td><td>229</td><td>210</td><td>56</td><td>80</td></tr><tr><td>User 6</td><td>637</td><td>574</td><td>101</td><td>86</td><td>0</td><td>0</td></tr><tr><td>User 7</td><td>588</td><td>617</td><td>81</td><td>69</td><td>81</td><td>33</td></tr><tr><td>User 8</td><td>599</td><td>621</td><td>160</td><td>171</td><td>102</td><td>79</td></tr><tr><td>User 9</td><td>599</td><td>308</td><td>269</td><td>206</td><td>123</td><td>94</td></tr><tr><td>User 10</td><td>597</td><td>625</td><td>119</td><td>118</td><td>71</td><td>95</td></tr><tr><td>User 11</td><td>610</td><td>616</td><td>188</td><td>115</td><td>150</td><td>81</td></tr><tr><td>User 12</td><td>626</td><td>356</td><td>0</td><td>0</td><td>77</td><td>51</td></tr><tr><td>User 13</td><td>620</td><td>604</td><td>217</td><td>131</td><td>0</td><td>0</td></tr><tr><td>User 14</td><td>0</td><td>624</td><td>68</td><td>76</td><td>147</td><td>96</td></tr><tr><td>User 15</td><td>318</td><td>610</td><td>167</td><td>162</td><td>81</td><td>73</td></tr><tr><td>User 16</td><td>602</td><td>650</td><td>212</td><td>187</td><td>0</td><td>81</td></tr><tr><td>User 17</td><td>0</td><td>706</td><td>142</td><td>147</td><td>0</td><td>63</td></tr><tr><td>User 18</td><td>593</td><td>658</td><td>178</td><td>189</td><td>0</td><td>0</td></tr><tr><td>User 19</td><td>661</td><td>690</td><td>406</td><td>141</td><td>0</td><td>0</td></tr><tr><td>User 20</td><td>611</td><td>310</td><td>149</td><td>144</td><td>32</td><td>25</td></tr><tr><td>User 21</td><td>616</td><td>537</td><td>130</td><td>141</td><td>112</td><td>81</td></tr><tr><td>User 22</td><td>613</td><td>327</td><td>239</td><td>94</td><td>0</td><td>0</td></tr><tr><td>User 23</td><td>42</td><td>301</td><td>66</td><td>86</td><td>60</td><td>0</td></tr><tr><td>User 24</td><td>0</td><td>626</td><td>209</td><td>191</td><td>75</td><td>152</td></tr><tr><td>User 25</td><td>641</td><td>666</td><td>194</td><td>140</td><td>76</td><td>65</td></tr><tr><td>User 26</td><td>513</td><td>853</td><td>220</td><td>165</td><td>132</td><td>161</td></tr><tr><td>User 27</td><td>701</td><td>841</td><td>231</td><td>192</td><td>105</td><td>128</td></tr><tr><td>User 28</td><td>477</td><td>622</td><td>240</td><td>199</td><td>78</td><td>140</td></tr><tr><td>User 29</td><td>548</td><td>646</td><td>168</td><td>164</td><td>78</td><td>139</td></tr><tr><td>User 30</td><td>309</td><td>349</td><td>269</td><td>179</td><td>0</td><td>0</td></tr><tr><td>User 31</td><td>550</td><td>641</td><td>154</td><td>145</td><td>0</td><td>0</td></tr><tr><td>User 32</td><td>0</td><td>644</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>User 33</td><td>322</td><td>346</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>User 34</td><td>587</td><td>584</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>User 35</td><td>457</td><td>549</td><td>178</td><td>110</td><td>124</td><td>116</td></tr><tr><td>User 36</td><td>808</td><td>879</td><td>212</td><td>128</td><td>124</td><td>104</td></tr></table>
|
md/train/HJxJ2h4tPr/HJxJ2h4tPr.md
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HIGHRES-NET: MULTI-FRAME SUPER-RESOLUTION BY RECURSIVE FUSION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Generative deep learning has sparked a new wave of Super-Resolution (SR) algorithms that enhance single images with impressive aesthetic results, albeit with imaginary details. Multi-frame Super-Resolution (MFSR) offers a more grounded approach to the ill-posed problem, by conditioning on multiple low-resolution views. This is important for satellite monitoring of human impact on the planet – from deforestation, to human rights violations – that depend on reliable imagery. To this end, we present HighRes-net, the first deep learning approach to MFSR that learns its sub-tasks in an end-to-end fashion: (i) co-registration, (ii) fusion, (iii) up-sampling, and (iv) registration-at-the-loss. Co-registration of low-res views is learned implicitly through a reference-frame channel, with no explicit registration mechanism. We learn a global fusion operator that is applied recursively on an arbitrary number of low-res pairs. We introduce a registered loss, by learning to align the SR output to a ground-truth through ShiftNet. We show that by learning deep representations of multiple views, we can super-resolve low-resolution signals and enhance Earth observation data at scale. Our approach recently topped the European Space Agency’s MFSR competition on real-world satellite imagery.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Multiple low-resolution images collectively contain more information than any individual lowresolution image, due to minor geometric displacements, e.g. shifts, rotations, atmospheric turbulence, and instrument noise. Multi-Frame Super-Resolution (MFSR) (Tsai, 1984) aims to reconstruct hidden high-resolution details from multiple low-resolution views of the same scene. Single Image Super-Resolution (SISR), as a special case of MFSR, has attracted much attention in the computer vision, machine learning and deep learning communities in the last 5 years, with neural networks learning complex image priors to upsample and interpolate images (Xu et al., 2014; Srivastava et al., 2015; He et al., 2016). However, in the meantime not much work has explored the learning of representations for the more general problem of MFSR to address the additional challenges of co-registration and fusion of multiple low-resolution images.
|
| 12 |
+
|
| 13 |
+
This paper explores how Multi-Frame Super-Resolution (MFSR) can benefit from recent advances in learning representations with neural networks. To the best of our knowledge, this work is the first to introduce a deep-learning approach that solves the co-registration, fusion and registration-at-theloss problems in an end-to-end learning framework.
|
| 14 |
+
|
| 15 |
+
Prompting this line of research is the increasing drive towards planetary-scale Earth observation to monitor the environment and human rights violations. Such observation can be used to inform policy, achieve accountability and direct on-the-ground action, e.g. within the framework of the Sustainable Development Goals (Jensen & Campbell, 2019).
|
| 16 |
+
|
| 17 |
+
Nomenclature Registration is the problem of estimating the relative geometric differences between two images (e.g. due to shifts, rotations, deformations). Fusion, in the MFSR context, is the problem of mapping multiple low-res representations into a single representation. By coregistration, we mean the problem of registering all low-resolution views to improve their fusion. By registration-at-the-loss, we mean the problem of registering the super-resolved reconstruction to the high-resolution ground-truth prior to computing the loss. This gives rise to the notion of a registered loss.
|
| 18 |
+
|
| 19 |
+
Co-registration of multiple images is required for longitudinal studies of land change and environmental degradation. The fusion of multiple images is key to exploiting cheap, high-revisit-frequency satellite imagery, but of low-resolution, moving away from the analysis of infrequent and expensive high-resolution images. Finally, beyond fusion itself, super-resolved generation is required throughout the technical stack: both for labeling, but also for human oversight (Drexler, 2019) demanded by legal context (Harris et al., 2018).
|
| 20 |
+
|
| 21 |
+
# Summary of contributions
|
| 22 |
+
|
| 23 |
+
• HighRes-net: We propose a deep architecture that learns to fuse an arbitrary number of lowresolution frames with implicit co-registration through a reference-frame channel.
|
| 24 |
+
• ShiftNet: Inspired by HomographyNet (DeTone et al., 2016), we define a model that learns to register and align the super-resolved output of HighRes-net, using ground-truth high-resolution frames as supervision. This registration-at-the-loss mechanism enables more accurate feedback from the loss function into the fusion model, when comparing a super-resolved output to a ground truth high resolution image. Otherwise, a MFSR model would naturally yield blurry outputs to compensate for the lack of registration, to correct for sub-pixel shifts and account for misalignments in the loss.
|
| 25 |
+
• By combining the two components above, we contribute the first architecture to learn fusion and registration end-to-end.
|
| 26 |
+
• We test and compare our approach to several baselines on real-world imagery from the PROBA-V satellite of ESA. Our performance has topped the Kelvins competition on MFSR, organized by the Advanced Concepts Team of ESA (Martens et al. ¨ , 2019) (see section 5).
|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
Figure 1: HighRes-net combines many low-resolution images (300 meters/pixel) into one image of superior resolution. The same site shot in high-resolution $( { 1 0 0 } \mathrm { { m } / { p i x } ) }$ is also shown for reference. Source of low-res and high-res: imgset1087 and imgset0285 of PROBA-V dataset, see section 5.
|
| 30 |
+
|
| 31 |
+
The rest of the paper is divided as follows: in Section 2, we discuss related work on SISR and MFSR; Section 3 outlines HighRes-net and section 4 presents ShiftNet, a differentiable registration component that drives our registered loss mechanism during end-to-end training. We present our results in section 5, and in Section 6 we discuss some opportunities for and limitations and risks of super-resolution.
|
| 32 |
+
|
| 33 |
+
# 2 BACKGROUND
|
| 34 |
+
|
| 35 |
+
# 2.1 MULTI-FRAME SUPER-RESOLUTION
|
| 36 |
+
|
| 37 |
+
How much detail can we resolve in the digital sample of some natural phenomenon? Nyquist (1928) observed that it depends on the instrument’s sampling rate and the oscillation frequency of the underlying natural signal. Shannon (1949) built a sampling theory that explained Nyquist’s observations when the sampling rate is constant (uniform sampling) and determined the conditions of aliasing in a sample. Figure 2 illustrates this phenomenon.
|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
high-resolutioDFT magnitude F fHR Figure 2: Top: A chirp harmonic oscillator $\sin \left( 2 \pi \omega ( t ) t \right)$ equency 1 kHz DFT magnitudeF fLR , with instantaneous frequency $\omega ( t )$ . Left: The shape of the high-resolution sample resembles the underlying chirp signal. Right: Close to $t = 1$ , the apparent −400 −200 0 200 400 frequency (Hz) −100 −50 0 50 100 frequency (Hz)frequency of the low-resolution sample does not match that of the chirp. This is an example of aliasing (shown 0.0 0.2 0.4 0.6 0.8 1.0 t (sec) with red at its most extreme), and it happens when the sampling rate falls below the Nyquist rate, $s _ { N } = 2 \cdot s _ { B }$ , where $s _ { B }$ is the highest non-zero frequency of the signal.
|
| 41 |
+
|
| 42 |
+
− − frequency (Hz) Sampling at high-resolution (left) maintains the frequency of the chirp signal (top). Sampling at a lower resolution (right), this apparent chirped frequency is lost due to aliasing, which means that the lower-resolution sample has a fundamentally smaller capacity for resolving the information of the natural signal, and a higher sampling rate can resolve more information.
|
| 43 |
+
|
| 44 |
+
Shannon’s sampling theory has since been generalized for multiple interleaved sampling frames (Papoulis, 1977; Marks, 2012). One result of the generalized sampling theory is that we can go beyond the Nyquist limit of any individual uniform sample by interleaving several uniform samples taken concurrently. When an image is down-sampled to a lower resolution, its high-frequency details are lost permanently and cannot be recovered from any image in isolation. However, by combining multiple low-resolution images, it becomes possible to recover the original scene at a higher resolution.
|
| 45 |
+
|
| 46 |
+
Moreover, different low-resolution samples may be sampled at different phases, such that the same high-resolution frequency information will be packed with a phase shift. As a consequence, when multiple low-resolution samples are available, the fundamental challenge of MFSR is de-aliasing, i.e. disentangling the high-frequency components (Tsai, 1984).
|
| 47 |
+
|
| 48 |
+
The first work on MSFR (Tsai, 1984) considered the reconstruction of a high-resolution image as a fusion of co-registered low-resolution images in the Fourier domain. With proper registration and fusion (Irani & Peleg, 1991; Fitzpatrick et al., 2000; Capel & Zisserman, 2001), a composite super-resolved image can reveal some of the original high-frequency detail that would not have been accessible from single low-resolution image. In this work, we introduce HighRes-Net, which aims to provide an end-to-end deep learning framework for MFSR settings.
|
| 49 |
+
|
| 50 |
+
Relation to Video and Stereo Super-Resolution While there are obvious similarities to Video SR (Tao et al., 2017; Sajjadi et al., 2018; Yan et al., 2019; Wang et al., 2019b) and Stereo SR (Wang et al., 2019d) (Wang et al., 2019a), the setting of this work differs in several ways: HighResnet learns to super-resolve sets and not sequences of low-res views. Video SR relies on motion estimation from a sequence of observations. Also, prediction at time $t = T$ relies on predictions at $t < T$ (autoregressive approach). Whereas in our case, we predict a single image from an unordered set of low-res inputs. Also, the low-res views are multi-temporal (taken at different times).
|
| 51 |
+
|
| 52 |
+
Video SR methods assume that the input is a temporal sequence of frames. Motion or optical flow can be estimated to super-resolve the sequences of frames. In this work, we do not assume low-res inputs to be ordered in time. Our training input is a set of low-res views with unknown timestamps and our target output is a single image — not another sequence.
|
| 53 |
+
|
| 54 |
+
# 2.2 A PROBABILISTIC APPROACH
|
| 55 |
+
|
| 56 |
+
In addition to aliasing, MFSR deals with random processes like noise, blur, geometric distortions – all contributing to random low-resolution images. Traditionally, MFSR methods assume a-priori knowledge of the data generating motion model, blur kernel, noise level and degradation process; see for example, Pickup et al. (2006). Given multiple low-resolution images, the challenge of MFSR is to reconstruct a plausible image of higher-resolution that could have generated the observed lowresolution images. Optimization methods aim to improve an initial guess by minimizing an error between simulated and observed low-resolution images. These methods traditionally model the additive noise $\epsilon$ and prior knowledge about natural images explicitly, to constrain the parameter search space and derive objective functions, using e.g. Total Variation (Chan & Wong, 1998; Farsiu et al., 2004), Tikhonov regularization (Nguyen et al., 2001) or Huber potential (Pickup et al., 2006) to define appropriate constraints on images.
|
| 57 |
+
|
| 58 |
+

|
| 59 |
+
Figure 3: Schematic of the full processing pipeline, trained end-to-end. At test time, only HighRes-net is used. (a) HighRes-net: In the Encode stage, an arbitrary number of LR views are paired with the reference low-res image (the median low-res in this work). Each LR view–reference pair is encoded into a view-specific latent representation. The LR encodings are fused recursively into a single global encoding. In the Decode stage, the global representation is upsampled by a certain zoom factor $\times 3$ in this work). Finally, the superresolved image is reconstructed by combining all channels of the upsampled global encoding. (b) Registered loss: Generally, the reconstructed SR will be shifted with respect to the ground-truth HR. ShiftNet learns to estimate the $( \Delta x , \Delta y )$ shift that improves the loss. Lanczos resampling: $( \Delta x , \Delta y )$ define two 1D shifting Lanczos kernels that translate the SR by a separable convolution.
|
| 60 |
+
|
| 61 |
+
In some situations, the image degradation process is complex or not available, motivating the development of nonparametric strategies. Patch-based methods learn to form high-resolution images directly from low-resolution patches, e.g. with $\mathbf { k }$ -nearest neighbor search (Freeman et al., 2002; Chang et al., 2004), sparse coding and sparse dictionary methods (Yang et al., 2010; Zeyde et al., 2010; Kim & Kwon, 2010)). The latter represents images in an over-complete basis and allows for sharing a prior across multiple sites.
|
| 62 |
+
|
| 63 |
+
In this work, we are particularly interested in super-resolving satellite imagery. Much of the recent work in Super-Resolution has focused on SISR for natural images. For instance, Dong et al. (2014) showed that training a CNN for super-resolution is equivalent to sparse coding and dictionary based approaches. Kim et al. (2016) proposed an approach to SISR using recursion to increase the receptive field of a model while maintaining capacity by sharing weights. Many more networks and learning strategies have recently been introduced for SISR and image deblurring. Benchmarks for SISR (Timofte et al., 2018), differ mainly in their upscaling method, network design, learning strategies, etc. We refer the reader to (Wang et al., 2019d) for a more comprehensive review.
|
| 64 |
+
|
| 65 |
+
Few deep-learning approaches have considered the more general MFSR setting and attempted to address it in an end-to-end learning framework. Reecently, Kawulok et al. (2019) proposed a shiftand-add method and suggested “including image registration” in the learning process as future work.
|
| 66 |
+
|
| 67 |
+
In the following sections, we describe our approach to solving both aspects of the registration problem – co-registration and registration-at-the-loss – in a memory-efficient manner.
|
| 68 |
+
|
| 69 |
+
# 3 HIGHRES-NET: MFSR BY RECURSIVE FUSION
|
| 70 |
+
|
| 71 |
+
In this section, we present HighRes-net, a neural network for multi-frame super-resolution inside a single spectral band (greyscale images), using joint co-registration and fusion of multiple lowresolution views in an end-to-end learning framework. From a high-level, HighRes-net consists of an encoder-decoder architecture and can be trained by stochastic gradient descent using highresolution ground truth as supervision, as shown in Figure 3.
|
| 72 |
+
|
| 73 |
+
Notation We denote by $\theta$ the parameters of HighRes-net trained for a given upscaling factor $\gamma$ . $L R _ { v , i } \ \in \ \mathbb { R } ^ { C \times W \times H }$ is one of a set of $K$ low-resolution views from the same site $v$ , where $C$ , $W$ and $H$ are the number of input channels, width and height of $L R _ { v , i }$ , respectively. We denote by $S R _ { v } ^ { \theta } = F _ { \theta } ^ { \gamma } \left( L R _ { v , 1 } . \right.$ , . . . , $L R _ { v , K } )$ , the output of HighRes-net and by $H R _ { v } \in \mathbb R ^ { C \times \gamma W \times \gamma H }$ a ground truth high-resolution image. We denote by $[ T _ { 1 } , T _ { 2 } ]$ the concatenation of two images channelwise. In the following we supress the index $v$ over sites for clarity.
|
| 74 |
+
|
| 75 |
+
HighRes-Net consists of three main steps: (1) encoding, which learns relevant features associated with each low-resolution view, (2) fusion, which merges relevant information from views within the same scene, and (3) decoding, which proposes a high-resolution reconstruction from the fused summary.
|
| 76 |
+
|
| 77 |
+
# 3.1 ENCODE, FUSE, DECODE
|
| 78 |
+
|
| 79 |
+
Embed, Encode The core assumption of MFSR is that the low-resolution image set contains collectively more information than any single low-resolution image alone, due to differences in photometric or spatial coverage for instance. However, the redundant low frequency information in multiple views can hinder the training and test performance of a MFSR model. We thus compute a reference image ref as a shared representation for multiple low-resolution views $\left( L R _ { i } \right) _ { i = 1 } ^ { K }$ and embed each image jointly with ref. This highlights differences across the multiple views (Sanchez et al., 2019), and potentially allows HighRes-net to focus on difficult high-frequency features such as crop boundaries and rivers during super-resolution. The shared representation or reference image intuitively serves as an anchor for implicitly aligning and denoising multiple views in deeper layers. We refer to this mechanism as implicit $c o$ -registration.
|
| 80 |
+
|
| 81 |
+
HighRes-net’s embedding layer $\operatorname { e m b } _ { \theta }$ consists of a convolutional layer and two residual blocks with PReLu activations (He et al., 2015) and is shared across all views. The embedded hidden states $s _ { i } ^ { 0 }$ are computed in parallel as follows:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\begin{array} { r l } & { r e f ( c , i , j ) = \operatorname * { m e d i a n } \left( L R _ { 1 } ( c , i , j ) , \mathrm { ~ } \ldots , \mathrm { ~ } L R _ { K } ( c , i , j ) \right) , \mathrm { s u c h ~ t h a t } r e f \in \mathbb { R } ^ { C \times W \times H } } \\ & { \qquad \quad s _ { i } ^ { 0 } = \operatorname { e m b } _ { \theta } \left( \left[ L R _ { i } , \mathrm { ~ } r e f \right] \right) \in \mathbb { R } ^ { C _ { h } \times W \times H } , } \end{array}
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $C _ { h }$ denotes the channels of the hidden state.
|
| 88 |
+
|
| 89 |
+
The imageset is padded if the number of low-res views $K ^ { \prime }$ is not a power of 2: we pad the set with dummy zero-valued views, such that the new size of the imageset $K$ is the next power of 2. See Algorithm 1, line 1.
|
| 90 |
+
|
| 91 |
+
Fuse The embedded hidden states $s _ { i } ^ { 0 }$ are then fused recursively, halving by two the number of low-resolution states at each fusion step $t$ , as shown in Figure 4. Given a pair of hidden states $s _ { i } ^ { t } , s _ { j } ^ { t }$ HighRes-net computes a new representation:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\begin{array} { r l } & { \left[ { \tilde { s } } _ { i } ^ { t } , \ { \tilde { s } } _ { j } ^ { t } \right] = \left[ s _ { i } ^ { t } , \ s _ { j } ^ { t } \right] + g _ { \theta } \left( \left[ s _ { i } ^ { t } , \ s _ { j } ^ { t } \right] \right) \in \mathbb { R } ^ { 2 C _ { h } \times W \times H } } \\ & { \quad \quad s _ { i } ^ { t + 1 } = s _ { i } ^ { t } + \alpha _ { j } f _ { \theta } \left( \tilde { s } _ { i } ^ { t } , \ { \tilde { s } } _ { j } ^ { t } \right) \in \mathbb { R } ^ { C _ { h } \times W \times H } , } \end{array}
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $\tilde { s } _ { i } ^ { t } , ~ \tilde { s } _ { j } ^ { t }$ are intermediate representations; $g _ { \theta }$ is a shared-representation within an inner residual block (equation 3); $f _ { \theta }$ is a fusion block, and $\alpha _ { j }$ is 0 if the $j$ -th low-resolution view is part of the padding, and 1 otherwise. $f _ { \theta }$ squashes $2 C _ { h }$ input channels into $C _ { h }$ channels and consists of a $( \mathrm { c o n v } 2 \mathrm { d } \mathrm { + } \mathrm { P r e L u } )$ . Intuitively, gθ aligns the two representations and it consists of two $\mathrm { \ c o n v { 2 d } + }$ PreLU) layers.
|
| 98 |
+
|
| 99 |
+
The blocks $\left( f _ { \theta } , g _ { \theta } \right)$ are shared across all pairs and depths, giving it the flexibility to deal with variable size inputs and significantly reduce the number of parameters to learn.
|
| 100 |
+
|
| 101 |
+
Upscale and Decode After $T = \log _ { 2 } K$ fusion layers, the final low-resolution encoded state $s _ { i } ^ { T }$ contains information from all $K$ input views. Any information of a spatial location that was initially missing from $L R _ { i }$ , is now encoded implicitly in $s _ { i } ^ { T }$ . $T$ is called the depth of HighRes-net. Only then, $s _ { i } ^ { T }$ is upsampled with a deconvolutional layer ( $\mathrm { { X u } }$ et al., 2014) to a higher-resolution space $s _ { H R } ^ { T } \in \dot { \mathbb { R } } ^ { C _ { h } \times \gamma W \times \gamma H }$ . The hidden high-resolution encoded state $s _ { H R } ^ { T }$ is eventually convolved with a $1 \times 1$ 2D kernel to produce a final super-resolved image $S R ^ { \theta } \in \bar { \mathbb { R } ^ { C \times \gamma W \times \gamma H } }$ .
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 4: HighRes-net’s global fusion operator consists of a co-registration $g _ { \theta }$ and a fusion $f _ { \theta }$ block which aligns and combines two representations into a single representation.
|
| 105 |
+
|
| 106 |
+
The overall architecture of HighRes-net is summarized in Figure 3(a) and the pseudocode for the forward pass is given in Algorithm 1.
|
| 107 |
+
|
| 108 |
+
# Algorithm 1: HighRes-net forward pass
|
| 109 |
+
|
| 110 |
+
<table><tr><td>Input: low-res views LR1 ...LRk'</td></tr><tr><td>1 (LR1...LRK,α1...αk)← pad(LR1...LRκ') // pad inputs to next power of 2</td></tr><tr><td>2 s ← encode(LRi) // parallelized across 1...K</td></tr><tr><td></td></tr><tr><td>3 T←log2K // fusion depth 4k←K</td></tr><tr><td>5 fort = 1...Tdo</td></tr><tr><td>6 fori = 1...k/2do t-1</td></tr><tr><td>st← fuse s-i, 7 Qk-i) // fuse encoded views 8 k=k/2</td></tr><tr><td>9 SR ← decode(sT)</td></tr><tr><td>Output: super-resolved view SR</td></tr></table>
|
| 111 |
+
|
| 112 |
+
# 4 REGISTRATION MATTERS
|
| 113 |
+
|
| 114 |
+
Co-registration matters for fusion. HighRes-net learns to implicity co-register multiple lowresolution views $L R _ { i }$ and fuse them into a single super resolved image $S R _ { \theta }$ .
|
| 115 |
+
|
| 116 |
+
A more explicit registration-at-the-loss can also be used for measuring similarity metrics and distances between $S R _ { \theta }$ and $H R$ . Indeed, training HighRes-Net alone, by minimizing a reconstruction error such as the mean-squared error between $S R _ { \theta }$ and $H R$ , leads to blurry outputs, since the neural network has to compensate for pixel and sub-pixel misalignments between its output $S R _ { \theta }$ and $H R$ .
|
| 117 |
+
|
| 118 |
+
Here, we present ShiftNet-Lanczos, a neural network that can be paired with HighRes-net to account for pixel and sub-pixel shifts in the loss, as depicted in Figure 3(b). Our ablation study A.2 and qualitative visual analysis suggest that this strategy helps HighRes-net learn to super-resolve and leads to clearly improved results.
|
| 119 |
+
|
| 120 |
+
# 4.1 SHIFTNET-LANCZOS
|
| 121 |
+
|
| 122 |
+
ShiftNet learns to align a pair of images with sub-pixel translations. ShiftNet registers pairs of images by predicting two parameters defining a global translation. Once a sub-pixel translation is found for a given pair of images, it is applied through a Lanczos shift kernel to align the images.
|
| 123 |
+
|
| 124 |
+
ShiftNet The architecture of ShiftNet is adapted from HomographyNet (DeTone et al., 2016). Translations are a special case of homographies. In this sense, ShiftNet is simply a special case of HomographyNet, predicting 2 shift parameters instead of 8 homography parameters. See Appendix A.3, for details on the architecture of ShiftNet.
|
| 125 |
+
|
| 126 |
+
Algorithm 2: Sub-pixel registered loss through ShiftNet-Lanczos
|
| 127 |
+
|
| 128 |
+
<table><tr><td>Input: SRθ, HR</td><td>// super-resolved view, high-resolution ground-truth</td></tr><tr><td>1 (△x,△y)← ShiftNet (SRe,HR)</td><td>// register SR to HR</td></tr><tr><td>2 κ△ ← LanczosShiftKernel(△)</td><td>// 1D Lanczos kernels for x and y sub-pixel shifts</td></tr><tr><td>3 SRθ,△ ← SRθ * K△x * K△y</td><td>// 2D sub-pixel shift by separable 1D convolutions</td></tr><tr><td></td><td>// sub-pixel registered loss</td></tr><tr><td>4 lθ,△ ← loss(SRθ,△,HR) Output: lθ,△</td><td></td></tr></table>
|
| 129 |
+
|
| 130 |
+
One major difference from HomographyNet is the way we train ShiftNet: In (DeTone et al., 2016), HomographyNet is trained on synthetically transformed data, supervised with ground-truth homography matrices. In our setting, ShiftNet is trained to cooperate with HighRes-net, towards the common goal of MFSR (see section Objective function below).
|
| 131 |
+
|
| 132 |
+
Lanczos shift & interpolation kernel To shift and align an image by a sub-pixel amount, it must be convolved with a filter that shifts for the integer parts and interpolates for the fractional parts of the translation. Standard options for interpolation include the nearest-neighbor, sinc, bilinear, bicubic, and Lanczos filters (Turkowski, 1990). The sinc filter has an infinite support as opposed to any digital signal, so in practice it produces ringing or ripple artifacts — an example of the Gibbs phenomenon. The nearest-neighbor and bilinear filters do not induce ringing, but strongly attenuate the higher-frequency components (over-smoothing), and can even alias the image. The Lanczos filter reduces the ringing significantly by using only a finite part of the since (up to a few lobes from the origin). Experimentally, we found the Lanczos filter to perform the best.
|
| 133 |
+
|
| 134 |
+
Objective function In our setting, registration benefits super-resolution. HighRes-net receives more informative gradient signals when its output is aligned with the ground truth high-resolution image. Conversely, super-resolution benefits registration, since good features are key to align images (Clement et al., 2018). We thus trained HighRes-Net and ShiftNet-Lanczos in a cooperative setting, where both neural networks work together to minimize an objective function, as opposed to an adversarial setting where a generator tries to fool a discriminator. HighRes-net infers a latent superresolved variable and ShiftNet maximises its similarity to a ground truth high-resolution image with sub-pixel shifts.
|
| 135 |
+
|
| 136 |
+
By predicting and applying sub-pixel translations in a differentiable way, our approach for registration and super-resolution can be combined in an end-to-end learning framework. Shift-Net predicts a sub-pixel shift $\Delta$ from a pair of high-resolution images. The predicted transformation is applied with Lanczos interpolation to align the two images at a pixel level. ShiftNet and HighRes-Net are trained jointly to minimize a common loss function, using backpropagation and stochastic gradient descent. Our objective function is composed of a registered reconstruction loss computed as in Algorithm 2. In our case, we used the corrected clear PSNR metric (cPSNR), chosen by ESA, which is a variant of the mean squared error, designed to correct for brightness and clouds in satellite images (Martens et al. ¨ , 2019), but the proposed architecture is decoupled from the choice of loss.
|
| 137 |
+
|
| 138 |
+
See Algorithm 4 for the pseudo-code for computing the alignment loss $\ell _ { \theta , \Delta }$ . We further regularize the L2 norm of ShiftNet’s ouput with a hyperparameter $\lambda$ and our final joint objective is given by:
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
L _ { \theta , \Delta } ( S R _ { \theta } , H R ) = \ell _ { \theta , \Delta } + \lambda | | \Delta | | _ { 2 } .
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
# 5 EXPERIMENTS AND RESULTS
|
| 145 |
+
|
| 146 |
+
Prior SR work has focused on super-resolving low-res images that are artificially generated by simple bilinear down-sampling, (Bulat et al., 2018) The PROBA-V satellite has separate cameras onboard for capturing high-res / low-res pairs. As far as we know, the PROBA-V dataset is the first publicly available dataset for MFSR that contains naturally occurring low-res and high-res pairs. This is in contrast to most of the work in SR (SISR, MFSR, Video SR, Stereo SR) that synthetically down-sample high-res images and frames (Wang et al., 2019c; Nah et al., 2019). Methods that are trained on artificially downscaled datasets fail to produce good results when applied to real-world low-resolution, low quality images (Shocher et al., 2018). For this reason, we experiment only on PROBA-V, a dataset that does not suffer from biases induced by artificial down-sampling.
|
| 147 |
+
|
| 148 |
+
# 5.1 PROBA-V KELVIN DATASET
|
| 149 |
+
|
| 150 |
+
The performance of our method is illustrated with satellite imagery from the Kelvin competition, organized by ESA’s Advanced Concept Team (ACT).
|
| 151 |
+
|
| 152 |
+
The Proba-V Kelvin dataset (Martens et al. ¨ , 2019) contains 1450 scenes (RED and NIR spectral bands) from 74 hand-selected Earth regions around the globe at different points in time. The scenes are split into 1160 scenes for training and 290 scenes for testing. Each data-point consists of exactly one $1 0 0 \mathrm { m }$ resolution image as $3 8 4 \times 3 8 4$ grey-scale pixel images (HR) and several $3 0 0 \mathrm { m }$ resolution images from the same scene as $1 2 8 \times 1 2 8$ grey-scale pixel images (LR), spaced days apart. We refer the reader to the Proba-V manual (Wolters et al., 2014) for further details on image acquisition.
|
| 153 |
+
|
| 154 |
+
Each scene comes with at least 9 low-res views, and an average of 19. Each view comes with a noisy quality map. The quality map is a binary map, that indicates concealed pixels due to volatile features, such as clouds, cloud shadows, ice, water and snow. The sum of clear pixels (1s in the binary mask) is defined as the clearance of a low-res view. These incidental and noisy features can change fundamental aspects of the image, such as the contrast, brightness, illumination and landscape features. We use the clearance scores to randomly sample from the imageset of low-res views, such that views with higher clearance are more likely to be selected. This strategy helps to prevent overfitting. See Appendix A.4 for more details.
|
| 155 |
+
|
| 156 |
+
Working with missing or noisy values A quality map can be used as a binary mask to indicate noisy or occluded pixels, due to clouds, snow, or other volatile objects. Such a mask can be fed as an additional input channel in the respective low-res view, in the same fashion as thereference frame. When missing value masks are available, neural networks can learn which parts of the input are anomalous, noisy, or missing, when provided with such binary masks (see e.g. Che et al. (2018)). In satellite applications where clouds masks are not available, other segmentation methods would be in order to infer such masks as a preprocessing step (e.g. Long et al. (2015)). In the case of the PROBA-V dataset, we get improved results when we make no use of the masks provided. Instead we use the masks only to inform the sampling scheme within the low-res imageset to prevent overfitting.
|
| 157 |
+
|
| 158 |
+
# 5.2 EXPERIMENTS
|
| 159 |
+
|
| 160 |
+
Across all experiments, we used the same hyperparameters, reported in Appendix A.1. By default, each imageset is padded to 32 views for training and testing, unless specified otherwise. Our pytorch implementation requires less than 9h of training on a single NVIDIA V100 GPU. At test time, superresolving an imageset of size $1 2 8 \mathrm { x } 1 2 8$ by a factor of 3, takes less than 0.2 seconds. Our code is made available on github1.
|
| 161 |
+
|
| 162 |
+
We evaluated different models on ESA’s Kelvin competition. Our best model, HighRes-Net trained jointly with shiftNet-Lanczos, scored consistently at the top of the public and final leaderboard, see Table 1. In the following, we discuss several baselines and report our experiments.
|
| 163 |
+
|
| 164 |
+
# 5.3 COMPARISONS
|
| 165 |
+
|
| 166 |
+
• ESA baseline upsamples each low-resolution view separately with bicubic up-sampling and averages those of maximum clearance.
|
| 167 |
+
• SRResNet (Ledig et al., 2017) is a deep learning SISR baseline.
|
| 168 |
+
SRResNet- $1 +$ shiftNet was trained with ShiftNet.
|
| 169 |
+
• SRResNet- $^ { 6 + }$ shiftNet differs from the previous model during test time only. It independently upsamples 6 low-resolution views with SRResNet-1, co-registers the super-resolved images using shiftNet, and averages the 6 aligned super-resolved images into a final prediction.
|
| 170 |
+
ACT baseline (Martens et al. ¨ , 2019) is a Convolutional Neural Network with five fixed channels for the five clearest low-resolution views.
|
| 171 |
+
DeepSUM baseline (Molini et al., 2019) can be seen as a variant of SRResNet- $\cdot 6 +$ shiftNet. Multiple low-res views are independently upsampled, then co-registered and fused into a single image.
|
| 172 |
+
• HighRes-net $^ +$ shiftNet are described in sections 3 and 4. Upsampling is done in the last step as opposed to (Molini et al., 2019).
|
| 173 |
+
• Ensemble An ensemble of two trained (HighRes-net $^ +$ shiftNet) models, one with ${ \mathrm { K } } { = } 1 6$ and one with ${ \mathrm { K } } { = } 3 2$ input views, whose outputs are averaged.
|
| 174 |
+
|
| 175 |
+
# 5.4 ESA KELVIN LEADERBOARD
|
| 176 |
+
|
| 177 |
+
The Kelvin competition used the corrected clear PSNR (cPSNR) quality metric as the standardized measure of performance. The cPSNR is a variant of the Peak Signal to Noise Ratio (PSNR) used to compensate for pixel-shifts and brightness bias. We refer the reader to (Martens et al. ¨ , 2019) for the motivation and derivation of this quality metric. The cPSNR metric is normalized by the score of the ESA baseline algorithm so that a score smaller than 1 means “better than the baseline” and lower is better. We also use it as our training objective with sub-pixel registration (see also section 3(b) on ShiftNet).
|
| 178 |
+
|
| 179 |
+
Table 1: Public and final leaderboard scores for the ESA’s Kelvin competition. Lower score means a better reconstruction.
|
| 180 |
+
|
| 181 |
+
<table><tr><td>Method</td><td>Public score</td><td>Final score</td></tr><tr><td>SRResNet (Ledig et al., 2017)</td><td>1.0095</td><td>1.0084</td></tr><tr><td>ESA baseline</td><td>1.0000</td><td>1.0000</td></tr><tr><td>SRResNet-1+ shiftNet</td><td>1.0002</td><td>0.9995</td></tr><tr><td>ACT baseline (Märtens et al., 2019)</td><td>0.9874</td><td>0.9879</td></tr><tr><td>SRResNet-6+ shiftNet</td><td>0.9808</td><td>0.9794</td></tr><tr><td>HighRes-net + shiftNet (ours)</td><td>0.9496</td><td>0.9488</td></tr><tr><td>HighRes-net+ shiftNet Ensemble (ours)</td><td>0.94738</td><td>0.94774</td></tr><tr><td>DeepSUM (Molini et al., 2019)</td><td>0.94884</td><td>0.94744</td></tr></table>
|
| 182 |
+
|
| 183 |
+
# 5.4.1 ABLATION STUDY
|
| 184 |
+
|
| 185 |
+
We further ran an ablation study on the available labeled data (1450 image sets), split in $9 0 \% / \ 1 0 \%$ for training and testing. Our results suggest that more low-resolution views benefit the reconstruction error, plateuing after 16 views, see Appendix A.2. Another finding is that registration matters for MFSR, both in co-registering low-res views, and registering-at-the-loss, see Appendix A.3. Finally, selecting the $k$ clearest views for fusion can lead to ovefitting. One remedy is to randomly sample the views with a bias for clearance, see A.4.
|
| 186 |
+
|
| 187 |
+
# 6 DISCUSSION
|
| 188 |
+
|
| 189 |
+
# 6.1 THE IMPORTANCE OF GROUNDED DETAILS
|
| 190 |
+
|
| 191 |
+
The PROBA-V satellite (Dierckx et al., 2014) was launched by ESA to monitor Earth’s vegetation growth, water resources and agriculture. As a form of data fusion and enrichment, multi-frame super-resolution could enhance the vision of such satellites for scientific and monitoring applications (Carlson & Ripley, 1997; Pettorelli et al., 2005). More broadly, satellite imagery can help NGOs and non-profits monitor the environment and human rights (Cornebise et al., 2018; Helber et al., 2018; Rudner et al., 2019; Rolnick et al., 2019) at scale, from space, ultimately contributing to the UN sustainable development goals. Low-resolution imagery is cheap or sometimes free, and it is frequently updated. However, with the addition of fake or imaginary details, such enhancement wouldn’t be valuable as scientific, legal, or forensic evidence.
|
| 192 |
+
|
| 193 |
+
# 6.2 FUTURE WORK
|
| 194 |
+
|
| 195 |
+
Registration matters at the loss stage but also at the fusion stage. The latter is not explicit in our model and the reason why and how it works is less understood. Learning to sample a reference frame and learning to fuse multiple representations with attention could also be a promising approach to extend HighRes-net.
|
| 196 |
+
|
| 197 |
+
Ensuring authenticity of detail is a major challenge and quantifying uncertainty of super-resolved images is an important line of future work for real world applications. Along this line of research, the question of how to evaluate a super-resolved image is important for downstream tasks and, more generally, similarity metrics remain an open question for many computer visions tasks (Bruna et al., 2015; Johnson et al., 2016; Isola et al., 2017; Ledig et al., 2017).
|
| 198 |
+
|
| 199 |
+
# 6.3 CONCLUSION
|
| 200 |
+
|
| 201 |
+
In this paper, we presented HighRes-net – the first deep learning approach to multi-frame superresolution that learns typical sub-tasks of MFSR in an end-to-end fashion: (i) co-registration, (ii) fusion, (iii) up-sampling, and (iv) registration-at-the-loss.
|
| 202 |
+
|
| 203 |
+
It recursively fuses a variable number of low-resolution views by learning a global fusion operator. The overall fusion also aligns all low-resolution views with an implicit co-registration mechanism through the reference channel. We also introduced ShiftNet-Lanczos, a network that learns to register and align the super-resolved output of HighRes-net with a high-resolution ground-truth.
|
| 204 |
+
|
| 205 |
+
Registration is important both to align multiple low-resolution inputs (co-registration) and to compute similarity metrics between shifted signals. Our experiments suggest that an end-to-end cooperative setting (HighRes-net $^ +$ ShiftNet-Lanczos) helps with training and test performance. By design, our approach is fast to train, faster to test, and low in terms of memory-footprint by doing the bulk of the computational work (co-registration $^ +$ fusion) on multiple images while maintaining their low-resolution height & width.
|
| 206 |
+
|
| 207 |
+
There is an ongoing proliferation of low-resolution yet high-revisit low-cost satellite imagery, but they often lack the detailed information of expensive high-resolution imagery. We believe MFSR can raise its potential to NGOs and non-profits that contribute to the UN Sunstainable Development Goals.
|
| 208 |
+
|
| 209 |
+
# REFERENCES
|
| 210 |
+
|
| 211 |
+
Joan Bruna, Pablo Sprechmann, and Yann LeCun. Super-resolution with deep convolutional sufficient statistics. arXiv preprint arXiv:1511.05666, 2015.
|
| 212 |
+
|
| 213 |
+
Adrian Bulat, Jing Yang, and Georgios Tzimiropoulos. To learn image super-resolution, use a gan to learn how to do image degradation first. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 185–200, 2018.
|
| 214 |
+
|
| 215 |
+
David Capel and Andrew Zisserman. Super-resolution from multiple views using learnt image models. In Proceedings of the 2001 IEEE Computer Society Conference on Computer Vision and Pattern Recognition. CVPR 2001, volume 2, pp. II–II. IEEE, 2001.
|
| 216 |
+
|
| 217 |
+
Toby N Carlson and David A Ripley. On the relation between ndvi, fractional vegetation cover, and leaf area index. Remote sensing of Environment, 62(3):241–252, 1997.
|
| 218 |
+
|
| 219 |
+
Tony F Chan and Chiu-Kwong Wong. Total variation blind deconvolution. IEEE transactions on Image Processing, 7(3):370–375, 1998.
|
| 220 |
+
|
| 221 |
+
Hong Chang, Dit-Yan Yeung, and Yimin Xiong. Super-resolution through neighbor embedding. In Proceedings of the 2004 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2004. CVPR 2004., volume 1, pp. I–I. IEEE, 2004.
|
| 222 |
+
|
| 223 |
+
Zhengping Che, Sanjay Purushotham, Kyunghyun Cho, David Sontag, and Yan Liu. Recurrent neural networks for multivariate time series with missing values. Scientific reports, 8(1):6085, 2018.
|
| 224 |
+
|
| 225 |
+
Colin B Clement, Matthew Bierbaum, and James P Sethna. Image registration and super resolution from first principles. arXiv preprint arXiv:1809.05583, 2018.
|
| 226 |
+
|
| 227 |
+
Julien Cornebise, Daniel Worrall, Micah Farfour, and Milena Marin. Witnessing atrocities: Quantifying villages destruction in darfur with crowdsourcing and transfer learning. In AI for Social Good NIPS2018 Workshop, Montreal, Canada ´ , 2018.
|
| 228 |
+
|
| 229 |
+
Daniel DeTone, Tomasz Malisiewicz, and Andrew Rabinovich. Deep image homography estimation. arXiv preprint arXiv:1606.03798, 2016.
|
| 230 |
+
|
| 231 |
+
Wouter Dierckx, Sindy Sterckx, Iskander Benhadj, Stefan Livens, Geert Duhoux, Tanja Van Achteren, Michael Francois, Karim Mellab, and Gilbert Saint. Proba-v mission for global vegetation monitoring: standard products and image quality. International Journal of Remote Sensing, 35(7):2589–2614, 2014.
|
| 232 |
+
|
| 233 |
+
Chao Dong, Chen Change Loy, Kaiming He, and Xiaoou Tang. Learning a deep convolutional network for image super-resolution. In European conference on computer vision, pp. 184–199. Springer, 2014.
|
| 234 |
+
|
| 235 |
+
K Eric Drexler. Reframing superintelligence: Comprehensive ai services as general intelligence, 2019.
|
| 236 |
+
|
| 237 |
+
Sina Farsiu, M Dirk Robinson, Michael Elad, and Peyman Milanfar. Fast and robust multiframe super resolution. IEEE transactions on image processing, 13(10):1327–1344, 2004.
|
| 238 |
+
|
| 239 |
+
J Michael Fitzpatrick, Derek LG Hill, Calvin R Maurer, et al. Image registration. Handbook of medical imaging, 2:447–513, 2000.
|
| 240 |
+
|
| 241 |
+
William T Freeman, Thouis R Jones, and Egon C Pasztor. Example-based super-resolution. IEEE Computer graphics and Applications, 22(2):56–65, 2002.
|
| 242 |
+
|
| 243 |
+
Theresa L. Harris, Jonathan Drake, Jessica M. Wyndham, Susan R. Wolfinbarger, Stephen D. Lott, and Michael Lerner. Geospatial evidence in international human rights litigation: Technical and legal considerations. Technical report, AAAS Scientific Responsibility, Human Rights and Law Program, 2018.
|
| 244 |
+
|
| 245 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing humanlevel performance on imagenet classification. In Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV), ICCV ’15, pp. 1026–1034, Washington, DC, USA, 2015. IEEE Computer Society. ISBN 978-1-4673-8391-2. doi: 10.1109/ICCV.2015.123. URL http://dx.doi.org/10.1109/ ICCV.2015.123.
|
| 246 |
+
|
| 247 |
+
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.
|
| 248 |
+
|
| 249 |
+
Patrick Helber, Bradley Gram-Hansen, Indhu Varatharajan, Faiza Azam, Alejandro Coca-Castro, Veronika Kopackova, and Piotr Bilinski. Mapping informal settlements in developing countries with multi-resolution, multi-spectral data. arXiv preprint arXiv:1812.00812, 2018.
|
| 250 |
+
|
| 251 |
+
Michal Irani and Shmuel Peleg. Improving resolution by image registration. CVGIP: Graphical models and image processing, 53(3):231–239, 1991.
|
| 252 |
+
|
| 253 |
+
Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1125–1134, 2017.
|
| 254 |
+
|
| 255 |
+
David Jensen and Jillian Campbell. The promise and peril of a digital ecosystem for the planet, September 2019. URL https://medium.com/@davidedjensen 99356/building-a-digitalecosystem-for-the-planet-557c41225dc2. [Online; posted 11-September-2019].
|
| 256 |
+
|
| 257 |
+
Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and superresolution. In European conference on computer vision, pp. 694–711. Springer, 2016.
|
| 258 |
+
|
| 259 |
+
Michal Kawulok, Pawel Benecki, Krzysztof Hrynczenko, Daniel Kostrzewa, Szymon Piechaczek, Jakub Nalepa, and Bogdan Smolka. Deep learning for fast super-resolution reconstruction from multiple images. In Real-Time Image Processing and Deep Learning 2019, volume 10996, pp. 109960B. International Society for Optics and Photonics, 2019.
|
| 260 |
+
|
| 261 |
+
Jiwon Kim, Jung Kwon Lee, and Kyoung Mu Lee. Deeply-recursive convolutional network for image superresolution. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1637– 1645, 2016.
|
| 262 |
+
|
| 263 |
+
Kwang In Kim and Younghee Kwon. Single-image super-resolution using sparse regression and natural image prior. IEEE transactions on pattern analysis and machine intelligence, 32(6):1127–1133, 2010.
|
| 264 |
+
|
| 265 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 266 |
+
|
| 267 |
+
Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Cunningham, Alejandro Acosta, Andrew ´ Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, et al. Photo-realistic single image super-resolution using a generative adversarial network. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4681–4690, 2017.
|
| 268 |
+
|
| 269 |
+
Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431–3440, 2015.
|
| 270 |
+
|
| 271 |
+
Robert J II Marks. Introduction to Shannon sampling and interpolation theory. Springer Science & Business Media, 2012.
|
| 272 |
+
|
| 273 |
+
Marcus Martens, Dario Izzo, Andrej Krzic, and Dani ¨ el Cox. Super-resolution of proba-v images using convo-¨ lutional neural networks. Astrodynamics, 3(4):387–402, Dec 2019.
|
| 274 |
+
|
| 275 |
+
Andrea Bordone Molini, Diego Valsesia, Giulia Fracastoro, and Enrico Magli. Deepsum: Deep neural network for super-resolution of unregistered multitemporal images. arXiv preprint arXiv:1907.06490, 2019.
|
| 276 |
+
|
| 277 |
+
Seungjun Nah, Radu Timofte, Sungyong Baik, Seokil Hong, Gyeongsik Moon, Sanghyun Son, and Kyoung Mu Lee. Ntire 2019 challenge on video deblurring: Methods and results. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 0–0, 2019.
|
| 278 |
+
|
| 279 |
+
Nhat Nguyen, Peyman Milanfar, and Gene Golub. A computationally efficient superresolution image reconstruction algorithm. IEEE transactions on image processing, 10(4):573–583, 2001.
|
| 280 |
+
|
| 281 |
+
Harry Nyquist. Certain topics in telegraph transmission theory. Transactions of the American Institute of Electrical Engineers, 47(2):617–644, 1928.
|
| 282 |
+
|
| 283 |
+
Athanasios Papoulis. Generalized sampling expansion. IEEE transactions on circuits and systems, 24(11): 652–654, 1977.
|
| 284 |
+
|
| 285 |
+
Nathalie Pettorelli, Jon Olav Vik, Atle Mysterud, Jean-Michel Gaillard, Compton J Tucker, and Nils Chr Stenseth. Using the satellite-derived ndvi to assess ecological responses to environmental change. Trends in ecology & evolution, 20(9):503–510, 2005.
|
| 286 |
+
|
| 287 |
+
Lyndsey C Pickup, Stephen J Roberts, and Andrew Zisserman. Optimizing and learning for super-resolution. In BMVC, volume 9, pp. 4–7. Citeseer, 2006.
|
| 288 |
+
|
| 289 |
+
David Rolnick, Priya L Donti, Lynn H Kaack, Kelly Kochanski, Alexandre Lacoste, Kris Sankaran, Andrew Slavin Ross, Nikola Milojevic-Dupont, Natasha Jaques, Anna Waldman-Brown, et al. Tackling climate change with machine learning. arXiv preprint arXiv:1906.05433, 2019.
|
| 290 |
+
|
| 291 |
+
Tim GJ Rudner, Marc Rußwurm, Jakub Fil, Ramona Pelich, Benjamin Bischke, Veronika Kopackov ˇ a, and ´ Piotr Bilinski. Multi3net: Segmenting flooded buildings via fusion of multiresolution, multisensor, and ´ multitemporal satellite imagery. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 702–709, 2019.
|
| 292 |
+
Mehdi SM Sajjadi, Raviteja Vemulapalli, and Matthew Brown. Frame-recurrent video super-resolution. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6626–6634, 2018.
|
| 293 |
+
Eduardo Sanchez, Mathieu Serrurier, and Mathias Ortner. Learning disentangled representations of satellite image time series. arXiv preprint arXiv:1903.08863, 2019.
|
| 294 |
+
Claude Elwood Shannon. Communication in the presence of noise. Proceedings of the IRE, 37(1):10–21, 1949.
|
| 295 |
+
Assaf Shocher, Nadav Cohen, and Michal Irani. zero-shot super-resolution using deep internal learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3118–3126, 2018.
|
| 296 |
+
Rupesh Kumar Srivastava, Klaus Greff, and Jurgen Schmidhuber. Highway networks. ¨ arXiv preprint arXiv:1505.00387, 2015.
|
| 297 |
+
Xin Tao, Hongyun Gao, Renjie Liao, Jue Wang, and Jiaya Jia. Detail-revealing deep video super-resolution. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4472–4480, 2017.
|
| 298 |
+
Radu Timofte, Shuhang Gu, Jiqing Wu, Luc Van Gool, Lei Zhang, Ming-Hsuan Yang, Muhammad Haris, et al. Ntire 2018 challenge on single image super-resolution: Methods and results. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, June 2018.
|
| 299 |
+
RY Tsai. Multiple frame image restoration and registration. Advances in Computer Vision and Image Processing, 1:1715–1984, 1984.
|
| 300 |
+
Ken Turkowski. Filters for common resampling tasks. In Graphics gems, pp. 147–165. Academic Press Professional, Inc., 1990.
|
| 301 |
+
Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: Sequence to sequence for sets. arXiv preprint arXiv:1511.06391, 2015.
|
| 302 |
+
Longguang Wang, Yingqian Wang, Zhengfa Liang, Zaiping Lin, Jungang Yang, Wei An, and Yulan Guo. Learning parallax attention for stereo image super-resolution. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 12250–12259, 2019a.
|
| 303 |
+
Xintao Wang, Kelvin CK Chan, Ke Yu, Chao Dong, and Chen Change Loy. Edvr: Video restoration with enhanced deformable convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 0–0, 2019b.
|
| 304 |
+
Yingqian Wang, Longguang Wang, Jungang Yang, Wei An, and Yulan Guo. Flickr1024: A large-scale dataset for stereo image super-resolution. In Proceedings of the IEEE International Conference on Computer Vision Workshops, pp. 0–0, 2019c.
|
| 305 |
+
Zhihao Wang, Jian Chen, and Steven CH Hoi. Deep learning for image super-resolution: A survey. arXiv preprint arXiv:1902.06068, 2019d.
|
| 306 |
+
Erwin Wolters, Wouter Dierckx, J Dries, and Else Swinnen. Proba-v products user manual. VITO. http://probav. vgt. vito. be/sites/default/files/Product User Manual. pdf, 2014.
|
| 307 |
+
Li Xu, Jimmy SJ Ren, Ce Liu, and Jiaya Jia. Deep convolutional neural network for image deconvolution. In Advances in Neural Information Processing Systems, pp. 1790–1798, 2014.
|
| 308 |
+
Bo Yan, Chuming Lin, and Weimin Tan. Frame and feature-context video super-resolution. arXiv preprint arXiv:1909.13057, 2019.
|
| 309 |
+
Jianchao Yang, John Wright, Thomas S Huang, and Yi Ma. Image super-resolution via sparse representation. IEEE transactions on image processing, 19(11):2861–2873, 2010.
|
| 310 |
+
Roman Zeyde, Michael Elad, and Matan Protter. On single image scale-up using sparse-representations. In International conference on curves and surfaces, pp. 711–730. Springer, 2010.
|
| 311 |
+
|
| 312 |
+
# A APPENDIX
|
| 313 |
+
|
| 314 |
+
# A.1 EXPERIMENTAL DETAILS
|
| 315 |
+
|
| 316 |
+
We trained our models on low-resolution patches of size 64x64. HighRes-net’s architecture is reported in Table 3. We denote by Conv2d(in, out, k, s, p) a conv2D layer with in and out input/output channels, kernel of size $^ { ( \mathrm { k } , \mathrm { k } ) }$ , stride (s,s) and padding p. We used the ADAM optimizer (Kingma & Ba, 2014) with default hyperparameters and trained our models on batches of size 32, for 400 epochs, using $90 \%$ of the data for training and $10 \%$ for validation. Our learning rate is initialized to 0.0007, decayed by a factor of 0.97 if the validation loss plateaus for more than 2 epochs. For the regularization of shiftNet, we employed $\lambda = 0 . 0 0 0 0 0 1$ .
|
| 317 |
+
|
| 318 |
+
Table 2: ResidualBlock(h) architecture
|
| 319 |
+
|
| 320 |
+
<table><tr><td>layerO layer1 layer2 layer3</td><td>Conv2d(in=h,out=h,k3,s1,p1) PReLU Conv2d(in=h,out=h,k3,s1, p1) PReLU</td></tr></table>
|
| 321 |
+
|
| 322 |
+
Table 3: HRNet architecture
|
| 323 |
+
|
| 324 |
+
<table><tr><td>Step</td><td>Layers</td><td>Number of params</td></tr><tr><td rowspan="4">encode</td><td>Conv2d(in=2, out=64,k3,s1, p1)</td><td>1216</td></tr><tr><td>PReLU</td><td>1</td></tr><tr><td>ResidualBlock(64)</td><td>73858</td></tr><tr><td>ResidualBlock(64)</td><td>73858</td></tr><tr><td rowspan="3">fuse</td><td>Conv2d(in=64,out=64,k3,s1, p1)</td><td>36928</td></tr><tr><td>ResidualBlock(128) Conv2d(in=128, out=64,k3, s1, p1)</td><td>295170</td></tr><tr><td>PReLU</td><td>73792 1</td></tr><tr><td rowspan="2">decode</td><td>ConvTranspose2d(in=64,out=64,k3, s1) PreLU</td><td>36928</td></tr><tr><td>Conv2d(in=64,out=1,k1, s1)</td><td>1 65</td></tr><tr><td>residual (optional)</td><td>Upsample(scale_factor=3.0, mode=bicubic)</td><td>0</td></tr><tr><td></td><td></td><td>591818 (total)</td></tr></table>
|
| 325 |
+
|
| 326 |
+
Thanks to weight sharing, HighRes-net super-resolves scenes with 32 views in 5 recursive steps, while requiring less than 600K parameters. ShiftNet has more than 34M parameters (34187648) but is dropped during test time. We report GPU memory requirements in table 4 for reproducibility purposes.
|
| 327 |
+
|
| 328 |
+
Table 4: GPU memory requirements to train HighRes-net $^ +$ ShiftNet on patches of size $6 4 \mathrm { x 6 4 }$ with batches of size 32, and a variable number of low-resolution frames.
|
| 329 |
+
|
| 330 |
+
<table><tr><td># views GPU memory (GB)</td><td>32 27</td><td>16 15</td><td>4 6</td></tr></table>
|
| 331 |
+
|
| 332 |
+
# A.2 HOW MANY FRAMES DO YOU NEED?
|
| 333 |
+
|
| 334 |
+
We trained and tested HighRes-net with ShiftNet using 1 to 32 frames. With a single image, our approach performs worse than the ESA baseline. Doubling the number of frames significantly improves both our training and validation scores. After 16 frames, our model’s performance stops increasing as show in Figure 5.
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
Figure 5: Public leaderboard scores vs. nviews for HighRes-net $^ +$ ShiftNet. Lower is better.
|
| 338 |
+
|
| 339 |
+
# A.3 REGISTRATION MATTERS
|
| 340 |
+
|
| 341 |
+
Registered loss The only explicit registration that we perform is at the loss stage, to allow the model partial credit for a solution. This solution can be enhanced but otherwise mis-registered wrt to the ground truth. We trained our base model HighRes-net without ShiftNet-Lanczos and observed a drop in performance as shown in Table 5. Registration matters and aligning outputs with targets helps HighRes-net generate sharper outputs and achieve competitive results.
|
| 342 |
+
|
| 343 |
+
Table 5: Registration matters: Train and validation scores for HighResNet trained with and without ShiftNet-Lanczos. Lower is better.
|
| 344 |
+
|
| 345 |
+
<table><tr><td rowspan=1 colspan=1>HighRes-net +</td><td rowspan=1 colspan=1>train score</td><td rowspan=1 colspan=1>test score</td></tr><tr><td rowspan=1 colspan=1>w/o registrationShiftNet +Lanczos</td><td rowspan=1 colspan=1>0.96160.9501</td><td rowspan=1 colspan=1>0.96710.9532</td></tr></table>
|
| 346 |
+
|
| 347 |
+
Implicit co-registration The traditional practice in MFSR is to explicitly co-register the LR views prior to super-resolution (Tsai, 1984; Molini et al., 2019). The knowledge of sub-pixel missalignments tells an algorithm what pieces of information to fuse from each LR image for any pixel in the SR output. Contrary to the conventional practice in MFSR, we propose implicit co-registeration by pairing LR views with a reference frame a.k.a. anchor. In this sense, we never explicitly compute the relative shifts between any LR pair. Instead, we simply stack each view with a chosen reference frame as an additional channel to the input. We call this strategy implicit co-registration, We found this strategy to be effective in the following ablation study which addresses the impact of the choice of a reference frame aka anchor.
|
| 348 |
+
|
| 349 |
+
We observe the median reference is the most effective in terms of train and test score. We suspect the median performs better than the mean because the median is more robust to outliers and can help denoise the LR views. Interestingly, training and testing without a shared reference performed worse than the ESA baseline. This shows that co-registration (implicit or explicit) matters. This can be due to the fact that the model lacks information to align and fuse the multiple views.
|
| 350 |
+
|
| 351 |
+
ShiftNet architecture ShitNet has 8 layers of (conv2D $^ +$ BatchNorm2d $^ +$ ReLU). Layer 2, 4 and 6 are followed by MaxPool2d. The final output is flattened to a vector $x$ of size 32768. Then, we compute a vector of size 1024, $x = \operatorname { R e L U } ( \operatorname { f c 1 } ( \operatorname { d r o p o u t } ( x ) ) )$ . The final shift prediction is $\operatorname { f c } 2 ( x )$ of size 2. The bulk of the parameters come from fc1, with $3 2 7 6 8 \times 1 0 2 4$ weights. These alone, account for $9 9 \%$ of ShiftNet’s parameters. Adding a MaxPool2d on top of layer 3, 5, 7 or 8 halves the parameters of ShiftNet.
|
| 352 |
+
|
| 353 |
+
Table 6: Train and validation scores for HighRes-net $^ +$ ShiftNet-Lanczos trained and tested with different references as input. Lower is better.
|
| 354 |
+
|
| 355 |
+
<table><tr><td>Reference</td><td>train score</td><td>test score</td></tr><tr><td>None (no co-registration)</td><td>1.0131</td><td>1.0088</td></tr><tr><td>Mean of 9 LRs</td><td>0.9636</td><td>0.9690</td></tr><tr><td>Median or 9 LRs (base)</td><td>0.9501</td><td>0.9532</td></tr></table>
|
| 356 |
+
|
| 357 |
+
# A.4 TOWARDS PERMUTATION INVARIANCE
|
| 358 |
+
|
| 359 |
+
A desirable property of a fusion model acting on an un-ordered set of images, is permutationinvariance: the output of the model should be invariant to the order in which the LR views are fused. An easy approach to encourage permutation invariant neural networks is to randomly shuffle the inputs at training time before feeding them to a model (Vinyals et al., 2015).
|
| 360 |
+
|
| 361 |
+
In addition to randomization, we still want to give more importance to clear LR views (with high clearance score), which can be done by sorting them by clearance. A good trade-off between uniform sampling and deterministic sorting by clearance, is to sample $k$ LR views without replacement and with a bias towards higher clearance:
|
| 362 |
+
|
| 363 |
+
$$
|
| 364 |
+
p ( i \mid C _ { 1 } , \ldots , C _ { k } ) = { \frac { e ^ { \beta C _ { i } } } { \sum _ { j = 1 } ^ { k } e ^ { \beta C _ { j } } } } ,
|
| 365 |
+
$$
|
| 366 |
+
|
| 367 |
+
where $k$ is the total number of LR views, $C _ { i }$ is the clearance score of $\mathrm { L R } _ { i }$ and $\beta$ regulates the bias towards higher clearance scores,
|
| 368 |
+
|
| 369 |
+
When $\beta = 0$ , this sampling strategy corresponds to uniform sampling and when $\beta = + i n f$ , this corresponds to picking the $\mathbf { k }$ -clearest views in a deterministic way. Our default model was trained with $\beta = 5 0$ and our experiments are reported in Table 7.
|
| 370 |
+
|
| 371 |
+
Table 7: Validation scores vs. nviews for HighRes-net $^ +$ ShiftNet. Lower is better.
|
| 372 |
+
|
| 373 |
+
<table><tr><td rowspan=1 colspan=1>Sampling strategy</td><td rowspan=1 colspan=1>train score</td><td rowspan=1 colspan=1>test score</td></tr><tr><td rowspan=1 colspan=1>β=∞ (k-clearest)β = 0 (uniform-k)β= 50 (base)</td><td rowspan=1 colspan=1>0.93860.96380.9501</td><td rowspan=1 colspan=1>0.96870.96750.9532</td></tr></table>
|
| 374 |
+
|
| 375 |
+
From Table 7, $\beta = \infty$ reaches best training score and worst testing score. For $\beta = 5 0$ and $\beta = 0$ , the train/test gap is much more reduced. This suggests that the deterministic strategy is overfitting and randomness prevents overfitting (diversity matters). On the other hand, $\beta = 5 0$ performs significantly better than $\beta = 0$ suggesting that biasing a model towards higher clearances could be beneficial i.e., clouds matter too.
|
md/train/Hk2aImxAb/Hk2aImxAb.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MULTI-SCALE DENSE NETWORKS FOR RESOURCE EFFICIENT IMAGE CLASSIFICATION
|
| 2 |
+
|
| 3 |
+
Gao Huang Cornell University
|
| 4 |
+
|
| 5 |
+
Danlu Chen Fudan University
|
| 6 |
+
|
| 7 |
+
Tianhong Li Tsinghua University
|
| 8 |
+
|
| 9 |
+
Felix Wu Cornell University
|
| 10 |
+
|
| 11 |
+
Laurens van der Maaten Facebook AI Research
|
| 12 |
+
|
| 13 |
+
Kilian Weinberger Cornell University
|
| 14 |
+
|
| 15 |
+
# ABSTRACT
|
| 16 |
+
|
| 17 |
+
In this paper we investigate image classification with computational resource limits at test time. Two such settings are: 1. anytime classification, where the network’s prediction for a test example is progressively updated, facilitating the output of a prediction at any time; and 2. budgeted batch classification, where a fixed amount of computation is available to classify a set of examples that can be spent unevenly across “easier” and “harder” inputs. In contrast to most prior work, such as the popular Viola and Jones algorithm, our approach is based on convolutional neural networks. We train multiple classifiers with varying resource demands, which we adaptively apply during test time. To maximally re-use computation between the classifiers, we incorporate them as early-exits into a single deep convolutional neural network and inter-connect them with dense connectivity. To facilitate high quality classification early on, we use a two-dimensional multi-scale network architecture that maintains coarse and fine level features all-throughout the network. Experiments on three image-classification tasks demonstrate that our framework substantially improves the existing state-of-the-art in both settings.
|
| 18 |
+
|
| 19 |
+
# 1 INTRODUCTION
|
| 20 |
+
|
| 21 |
+
Recent years have witnessed a surge in demand for applications of visual object recognition, for instance, in self-driving cars (Bojarski et al., 2016) and content-based image search (Wan et al., 2014). This demand has in part been fueled through the promise generated by the astonishing progress of convolutional networks (CNNs) on visual object recognition benchmark competition datasets, such as ILSVRC (Deng et al., 2009) and COCO (Lin et al., 2014), where state-of-the-art models may have even surpassed human-level performance (He et al., 2015; 2016).
|
| 22 |
+
|
| 23 |
+
However, the requirements of such competitions differ from realworld applications, which tend to incentivize resource-hungry models with high computational demands at inference time. For example, the COCO 2016 competition was won by a large ensemble of computationally intensive $\mathrm { \dot { C } N N s ^ { 1 } }$ — a model likely far too computationally expensive for any resource-aware application. Although much smaller models would also obtain decent error, very large, computationally intensive models seem necessary to correctly classify the hard examples that make up the bulk of the remaining misclassifications of modern algorithms. To illustrate this point, Figure 1 shows two images of horses. The left image depicts a horse in canonical pose and is easy to classify, whereas the right image is taken from a rare viewpoint and is likely in the tail of the data distribution. Computationally intensive models are needed to classify such tail examples correctly, but are wasteful when applied to canonical images such as the left one.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: Two images containing a horse. The left image is canonical and easy to detect even with a small model, whereas the right image requires a computationally more expensive network architecture. (Copyright Pixel Addict and Doyle (CC BY-ND 2.0).)
|
| 27 |
+
|
| 28 |
+
In real-world applications, computation directly translates into power consumption, which should be minimized for environmental and economical reasons, and is a scarce commodity on mobile devices. This begs the question: why do we choose between either wasting computational resources by applying an unnecessarily computationally expensive model to easy images, or making mistakes by using an efficient model that fails to recognize difficult images? Ideally, our systems should automatically use small networks when test images are easy or computational resources limited, and use big networks when test images are hard or computation is abundant.
|
| 29 |
+
|
| 30 |
+
Such systems would be beneficial in at least two settings with computational constraints at testtime: anytime prediction, where the network can be forced to output a prediction at any given point in time; and budgeted batch classification, where a fixed computational budget is shared across a large set of examples which can be spent unevenly across “easy” and “hard” examples. A practical use-case of anytime prediction is in mobile apps on Android devices: in 2015, there existed 24, 093 distinct Android devices2, each with its own distinct computational limitations. It is infeasible to train a different network that processes video frame-by-frame at a fixed framerate for each of these devices. Instead, you would like to train a single network that maximizes accuracy on all these devices, within the computational constraints of that device. The budget batch classification setting is ubiquitous in large-scale machine learning applications. Search engines, social media companies, on-line advertising agencies, all must process large volumes of data on limited hardware resources. For example, as of 2010, Google Image Search had over 10 Billion images indexed3, which has likely grown to over 1 Trillion since. Even if a new model to process these images is only 1/10s slower per image, this additional cost would add 3170 years of CPU time. In the budget batch classification setting, companies can improve the average accuracy by reducing the amount of computation spent on “easy” cases to save up computation for “hard” cases.
|
| 31 |
+
|
| 32 |
+
Motivated by prior work in computer vision on resource-efficient recognition (Viola & Jones, 2001), we aim to develop CNNs that “slice” the computation and process these slices one-by-one, stopping the evaluation once the CPU time is depleted or the classification sufficiently certain (through “early exits”). Unfortunately, the architecture of CNNs is inherently at odds with the introduction of early exits. CNNs learn the data representation and the classifier jointly, which leads to two problems with early exits: 1. The features in the last layer are extracted directly to be used by the classifier, whereas earlier features are not. The inherent dilemma is that different kinds of features need to be extracted depending on how many layers are left until the classification. 2. The features in different layers of the network may have different scale. Typically, the first layers of a deep nets operate on a fine scale (to extract low-level features), whereas later layers transition (through pooling or strided convolution) to coarse scales that allow global context to enter the classifier. Both scales are needed but happen at different places in the network.
|
| 33 |
+
|
| 34 |
+
We propose a novel network architecture that addresses both of these problems through careful design changes, allowing for resource-efficient image classification. Our network uses a cascade of intermediate classifiers throughout the network. The first problem, of classifiers altering the internal representation, is addressed through the introduction of dense connectivity (Huang et al., 2017). By connecting all layers to all classifiers, features are no longer dominated by the most imminent earlyexit and the trade-off between early or later classification can be performed elegantly as part of the loss function. The second problem, the lack of coarse-scale features in early layers, is addressed by adopting a multi-scale network structure. At each layer we produce features of all scales (fine-tocoarse), which facilitates good classification early on but also extracts low-level features that only become useful after several more layers of processing. Our network architecture is illustrated in Figure 2, and we refer to it as Multi-Scale DenseNet (MSDNet).
|
| 35 |
+
|
| 36 |
+
We evaluate MSDNets on three image-classification datasets. In the anytime classification setting, we show that it is possible to provide the ability to output a prediction at any time while maintain high accuracies throughout. In the budget batch classification setting we show that MSDNets can be effectively used to adapt the amount of computation to the difficulty of the example to be classified, which allows us to reduce the computational requirements of our models drastically whilst performing on par with state-of-the-art CNNs in terms of overall classification accuracy. To our knowledge this is the first deep learning architecture of its kind that allows dynamic resource adaptation with a single model and obtains competitive results throughout.
|
| 37 |
+
|
| 38 |
+

|
| 39 |
+
Figure 2: Illustration of the first four layers of an MSDNet with three scales. The horizontal direction corresponds to the layer direction (depth) of the network. The vertical direction corresponds to the scale of the feature maps. Horizontal arrows indicate a regular convolution operation, whereas diagonal and vertical arrows indicate a strided convolution operation. Classifiers only operate on feature maps at the coarsest scale. Connections across more than one layer are not drawn explicitly: they are implicit through recursive concatenations.
|
| 40 |
+
|
| 41 |
+
# 2 RELATED WORK
|
| 42 |
+
|
| 43 |
+
We briefly review related prior work on computation-efficient networks, memory-efficient networks, and resource-sensitive machine learning, from which our network architecture draws inspiration.
|
| 44 |
+
|
| 45 |
+
Computation-efficient networks. Most prior work on (convolutional) networks that are computationally efficient at test time focuses on reducing model size after training. In particular, many studies propose to prune weights (LeCun et al., 1989; Hassibi et al., 1993; Li et al., 2017) or quantize weights (Hubara et al., 2016; Rastegari et al., 2016) during or after training. These approaches are generally effective because deep networks often have a substantial number of redundant weights that can be pruned or quantized without sacrificing (and sometimes even improving) performance. Prior work also studies approaches that directly learn compact models with less parameter redundancy. For example, the knowledge-distillation method (Bucilua et al., 2006; Hinton et al., 2014) trains small student networks to reproduce the output of a much larger teacher network or ensemble. Our work differs from those approaches in that we train a single model that trades off computation for accuracy at test time without any re-training or finetuning. Indeed, weight pruning and knowledge distillation can be used in combination with our approach, and may lead to further improvements.
|
| 46 |
+
|
| 47 |
+
Resource-efficient machine learning. Various prior studies explore computationally efficient variants of traditional machine-learning models (Viola & Jones, 2001; Grubb & Bagnell, 2012; Karayev et al., 2014; Trapeznikov & Saligrama, 2013; Xu et al., 2012; 2013; Nan et al., 2015; Wang et al., 2015). Most of these studies focus on how to incorporate the computational requirements of computing particular features in the training of machine-learning models such as (gradient-boosted) decision trees. Whilst our study is certainly inspired by these results, the architecture we explore differs substantially: most prior work exploits characteristics of machine-learning models (such as decision trees) that do not apply to deep networks. Our work is possibly most closely related to recent work on FractalNets (Larsson et al., 2017), which can perform anytime prediction by progressively evaluating subnetworks of the full network. FractalNets differ from our work in that they are not explicitly optimized for computation efficiency and consequently our experiments show that MSDNets substantially outperform FractalNets. Our dynamic evaluation strategy for reducing batch computational cost is closely related to the the adaptive computation time approach (Graves, 2016; Figurnov et al., 2016), and the recently proposed method of adaptively evaluating neural networks (Bolukbasi et al., 2017). Different from these works, our method adopts a specially designed network with multiple classifiers, which are jointly optimized during training and can directly output confidence scores to control the evaluation process for each test example. The adaptive computation time method (Graves, 2016) and its extension (Figurnov et al., 2016) also perform adaptive evaluation on test examples to save batch computational cost, but focus on skipping units rather than layers. In (Odena et al., 2017), a “composer”model is trained to construct the evaluation network from a set of sub-modules for each test example. By contrast, our work uses a single CNN with multiple intermediate classifiers that is trained end-to-end. The Feedback Networks (Zamir et al., 2016) enable early predictions by making predictions in a recurrent fashion, which heavily shares parameters among classifiers, but is less efficient in sharing computation.
|
| 48 |
+
|
| 49 |
+
Related network architectures. Our network architecture borrows elements from neural fabrics (Saxena & Verbeek, 2016) and others (Zhou et al., 2015; Jacobsen et al., 2017; Ke et al., 2016)
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Figure 3: Relative accuracy of the intermediate classifier (left) and the final classifier (right) when introducing a single intermediate classifier at different layers in a ResNet, DenseNet and MSDNet. All experiments were performed on the CIFAR-100 dataset. Higher is better.
|
| 53 |
+
|
| 54 |
+
to rapidly construct a low-resolution feature map that is amenable to classification, whilst also maintaining feature maps of higher resolution that are essential for obtaining high classification accuracy. Our design differs from the neural fabrics (Saxena & Verbeek, 2016) substantially in that MSDNets have a reduced number of scales and no sparse channel connectivity or up-sampling paths. MSDNets are at least one order of magnitude more efficient and typically more accurate — for example, an MSDNet with less than 1 million parameters obtains a test error below $7 . 0 \%$ on CIFAR-10 (Krizhevsky & Hinton, 2009), whereas Saxena & Verbeek (2016) report $7 . 4 3 \%$ with over 20 million parameters. We use the same feature-concatenation approach as DenseNets (Huang et al., 2017), which allows us to bypass features optimized for early classifiers in later layers of the network. Our architecture is related to deeply supervised networks (Lee et al., 2015) in that it incorporates classifiers at multiple layers throughout the network. In contrast to all these prior architectures, our network is specifically designed to operate in resource-aware settings.
|
| 55 |
+
|
| 56 |
+
# 3 PROBLEM SETUP
|
| 57 |
+
|
| 58 |
+
We consider two settings that impose computational constraints at prediction time.
|
| 59 |
+
|
| 60 |
+
Anytime prediction. In the anytime prediction setting (Grubb & Bagnell, 2012), there is a finite computational budget $B > 0$ available for each test example $\mathbf { x }$ . The computational budget is nondeterministic, and varies per test instance. It is determined by the occurrence of an event that requires the model to output a prediction immediately. We assume that the budget is drawn from some joint distribution $P ( \mathbf { x } , B )$ . In some applications $P ( B )$ may be independent of $P ( \mathbf { x } )$ and can be estimated. For example, if the event is governed by a Poisson process, $P ( B )$ is an exponential distribution. We denote the loss of a model $f ( \mathbf { x } )$ that has to produce a prediction for instance $\mathbf { x }$ within budget $B$ by $L ( f ( \mathbf { x } ) , B )$ . The goal of an anytime learner is to minimize the expected loss under the budget distribution: $L ( f ) = \mathbb { E } \left[ L ( f ( \mathbf { x } ) , B ) \right] _ { P ( \mathbf { x } , B ) } .$ Here, $L ( \cdot )$ denotes a suitable loss function. As is common in the empirical risk minimization framework, the expectation under $P ( \mathbf { x } , B )$ may be estimated by an average over samples from $P ( \mathbf { x } , B )$ .
|
| 61 |
+
|
| 62 |
+
Budgeted batch classification. In the budgeted batch classification setting, the model needs to classify a set of examples $\mathcal { D } _ { t e s t } = \{ \mathbf { x } _ { 1 } , \ldots , \mathbf { x } _ { M } \}$ within a finite computational budget $B > 0$ that is known in advance. The learner aims to minimize the loss across all examples in $\mathcal { D } _ { t e s t }$ within a cumulative cost bounded by $B$ , which we denote by $L ( f ( \mathcal { D } _ { t e s t } ) , B )$ for some suitable loss function $L ( \cdot )$ . It can potentially do so by spending less than BM computation on classifying an “easy” example whilst using more than $\textstyle { \frac { B } { M } }$ computation on classifying a “difficult” example. Therefore, the budget considered here is a soft constraint when we have a large batch of testing samples.
|
| 63 |
+
|
| 64 |
+
# 4 MULTI-SCALE DENSE CONVOLUTIONAL NETWORKS
|
| 65 |
+
|
| 66 |
+
A straightforward solution to the two problems introduced in Section 3 is to train multiple networks of increasing capacity, and sequentially evaluate them at test time (as in Bolukbasi et al. (2017)). In the anytime setting the evaluation can be stopped at any point and the most recent prediction is returned. In the batch setting, the evaluation is stopped prematurely the moment a network classifies the test sample with sufficient confidence. When the resources are so limited that the execution is terminated after the first network, this approach is optimal because the first network is trained for exactly this computational budget without compromises. However, in both settings, this scenario is rare. In the more common scenario where some test samples can require more processing time than others the approach is far from optimal because previously learned features are never re-used across the different networks.
|
| 67 |
+
|
| 68 |
+
An alternative solution is to build a deep network with a cascade of classifiers operating on the features of internal layers: in such a network features computed for an earlier classifier can be re-used by later classifiers. However, na¨ıvely attaching intermediate early-exit classifiers to a stateof-the-art deep network leads to poor performance.
|
| 69 |
+
|
| 70 |
+
There are two reasons why intermediate early-exit classifiers hurt the performance of deep neural networks: early classifiers lack coarse-level features and classifiers throughout interfere with the feature generation process. In this section we investigate these effects empirically (see Figure 3) and, in response to our findings, propose the MSDNet architecture illustrated in Figure 2.
|
| 71 |
+
|
| 72 |
+
Problem: The lack of coarse-level features. Traditional neural networks learn features of fine scale in early layers and coarse scale in later layers (through repeated convolution, pooling, and strided convolution). Coarse scale features in the final layers are important to classify the content of the whole image into a single class. Early layers lack coarse-level features and early-exit classifiers attached to these layers will likely yield unsatisfactory high error rates. To illustrate this point, we attached4 intermediate classifiers to varying layers of a ResNet (He et al., 2016) and a DenseNet (Huang et al., 2017) on the CIFAR-100 dataset (Krizhevsky & Hinton, 2009). The blue and red dashed lines in the left plot of Figure 3 show the relative accuracies of these classifiers. All three plots gives rise to a clear trend: the accuracy of a classifier is highly correlated with its position within the network. Particularly in the case of the ResNet (blue line), one can observe a visible “staircase” pattern, with big improvements after the 2nd and 4th classifiers — located right after pooling layers.
|
| 73 |
+
|
| 74 |
+
Solution: Multi-scale feature maps. To address this issue, MSDNets maintain a feature representation at multiple scales throughout the network, and all the classifiers only use the coarse-level features. The feature maps at a particular layer5 and scale are computed by concatenating the results of one or two convolutions: 1. the result of a regular convolution applied on the same-scale features from the previous layer (horizontal connections) and, if possible, 2. the result of a strided convolution applied on the finer-scale feature map from the previous layer (diagonal connections). The horizontal connections preserve and progress high-resolution information, which facilitates the construction of high-quality coarse features in later layers. The vertical connections produce coarse features throughout that are amenable to classification. The dashed black line in Figure 3 shows that MSDNets substantially increase the accuracy of early classifiers.
|
| 75 |
+
|
| 76 |
+
Problem: Early classifiers interfere with later classifiers. The right plot of Figure 3 shows the accuracies of the final classifier as a function of the location of a single intermediate classifier, relative to the accuracy of a network without intermediate classifiers. The results show that the introduction of an intermediate classifier harms the final ResNet classifier (blue line), reducing its accuracy by up to $7 \%$ . We postulate that this accuracy degradation in the ResNet may be caused by the intermediate classifier influencing the early features to be optimized for the short-term and not for the final layers. This improves the accuracy of the immediate classifier but collapses information required to generate high quality features in later layers. This effect becomes more pronounced when the first classifier is attached to an earlier layer.
|
| 77 |
+
|
| 78 |
+
Solution: Dense connectivity. By contrast, the DenseNet (red line) suffers much less from this effect. Dense connectivity (Huang et al., 2017) connects each layer with all subsequent layers and allows later layers to bypass features optimized for the short-term, to maintain the high accuracy of the final classifier. If an earlier layer collapses information to generate short-term features, the lost information can be recovered through the direct connection to its preceding layer. The final classifier’s performance becomes (more or less) independent of the location of the intermediate classifier. As far as we know, this is the first paper that discovers that dense connectivity is an important element to early-exit classifiers in deep networks, and we make it an integral design choice in MSDNets.
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
Figure 4: The output $\mathbf { x } _ { \ell } ^ { s }$ of layer $\ell$ at the $s ^ { \mathrm { t h } }$ scale in a MSDNet. Herein, [. . . ] denotes the concatenation operator, $h _ { \ell } ^ { s } ( \cdot )$ a regular convolution transformation, and $\tilde { h } _ { \ell } ^ { s } ( \cdot )$ a strided convolutional. Note that the outputs of $h _ { \ell } ^ { s }$ and $\tilde { h } _ { \ell } ^ { s }$ have the same feature map size; their outputs are concatenated along the channel dimension.
|
| 82 |
+
|
| 83 |
+
# 4.1 THE MSDNET ARCHITECTURE
|
| 84 |
+
|
| 85 |
+
The MSDNet architecture is illustrated in Figure 2. We present its main components below. Additional details on the architecture are presented in Appendix A.
|
| 86 |
+
|
| 87 |
+
First layer. The first layer $\ell = 1 $ ) is unique as it includes vertical connections in Figure 2. Its main purpose is to “seed” representations on all $S$ scales. One could view its vertical layout as a miniature “S-layers” convolutional network $S { = } 3$ in Figure 2). Let us denote the output feature maps at layer $\ell$ and scale $s$ as $\mathbf { x } _ { \ell } ^ { s }$ and the original input image as $\mathbf { x } _ { 0 } ^ { 1 }$ . Feature maps at coarser scales are obtained via down-sampling. The output $\mathbf { x } _ { 1 } ^ { s }$ of the first layer is formally given in the top row of Figure 4.
|
| 88 |
+
|
| 89 |
+
Subsequent layers. Following Huang et al. (2017), the output feature maps $\mathbf { x } _ { \ell } ^ { s }$ produced at subsequent layers, $\ell > 1$ , and scales, $s$ , are a concatenation of transformed feature maps from all previous feature maps of scale $s$ and $s - 1$ (if $s > 1$ ). Formally, the $\ell \cdot$ -th layer of our network outputs a set of features at $S$ scales $\big \{ \mathbf { x } _ { \ell } ^ { 1 } , \dots , \mathbf { x } _ { \ell } ^ { S } \big \}$ , given in the last row of Figure 4.
|
| 90 |
+
|
| 91 |
+
Classifiers. The classifiers in MSDNets also follow the dense connectivity pattern within the coarsest scale, $S$ , i.e., the classifier at layer $\ell$ uses all the features $\left[ \mathbf { x } _ { 1 } ^ { S } , \ldots , \mathbf { x } _ { \ell } ^ { S } \right]$ . Each classifier consists of two convolutional layers, followed by one average pooling layer and one linear layer. In practice, we only attach classifiers to some of the intermediate layers, and we let $f _ { k } ( \cdot )$ denote the $k ^ { \mathrm { { t h } } }$ classifier. During testing in the anytime setting we propagate the input through the network until the budget is exhausted and output the most recent prediction. In the batch budget setting at test time, an example traverses the network and exits after classifier $f _ { k }$ if its prediction confidence (we use the maximum value of the softmax probability as a confidence measure) exceeds a pre-determined threshold $\theta _ { k }$ . Before training, we compute the computational cost, $C _ { k }$ , required to process the network up to the $k ^ { \mathrm { { t h } } }$ classifier. We denote by $0 < q \le 1$ a fixed exit probability that a sample that reaches a classifier will obtain a classification with sufficient confidence to exit. We assume that $q$ is constant across all layers, which allows us to compute the probability that a sample exits at classifier $k$ as: $q _ { k } = z ( 1 - q ) ^ { \bar { k ^ { - 1 } } q }$ , where $z$ is a normalizing constant that ensures that $\begin{array} { r } { \sum _ { k } p ( q _ { k } ) = 1 } \end{array}$ . At test time, we need to ensure that the overall cost of classifying all samples in $\mathcal { D } _ { t e s t }$ does not exceed our budget $B$ (in expectation). This gives rise to the constraint $\begin{array} { r } { \left| \mathcal { D } _ { t e s t } \right| \sum _ { k } q _ { k } C _ { k } \le B } \end{array}$ . We can solve this constraint for $q$ and determine the thresholds $\theta _ { k }$ on a validation set in such a way that approximately $| \mathcal { D } _ { t e s t } | q _ { k }$ validation samples exit at the $k ^ { \mathrm { { t h } } }$ classifier.
|
| 92 |
+
|
| 93 |
+
Loss functions. During training we use cross entropy loss functions $L ( f _ { k } )$ for all classifiers and minimize a weighted cumulative loss: $\begin{array} { r } { \frac { 1 } { | \mathcal { D } | } \sum _ { ( \mathbf { x } , y ) \in \mathcal { D } } \mathbf { \tilde { \sum } } _ { k } w _ { k } L ( f _ { k } ) } \end{array}$ . Herein, $\mathcal { D }$ denotes the training set and $w _ { k } \ge 0$ the weight of the $k$ -th classifier. If the budget distribution $P ( B )$ is known, we can use the weights $w _ { k }$ to incorporate our prior knowledge about the budget $B$ in the learning. Empirically, we find that using the same weight for all loss functions (i.e., setting $\forall k : w _ { k } = 1$ ) works well in practice.
|
| 94 |
+
|
| 95 |
+
Network reduction and lazy evaluation. There are two straightforward ways to further reduce the computational requirements of MSDNets. First, it is inefficient to maintain all the finer scales until the last layer of the network. One simple strategy to reduce the size of the network is by splitting it into $S$ blocks along the depth dimension, and only keeping the coarsest $( S - i + 1 )$ scales in the $i ^ { \mathrm { t h } }$ block (a schematic layout of this structure is shown in Figure 9). This reduces computational cost for both training and testing. Every time a scale is removed from the network, we add a transition layer between the two blocks that merges the concatenated features using a $1 \times 1$ convolution and cuts the number of channels in half before feeding the fine-scale features into the coarser scale via a strided convolution (this is similar to the DenseNet-BC architecture of Huang et al. (2017)). Second, since a classifier at layer $\ell$ only uses features from the coarsest scale, the finer feature maps in layer $\ell$ (and some of the finer feature maps in the previous $S - 2$ layers) do not influence the prediction of that classifier. Therefore, we group the computation in “diagonal blocks” such that we only propagate the example along paths that are required for the evaluation of the next classifier. This minimizes unnecessary computations when we need to stop because the computational budget is exhausted. We call this strategy lazy evaluation.
|
| 96 |
+
|
| 97 |
+
# 5 EXPERIMENTS
|
| 98 |
+
|
| 99 |
+
We evaluate the effectiveness of our approach on three image classification datasets, i.e., the CIFAR10, CIFAR-100 (Krizhevsky & Hinton, 2009) and ILSVRC 2012 (ImageNet; Deng et al. (2009)) datasets. Code to reproduce all results is available at https://anonymous-url. Details on architectural configurations of MSDNets are described in Appendix A.
|
| 100 |
+
|
| 101 |
+
Datasets. The two CIFAR datasets contain 50, 000 training and 10, 000 test images of $3 2 \times 3 2$ pixels; we hold out 5, 000 training images as a validation set. The datasets comprise 10 and 100 classes, respectively. We follow He et al. (2016) and apply standard data-augmentation techniques to the training images: images are zero-padded with 4 pixels on each side, and then randomly cropped to produce $3 2 \times 3 2$ images. Images are flipped horizontally with probability 0.5, and normalized by subtracting channel means and dividing by channel standard deviations. The ImageNet dataset comprises 1, 000 classes, with a total of 1.2 million training images and 50,000 validation images. We hold out 50,000 images from the training set to estimate the confidence threshold for classifiers in MSDNet. We adopt the data augmentation scheme of He et al. (2016) at training time; at test time, we classify a $2 2 4 \times 2 2 4$ center crop of images that were resized to $2 5 6 \times 2 5 6$ pixels.
|
| 102 |
+
|
| 103 |
+
Training Details. We train all models using the framework of Gross & Wilber (2016). On the two CIFAR datasets, all models (including all baselines) are trained using stochastic gradient descent (SGD) with mini-batch size 64. We use Nesterov momentum with a momentum weight of 0.9 without dampening, and a weight decay of $1 0 ^ { - 4 }$ . All models are trained for 300 epochs, with an initial learning rate of 0.1, which is divided by a factor 10 after 150 and 225 epochs. We apply the same optimization scheme to the ImageNet dataset, except that we increase the mini-batch size to 256, and all the models are trained for 90 epochs with learning rate drops after 30 and 60 epochs.
|
| 104 |
+
|
| 105 |
+
# 5.1 ANYTIME PREDICTION
|
| 106 |
+
|
| 107 |
+
In the anytime prediction setting, the model maintains a progressively updated distribution over classes, and it can be forced to output its most up-to-date prediction at an arbitrary time.
|
| 108 |
+
|
| 109 |
+
Baselines. There exist several baseline approaches for anytime prediction: FractalNets (Larsson et al., 2017), deeply supervised networks (Lee et al., 2015), and ensembles of deep networks of varying or identical sizes. FractalNets allow for multiple evaluation paths during inference time, which vary in computation time. In the anytime setting, paths are evaluated in order of increasing computation. In our result figures, we replicate the FractalNet results reported in the original paper (Larsson et al., 2017) for reference. Deeply supervised networks introduce multiple early-exit classifiers throughout a network, which are applied on the features of the particular layer they are attached to. Instead of using the original model proposed in Lee et al. (2015), we use the more competitive ResNet and DenseNet architectures (referred to as DenseNet- $B C$ in Huang et al. (2017)) as the base networks in our experiments with deeply supervised networks. We refer to these as $R e s N e t ^ { M C }$ and DenseNetMC, where $M C$ stands for multiple classifiers. Both networks require about $1 . 3 \times 1 0 ^ { 8 }$ FLOPs when fully evaluated; the detailed network configurations are presented in the supplementary material. In addition, we include ensembles of ResNets and DenseNets of varying or identical sizes. At test time, the networks are evaluated sequentially (in ascending order of network size) to obtain predictions for the test data. All predictions are averaged over the evaluated classifiers. On
|
| 110 |
+
|
| 111 |
+

|
| 112 |
+
Figure 5: Accuracy (top-1) of anytime prediction models as a function of computational budget on the ImageNet (left) and CIFAR-100 (right) datasets. Higher is better.
|
| 113 |
+
|
| 114 |
+
ImageNet, we compare MSDNet against a highly competitive ensemble of ResNets and DenseNets, with depth varying from 10 layers to 50 layers, and 36 layers to 121 layers, respectively.
|
| 115 |
+
|
| 116 |
+
Anytime prediction results are presented in Figure 5. The left plot shows the top-1 classification accuracy on the ImageNet validation set. Here, for all budgets in our evaluation, the accuracy of MSDNet substantially outperforms the ResNets and DenseNets ensemble. In particular, when the budget ranges from $0 . 1 \times \bar { 1 0 } ^ { 1 0 }$ to $0 . 3 \times 1 0 ^ { 1 0 }$ FLOPs, MSDNet achieves $\sim 4 \% - 8 \%$ higher accuracy.
|
| 117 |
+
|
| 118 |
+
We evaluate more baselines on CIFAR-100 (and CIFAR-10; see supplementary materials). We observe that MSDNet substantially outperforms ResNetsMC and DenseNetsMC at any computational budget within our range. This is due to the fact that after just a few layers, MSDNets have produced low-resolution feature maps that are much more suitable for classification than the high-resolution feature maps in the early layers of ResNets or DenseNets. MSDNet also outperforms the other baselines for nearly all computational budgets, although it performs on par with ensembles when the budget is very small. In the extremely low-budget regime, ensembles have an advantage because their predictions are performed by the first (small) network, which is optimized exclusively for the low budget. However, the accuracy of ensembles does not increase nearly as fast when the budget is increased. The MSDNet outperforms the ensemble as soon as the latter needs to evaluate a second model: unlike MSDNets, this forces the ensemble to repeat the computation of similar low-level features repeatedly. Ensemble accuracies saturate rapidly when all networks are shallow.
|
| 119 |
+
|
| 120 |
+
# 5.2 BUDGETED BATCH CLASSIFICATION
|
| 121 |
+
|
| 122 |
+
In budgeted batch classification setting, the predictive model receives a batch of $M$ instances and a computational budget $B$ for classifying all $M$ instances. In this setting, we use dynamic evaluation: we perform early-exiting of “easy” examples at early classifiers whilst propagating “hard” examples through the entire network, using the procedure described in Section 4.
|
| 123 |
+
|
| 124 |
+
Baselines. On ImageNet, we compare the dynamically evaluated MSDNet with five ResNets (He et al., 2016) and five DenseNets (Huang et al., 2017), AlexNet (Krizhevsky et al., 2012), and GoogleLeNet (Szegedy et al., 2015); see the supplementary material for details. We also evaluate an ensemble of the five ResNets that uses exactly the same dynamic-evaluation procedure as MSDNets at test time: “easy” images are only propagated through the smallest ResNet-10, whereas “hard” images are classified by all five ResNet models (predictions are averaged across all evaluated networks in the ensemble). We classify batches of $M = 1 2 8$ images.
|
| 125 |
+
|
| 126 |
+
On CIFAR-100, we compare MSDNet with several highly competitive baselines, including ResNets (He et al., 2016), DenseNets (Huang et al., 2017) of varying sizes, Stochastic Depth Networks (Huang et al., 2016), Wide ResNets (Zagoruyko & Komodakis, 2016) and FractalNets (Larsson et al., 2017). We also compare MSDNet to the $\mathrm { R e s N e t ^ { M C } }$ and DenseNetMC models that were used in Section 5.1, using dynamic evaluation at test time. We denote these baselines as $R e s N e t ^ { M C }$ / DenseNetMC with early-exits. To prevent the result plots from becoming too cluttered, we present CIFAR-100 results with dynamically evaluated ensembles in the supplementary material. We classify batches of $M = 2 5 6$ images at test time.
|
| 127 |
+
|
| 128 |
+
Budgeted batch classification results on ImageNet are shown in the left panel of Figure 7. We trained three MSDNets with different depths, each of which covers a different range of computational budgets. We plot the performance of each MSDNet as a gray curve; we select the best model for each budget based on its accuracy on the validation set, and plot the corresponding accuracy as a black curve. The plot shows that the predictions of MSDNets with dynamic evaluation are substantially more accurate than those of ResNets and DenseNets that use the same amount of computation. For instance, with an average budget of $1 . 7 \times 1 0 ^ { 9 }$ FLOPs, MSDNet achieves a top-1 accuracy of ${ \sim } 7 5 \%$ , which is ${ \sim } 6 \%$ higher than that achieved by a ResNet with the same number of FLOPs. Compared to the computationally efficient DenseNets, MSDNet uses $\sim 2 - 3 \times$ times fewer FLOPs to achieve the same classification accuracy. Moreover, MSDNet with dynamic evaluation allows for very precise tuning of the computational budget that is consumed, which is not possible with individual ResNet or DenseNet models. The ensemble of ResNets or DenseNets with dynamic evaluation performs on par with or worse than their individual counterparts (but they do allow for setting the computational budget very precisely).
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 7: Accuracy (top-1) of budgeted batch classification models as a function of average computational budget per image the on ImageNet (left) and CIFAR-100 (right) datasets. Higher is better.
|
| 132 |
+
|
| 133 |
+
The right panel of Figure 7 shows our results on CIFAR-100. The results show that MSDNets consistently outperform all baselines across all budgets. Notably, MSDNet performs on par with a 110- layer ResNet using only 1/10th of the computational budget and it is up to $\sim 5$ times more efficient than DenseNets, Stochastic Depth Networks, Wide ResNets, and FractalNets. Similar to results in the anytime-prediction setting, MSDNet substantially outperform ResNetsMC and DenseNets $_ { M C }$ with multiple intermediate classifiers, which provides further evidence that the coarse features in the MSDNet are important for high performance in earlier layers.
|
| 134 |
+
|
| 135 |
+
Visualization. To illustrate the ability of our approach to reduce the computational requirements for classifying “easy” examples, we show twelve randomly sampled test images from two ImageNet classes in Figure 6. The top row shows “easy” examples that were correctly classified and exited by the first classifier. The bottom row shows “hard” examples that would have been incorrectly classified by the first classifier but were passed on because its uncertainty was too high. The figure suggests that early classifiers recognize prototypical class examples, whereas the last classifier recognizes non-typical images.
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 6: Sampled images from the ImageNet classes Red wine and Volcano. Top row: images exited from the first classifier of a MSDNet with correct prediction; Bottom row: images failed to be correctly classified at the first classifier but were correctly predicted and exited at the last layer.
|
| 139 |
+
|
| 140 |
+
# 5.3 MORE COMPUTATIONALLY EFFICIENT DENSENETS
|
| 141 |
+
|
| 142 |
+
Here, we discuss an interesting finding during our exploration of the MSDNet architecture. We found that following the DenseNet structure to design our network, i.e., by keeping the number of output channels (or growth rate) the same at all scales, did not lead to optimal results in terms of the accuracy-speed trade-off. The main reason for this is that compared to network architectures like ResNets, the DenseNet structure tends to apply more filters on the high-resolution feature maps in the network. This helps to reduce the number of parameters in the model, but at the same time, it greatly increases the computational cost. We tried to modify DenseNets by doubling the growth rate after each transition layer, so that more filters are applied to low-resolution feature maps. It turns out that the resulting network, which we denote as DenseNet\*, significantly outperform the original DenseNet in terms of computational efficiency.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 8: Test accuracy of DenseNet\* on CIFAR-100 under the anytime learning setting (left) and the budgeted batch setting (right).
|
| 146 |
+
|
| 147 |
+
We experimented with DenseNet\* in our two settings with test time budget constraints. The left panel of Figure 8 shows the anytime prediction performance of an ensemble of DenseNets\* of varying depths. It outperforms the ensemble of original DenseNets of varying depth by a large margin, but is still slightly worse than MSDNets. In the budgeted batch budget setting, DenseNet\* also leads to significantly higher accuracy over its counterpart under all budgets, but is still substantially outperformed by MSDNets.
|
| 148 |
+
|
| 149 |
+
# 6 CONCLUSION
|
| 150 |
+
|
| 151 |
+
We presented the MSDNet, a novel convolutional network architecture, optimized to incorporate CPU budgets at test-time. Our design is based on two high-level design principles, to generate and maintain coarse level features throughout the network and to inter-connect the layers with dense connectivity. The former allows us to introduce intermediate classifiers even at early layers and the latter ensures that these classifiers do not interfere with each other. The final design is a two dimensional array of horizontal and vertical layers, which decouples depth and feature coarseness. Whereas in traditional convolutional networks features only become coarser with increasing depth, the MSDNet generates features of all resolutions from the first layer on and maintains them throughout. The result is an architecture with an unprecedented range of efficiency. A single network can outperform all competitive baselines on an impressive range of computational budgets ranging from highly limited CPU constraints to almost unconstrained settings.
|
| 152 |
+
|
| 153 |
+
As future work we plan to investigate the use of resource-aware deep architectures beyond object classification, e.g. image segmentation (Long et al., 2015). Further, we intend to explore approaches that combine MSDNets with model compression (Chen et al., 2015; Han et al., 2015), spatially adaptive computation (Figurnov et al., 2016) and more efficient convolution operations (Chollet, 2016; Howard et al., 2017) to further improve computational efficiency.
|
| 154 |
+
|
| 155 |
+
# ACKNOWLEDGMENTS
|
| 156 |
+
|
| 157 |
+
The authors are supported in part by grants from the National Science Foundation ( III-1525919, IIS-1550179, IIS-1618134, S&AS 1724282, and CCF-1740822), the Office of Naval Research DOD (N00014-17-1-2175), and the Bill and Melinda Gates Foundation.
|
| 158 |
+
|
| 159 |
+
# REFERENCES
|
| 160 |
+
|
| 161 |
+
Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316, 2016.
|
| 162 |
+
|
| 163 |
+
Tolga Bolukbasi, Joseph Wang, Ofer Dekel, and Venkatesh Saligrama. Adaptive neural networks for fast test-time prediction. arXiv preprint arXiv:1702.07811, 2017.
|
| 164 |
+
Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In ACM SIGKDD, pp. 535–541. ACM, 2006.
|
| 165 |
+
Wenlin Chen, James T Wilson, Stephen Tyree, Kilian Q Weinberger, and Yixin Chen. Compressing neural networks with the hashing trick. In ICML, pp. 2285–2294, 2015.
|
| 166 |
+
Franc¸ois Chollet. Xception: Deep learning with depthwise separable convolutions. arXiv preprint arXiv:1610.02357, 2016.
|
| 167 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pp. 248–255, 2009.
|
| 168 |
+
Michael Figurnov, Maxwell D Collins, Yukun Zhu, Li Zhang, Jonathan Huang, Dmitry Vetrov, and Ruslan Salakhutdinov. Spatially adaptive computation time for residual networks. arXiv preprint arXiv:1612.02297, 2016.
|
| 169 |
+
Alex Graves. Adaptive computation time for recurrent neural networks. arXiv preprint arXiv:1603.08983, 2016.
|
| 170 |
+
Sam Gross and Michael Wilber. Training and investigating residual nets. 2016. URL http: //torch.ch/blog/2016/02/04/resnets.html.
|
| 171 |
+
Alexander Grubb and Drew Bagnell. Speedboost: Anytime prediction with uniform near-optimality. In AISTATS, volume 15, pp. 458–466, 2012.
|
| 172 |
+
Song Han, Huizi Mao, and William J. Dally. Deep compression: Compressing deep neural network with pruning, trained quantization and huffman coding. CoRR, abs/1510.00149, 2015.
|
| 173 |
+
Babak Hassibi, David G Stork, and Gregory J Wolff. Optimal brain surgeon and general network pruning. In IJCNN, pp. 293–299, 1993.
|
| 174 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In ICCV, pp. 1026–1034, 2015.
|
| 175 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016.
|
| 176 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. In NIPS Deep Learning Workshop, 2014.
|
| 177 |
+
Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
|
| 178 |
+
Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In ECCV, pp. 646–661. Springer, 2016.
|
| 179 |
+
Gao Huang, Zhuang Liu, Kilian Q Weinberger, and Laurens van der Maaten. Densely connected convolutional networks. In CVPR, 2017.
|
| 180 |
+
Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks. In NIPS, pp. 4107–4115, 2016.
|
| 181 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, pp. 770–778, 2015.
|
| 182 |
+
Jorn-Henrik Jacobsen, Edouard Oyallon, St ¨ ephane Mallat, and Arnold WM Smeulders. Multiscale ´ hierarchical convolutional networks. arXiv preprint arXiv:1703.04140, 2017.
|
| 183 |
+
Sergey Karayev, Mario Fritz, and Trevor Darrell. Anytime recognition of objects and scenes. In CVPR, pp. 572–579, 2014.
|
| 184 |
+
Tsung-Wei Ke, Michael Maire, and Stella X. Yu. Neural multigrid. CoRR, abs/1611.07661, 2016. URL http://arxiv.org/abs/1611.07661.
|
| 185 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Tech Report, 2009.
|
| 186 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pp. 1097–1105, 2012.
|
| 187 |
+
Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. In ICLR, 2017.
|
| 188 |
+
Yann LeCun, John S Denker, Sara A Solla, Richard E Howard, and Lawrence D Jackel. Optimal brain damage. In NIPS, volume 2, pp. 598–605, 1989.
|
| 189 |
+
Chen-Yu Lee, Saining Xie, Patrick W Gallagher, Zhengyou Zhang, and Zhuowen Tu. Deeplysupervised nets. In AISTATS, volume 2, pp. 5, 2015.
|
| 190 |
+
Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. In ICLR, 2017.
|
| 191 |
+
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ ECCV, pp. 740–755. Springer, 2014.
|
| 192 |
+
Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, pp. 3431–3440, 2015.
|
| 193 |
+
Feng Nan, Joseph Wang, and Venkatesh Saligrama. Feature-budgeted random forest. In ICML, pp. 1983–1991, 2015.
|
| 194 |
+
Augustus Odena, Dieterich Lawson, and Christopher Olah. Changing model behavior at test-time using reinforcement learning. arXiv preprint arXiv:1702.07780, 2017.
|
| 195 |
+
Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In ECCV, pp. 525–542. Springer, 2016.
|
| 196 |
+
Shreyas Saxena and Jakob Verbeek. Convolutional neural fabrics. In NIPS, pp. 4053–4061, 2016.
|
| 197 |
+
Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, pp. 1–9, 2015.
|
| 198 |
+
Kirill Trapeznikov and Venkatesh Saligrama. Supervised sequential classification under budget constraints. In AI-STATS, pp. 581–589, 2013.
|
| 199 |
+
Paul Viola and Michael Jones. Robust real-time object detection. International Journal of Computer Vision, 4(34–47), 2001.
|
| 200 |
+
Ji Wan, Dayong Wang, Steven Chu Hong Hoi, Pengcheng Wu, Jianke Zhu, Yongdong Zhang, and Jintao Li. Deep learning for content-based image retrieval: A comprehensive study. In ACM Multimedia, pp. 157–166, 2014.
|
| 201 |
+
Joseph Wang, Kirill Trapeznikov, and Venkatesh Saligrama. Efficient learning by directed acyclic graph for resource constrained prediction. In NIPS, pp. 2152–2160. 2015.
|
| 202 |
+
Zhixiang Xu, Olivier Chapelle, and Kilian Q. Weinberger. The greedy miser: Learning under testtime budgets. In ICML, pp. 1175–1182, 2012.
|
| 203 |
+
Zhixiang Xu, Matt Kusner, Minmin Chen, and Kilian Q. Weinberger. Cost-sensitive tree of classifiers. In ICML, volume 28, pp. 133–141, 2013.
|
| 204 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In BMVC, 2016.
|
| 205 |
+
A. R. Zamir, T.-L. Wu, L. Sun, W. Shen, B. E. Shi, J. Malik, and S. Savarese. Feedback Networks. ArXiv e-prints, December 2016.
|
| 206 |
+
Yisu Zhou, Xiaolin Hu, and Bo Zhang. Interlinked convolutional neural networks for face parsing. In International Symposium on Neural Networks, pp. 222–231. Springer, 2015.
|
| 207 |
+
|
| 208 |
+
# A DETAILS OF MSDNET ARCHITECTURE AND BASELINE NETWORKS
|
| 209 |
+
|
| 210 |
+
We use MSDNet with three scales on the CIFAR datasets, and the network reduction method introduced in 4.1 is applied. Figure 9 gives an illustration of the reduced network. The convolutional layer functions in the first layer, $h _ { 1 } ^ { s }$ , denote a sequence of $3 { \times } 3$ convolutions (Conv), batch normalization (BN; Ioffe & Szegedy (2015)), and rectified linear unit (ReLU) activation. In the computation of $\tilde { h } _ { 1 } ^ { s }$ , down-sampling is performed by applying convolutions using strides that are powers of two. For subsequent feature layers, the transformations $h _ { \ell } ^ { s }$ and $\tilde { h } _ { \ell } ^ { s }$ are defined following the design in DenseNets (Huang et al., 2017): Conv $( 1 \times 1 )$ -BN-ReLU-Conv $\left( 3 \times 3 \right)$ -BN-ReLU. We set the number of output channels of the three scales to 6, 12, and 24, respectively. Each classifier has two down-sampling convolutional layers with 128 dimensional $3 \times 3$ filters, followed by a $2 \times 2$ average pooling layer and a linear layer.
|
| 211 |
+
|
| 212 |
+
The MSDNet used for ImageNet has four scales, respectively producing 16, 32, 64, and 64 feature maps at each layer. The network reduction is also applied to reduce computational cost. The original images are first transformed by a $7 \times 7$ convolution and a $3 \times 3$ max pooling (both with stride 2), before entering the first layer of MSDNets. The classifiers have the same structure as those used for the CIFAR datasets, except that the number of output channels of each convolutional layer is set to be equal to the number of its input channels.
|
| 213 |
+
|
| 214 |
+

|
| 215 |
+
Figure 9: Illustration of an MSDNet with network reduction. The network has $S = 3$ scales, and it is divided into three blocks, which maintain a decreasing number of scales. A transition layer is placed between two contiguous blocks.
|
| 216 |
+
|
| 217 |
+
Network architecture for anytime prediction. The MSDNet used in our anytime-prediction experiments has 24 layers (each layer corresponds to a column in Fig. 1 of the main paper), using the reduced network with transition layers as described in Section 4. The classifiers operate on the output of the $2 \times ( i { + } 1 ) ^ { \mathrm { t h } }$ layers, with $i = 1 , \ldots , 1 1$ . On ImageNet, we use MSDNets with four scales, and the $i ^ { \mathrm { { t h } } }$ classifier operates on the $( k \times i + 3 ) ^ { \mathrm { t h } }$ layer (with $i = 1 , \ldots , 5$ ), where $k = 4 , 6$ and 7. For simplicity, the losses of all the classifiers are weighted equally during training.
|
| 218 |
+
|
| 219 |
+
Network architecture for budgeted batch setting. The MSDNets used here for the two CIFAR datasets have depths ranging from 10 to 36 layers, using the reduced network with transition layers as described in Section 4. The $k ^ { \mathrm { { t h } } }$ classifier is attached to the $( \sum _ { i = 1 } ^ { k } i ) ^ { \mathrm { t h } }$ layer. The MSDNets used for ImageNet are the same as those described for the anytime learning setting.
|
| 220 |
+
|
| 221 |
+
$\mathbf { R e s N e t } ^ { \mathbf { M C } }$ and DenseNetMC. The ResNetMC has 62 layers, with 10 residual blocks at each spatial resolution (for three resolutions): we train early-exit classifiers on the output of the $4 ^ { \mathrm { t h } }$ and $8 ^ { \mathrm { t h } }$ residual blocks at each resolution, producing a total of 6 intermediate classifiers (plus the final classification layer). The DenseNetMC consists of 52 layers with three dense blocks and each of them has 16 layers. The six intermediate classifiers are attached to the $6 ^ { \mathrm { { t h } } }$ and $1 2 ^ { \mathrm { t h } }$ layer in each block, also with dense connections to all previous layers in that block.
|
| 222 |
+
|
| 223 |
+
# B ADDITIONAL RESULTS
|
| 224 |
+
|
| 225 |
+
# B.1 ABLATION STUDY
|
| 226 |
+
|
| 227 |
+
We perform additional experiments to shed light on the contributions of the three main components of MSDNet, viz., multi-scale feature maps, dense connectivity, and intermediate classifiers.
|
| 228 |
+
|
| 229 |
+
We start from an MSDNet with six intermediate classifiers and remove the three main components one at a time. To make our comparisons fair, we keep the computational costs of the full networks similar, at around $3 . 0 \times 1 0 ^ { 8 }$ FLOPs, by adapting the network width, i.e., number of output channels at each layer. After removing all the three components in an MSDNet, we obtain a regular VGG-like convolutional network. We show the classification accuracy of all classifiers in a model in the left panel of Figure 10. Several observations can be made: 1. the dense connectivity is crucial for the performance of MSDNet and removing it hurts the overall accuracy drastically (orange vs. black curve); 2. removing multi-scale convolution hurts the accuracy only in the lower budget regions, which is consistent with our mo
|
| 230 |
+
|
| 231 |
+

|
| 232 |
+
Figure 10: Ablation study (on CIFAR-100) of MSDNets that shows the effect of dense connectivity, multi-scale features, and intermediate classifiers. Higher is better.
|
| 233 |
+
|
| 234 |
+
tivation that the multi-scale design introduces discriminative features early on; 3. the final canonical CNN (star) performs similarly as MSDNet under the specific budget that matches its evaluation cost exactly, but it is unsuited for varying budget constraints. The final CNN performs substantially better at its particular budget region than the model without dense connectivity (orange curve). This suggests that dense connectivity is particularly important in combination with multiple classifiers.
|
| 235 |
+
|
| 236 |
+
# B.2 RESULTS ON CIFAR-10
|
| 237 |
+
|
| 238 |
+
For the CIFAR-10 dataset, we use the same MSDNets and baseline models as we used for CIFAR100, except that the networks used here have a 10-way fully connected layer at the end. The results under the anytime learning setting and the batch computational budget setting are shown in the left and right panel of Figure 11, respectively. Similar to what we have observed from the results on CIFAR-100 and ImageNet, MSDNets outperform all the baselines by a significant margin in both settings. As in the experiments presented in the main paper, ResNet and DenseNet models with multiple intermediate classifiers perform relatively poorly.
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 11: Classification accuracies on the CIFAR-10 dataset in the anytime-prediction setting (left) and the budgeted batch setting (right).
|
md/train/HkpbnH9lx/HkpbnH9lx.md
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DENSITY ESTIMATION USING REAL NVP
|
| 2 |
+
|
| 3 |
+
Laurent Dinh∗
|
| 4 |
+
Montreal Institute for Learning Algorithms
|
| 5 |
+
University of Montreal
|
| 6 |
+
Montreal, QC H3T1J4
|
| 7 |
+
|
| 8 |
+
Jascha Sohl-Dickstein Google Brain
|
| 9 |
+
|
| 10 |
+
Samy Bengio Google Brain
|
| 11 |
+
|
| 12 |
+
# ABSTRACT
|
| 13 |
+
|
| 14 |
+
Unsupervised learning of probabilistic models is a central yet challenging problem in machine learning. Specifically, designing models with tractable learning, sampling, inference and evaluation is crucial in solving this task. We extend the space of such models using real-valued non-volume preserving (real NVP) transformations, a set of powerful, stably invertible, and learnable transformations, resulting in an unsupervised learning algorithm with exact log-likelihood computation, exact and efficient sampling, exact and efficient inference of latent variables, and an interpretable latent space. We demonstrate its ability to model natural images on four datasets through sampling, log-likelihood evaluation, and latent variable manipulations.
|
| 15 |
+
|
| 16 |
+
# 1 Introduction
|
| 17 |
+
|
| 18 |
+
The domain of representation learning has undergone tremendous advances due to improved supervised learning techniques. However, unsupervised learning has the potential to leverage large pools of unlabeled data, and extend these advances to modalities that are otherwise impractical or impossible.
|
| 19 |
+
|
| 20 |
+
One principled approach to unsupervised learning is generative probabilistic modeling. Not only do generative probabilistic models have the ability to create novel content, they also have a wide range of reconstruction related applications including inpainting [61, 46, 59], denoising [3], colorization [71], and super-resolution [9].
|
| 21 |
+
|
| 22 |
+
As data of interest are generally high-dimensional and highly structured, the challenge in this domain is building models that are powerful enough to capture its complexity yet still trainable. We address this challenge by introducing real-valued non-volume preserving (real NVP) transformations, a tractable yet expressive approach to modeling high-dimensional data.
|
| 23 |
+
|
| 24 |
+
This model can perform efficient and exact inference, sampling and log-density estimation of data points. Moreover, the architecture presented in this paper enables exact and efficient reconstruction of input images from the hierarchical features extracted by this model.
|
| 25 |
+
|
| 26 |
+
# 2 Related work
|
| 27 |
+
|
| 28 |
+
Substantial work on probabilistic generative models has focused on training models using maximum likelihood. One class of maximum likelihood models are those described by probabilistic undirected graphs, such as Restricted Boltzmann Machines [58] and Deep Boltzmann Machines [53]. These models are trained by taking advantage of the conditional independence property of their bipartite structure to allow efficient exact or approximate posterior inference on latent variables. However, because of the intractability of the associated marginal distribution over latent variables, their training, evaluation, and sampling procedures necessitate the use of approximations like Mean Field inference and Markov Chain Monte Carlo, whose convergence time for such complex models
|
| 29 |
+
|
| 30 |
+
# Inference
|
| 31 |
+
|
| 32 |
+
$$
|
| 33 |
+
\begin{array} { l } { x \sim \hat { p } _ { X } } \\ { z = f \left( x \right) } \end{array}
|
| 34 |
+
$$
|
| 35 |
+
|
| 36 |
+
# Generation
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\begin{array} { l } { z \sim p z } \\ { x = f ^ { - 1 } \left( z \right) } \end{array}
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 1: Real NVP learns an invertible, stable, mapping between a data distribution $\hat { p } _ { X }$ and a latent distribution $p _ { Z }$ (typically a Gaussian). Here we show a mapping that has been learned on a toy 2-d dataset. The function $f \left( x \right)$ maps samples $x$ from the data distribution in the upper left into approximate samples $z$ from the latent distribution, in the upper right. This corresponds to exact inference of the latent state given the data. The inverse function, $f ^ { - \bar { 1 } } \left( z \right)$ , maps samples $z$ from the latent distribution in the lower right into approximate samples $x$ from the data distribution in the lower left. This corresponds to exact generation of samples from the model. The transformation of grid lines in $\mathcal { X }$ and $\mathcal { Z }$ space is additionally illustrated for both $f \left( x \right)$ and $f ^ { - 1 } \left( z \right)$ .
|
| 44 |
+
|
| 45 |
+
remains undetermined, often resulting in generation of highly correlated samples. Furthermore, these approximations can often hinder their performance [7].
|
| 46 |
+
|
| 47 |
+
Directed graphical models are instead defined in terms of an ancestral sampling procedure, which is appealing both for its conceptual and computational simplicity. They lack, however, the conditional independence structure of undirected models, making exact and approximate posterior inference on latent variables cumbersome [56]. Recent advances in stochastic variational inference [27] and amortized inference [13, 43, 35, 49], allowed efficient approximate inference and learning of deep directed graphical models by maximizing a variational lower bound on the log-likelihood [45]. In particular, the variational autoencoder algorithm [35, 49] simultaneously learns a generative network, that maps gaussian latent variables $z$ to samples $x$ , and a matched approximate inference network that maps samples $x$ to a semantically meaningful latent representation $z$ , by exploiting the reparametrization trick [68]. Its success in leveraging recent advances in backpropagation [51, 39] in deep neural networks resulted in its adoption for several applications ranging from speech synthesis [12] to language modeling [8]. Still, the approximation in the inference process limits its ability to learn high dimensional deep representations, motivating recent work in improving approximate inference [42, 48, 55, 63, 10, 59, 34].
|
| 48 |
+
|
| 49 |
+
Such approximations can be avoided altogether by abstaining from using latent variables. Autoregressive models [18, 6, 37, 20] can implement this strategy while typically retaining a great deal of flexibility. This class of algorithms tractably models the joint distribution by decomposing it into a product of conditionals using the probability chain rule according to a fixed ordering over dimensions, simplifying log-likelihood evaluation and sampling. Recent work in this line of research has taken advantage of recent advances in recurrent networks [51], in particular long-short term memory [26], and residual networks [25, 24] in order to learn state-of-the-art generative image models [61, 46] and language models [32]. The ordering of the dimensions, although often arbitrary, can be critical to the training of the model [66]. The sequential nature of this model limits its computational efficiency. For example, its sampling procedure is sequential and non-parallelizable, which can become cumbersome in applications like speech and music synthesis, or real-time rendering. Additionally, there is no natural latent representation associated with autoregressive models, and they have not yet been shown to be useful for semi-supervised learning.
|
| 50 |
+
|
| 51 |
+
Generative Adversarial Networks (GANs) [21] on the other hand can train any differentiable generative network by avoiding the maximum likelihood principle altogether. Instead, the generative network is associated with a discriminator network whose task is to distinguish between samples and real data. Rather than using an intractable log-likelihood, this discriminator network provides the training signal in an adversarial fashion. Successfully trained GAN models [21, 15, 47] can consistently generate sharp and realistically looking samples [38]. However, metrics that measure the diversity in the generated samples are currently intractable [62, 22, 30]. Additionally, instability in their training process [47] requires careful hyperparameter tuning to avoid diverging behavior.
|
| 52 |
+
|
| 53 |
+
Training such a generative network $g$ that maps latent variable $z \sim p _ { Z }$ to a sample $x \sim p _ { X }$ does not in theory require a discriminator network as in GANs, or approximate inference as in variational autoencoders. Indeed, if $g$ is bijective, it can be trained through maximum likelihood using the change of variable formula:
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
p _ { X } ( x ) = p _ { Z } ( z ) \left. \operatorname* { d e t } \left( \frac { \partial g ( z ) } { \partial z ^ { T } } \right) \right. ^ { - 1 } .
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
This formula has been discussed in several papers including the maximum likelihood formulation of independent components analysis (ICA) [4, 28], gaussianization [14, 11] and deep density models [5, 50, 17, 3]. As the existence proof of nonlinear ICA solutions [29] suggests, auto-regressive models can be seen as tractable instance of maximum likelihood nonlinear ICA, where the residual corresponds to the independent components. However, naive application of the change of variable formula produces models which are computationally expensive and poorly conditioned, and so large scale models of this type have not entered general use.
|
| 60 |
+
|
| 61 |
+
# 3 Model definition
|
| 62 |
+
|
| 63 |
+
In this paper, we will tackle the problem of learning highly nonlinear models in high-dimensional continuous spaces through maximum likelihood. In order to optimize the log-likelihood, we introduce a more flexible class of architectures that enables the computation of log-likelihood on continuous data using the change of variable formula. Building on our previous work in [17], we define a powerful class of bijective functions which enable exact and tractable density evaluation and exact and tractable inference. Moreover, the resulting cost function does not to rely on a fixed form reconstruction cost such as square error [38, 47], and generates sharper samples as a result. Also, this flexibility helps us leverage recent advances in batch normalization [31] and residual networks [24, 25] to define a very deep multi-scale architecture with multiple levels of abstraction.
|
| 64 |
+
|
| 65 |
+
# 3.1 Change of variable formula
|
| 66 |
+
|
| 67 |
+
Given an observed data variable $x \in X$ , a simple prior probability distribution $p _ { Z }$ on a latent variable $z \in Z$ , and a bijection $f : X \to Z$ (with $g = f ^ { - \hat { 1 } }$ ), the change of variable formula defines a model distribution on $X$ by
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\begin{array} { c } { p _ { X } ( x ) = p _ { Z } \left( f ( x ) \right) \left. \operatorname* { d e t } \left( \frac { \partial f ( x ) } { \partial x ^ { T } } \right) \right. } \\ { \log \left( p _ { X } ( x ) \right) = \log \left( p _ { Z } \left( f ( x ) \right) \right) + \log \left( \left. \operatorname* { d e t } \left( \frac { \partial f ( x ) } { \partial x ^ { T } } \right) \right. \right) , } \end{array}
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
where $\frac { \partial f ( x ) } { \partial x ^ { T } }$ is the Jacobian of $f$ at $x$
|
| 74 |
+
|
| 75 |
+
Exact samples from the resulting distribution can be generated by using the inverse transform sampling rule [16]. A sample $z \sim p _ { Z }$ is drawn in the latent space, and its inverse image $x = f ^ { - 1 } ( z ) \overset { \cdot } { = } g ( \overset { \cdot } { z } )$ generates a sample in the original space. Computing the density on a point $x$ is accomplished by computing the density of its image $f ( x )$ and multiplying by the associated Jacobian determinant $\operatorname* { d e t } \left( { \frac { \partial f ( x ) } { \partial x ^ { T } } } \right)$ . See also Figure 1. Exact and efficient inference enables the accurate and fast evaluation of the model.
|
| 76 |
+
|
| 77 |
+

|
| 78 |
+
Figure 2: Computational graphs for forward and inverse propagation. A coupling layer applies a simple invertible transformation consisting of scaling followed by addition of a constant offset to one part $\mathbf { x } _ { 2 }$ of the input vector conditioned on the remaining part of the input vector $\mathbf { x } _ { 1 }$ . Because of its simple nature, this transformation is both easily invertible and possesses a tractable determinant. However, the conditional nature of this transformation, captured by the functions $s$ and $t$ , significantly increase the flexibility of this otherwise weak function. The forward and inverse propagation operations have identical computational cost.
|
| 79 |
+
|
| 80 |
+
# 3.2 Coupling layers
|
| 81 |
+
|
| 82 |
+
Computing the Jacobian of functions with high-dimensional domain and codomain and computing the determinants of large matrices are in general computationally very expensive. This combined with the restriction to bijective functions makes Equation 2 appear impractical for modeling arbitrary distributions.
|
| 83 |
+
|
| 84 |
+
As shown however in [17], by careful design of the function $f$ , a bijective model can be learned which is both tractable and extremely flexible. As computing the Jacobian determinant of the transformation is crucial to effectively train using this principle, this work exploits the simple observation that the determinant of a triangular matrix can be efficiently computed as the product of its diagonal terms.
|
| 85 |
+
|
| 86 |
+
We will build a flexible and tractable bijective function by stacking a sequence of simple bijections. In each simple bijection, part of the input vector is updated using a function which is simple to invert, but which depends on the remainder of the input vector in a complex way. We refer to each of these simple bijections as an affine coupling layer. Given a $D$ dimensional input $x$ and $d < D$ , the output $y$ of an affine coupling layer follows the equations
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r } { y _ { 1 : d } = x _ { 1 : d } \qquad } \\ { y _ { d + 1 : D } = x _ { d + 1 : D } \odot \exp \big ( s ( x _ { 1 : d } ) \big ) + t ( x _ { 1 : d } ) , } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $s$ and $t$ stand for scale and translation, and are functions from $R ^ { d } \mapsto R ^ { D - d }$ , and $\odot$ is the Hadamard product or element-wise product (see Figure 2(a)).
|
| 93 |
+
|
| 94 |
+
# 3.3 Properties
|
| 95 |
+
|
| 96 |
+
The Jacobian of this transformation is
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\frac { \partial y } { \partial x ^ { T } } = \left[ \begin{array} { c c } { \mathbb { I } _ { d } } & { 0 } \\ { \frac { \partial y _ { d + 1 : D } } { \partial x _ { 1 : d } ^ { T } } } & { \mathrm { d i a g } \left( \exp \left[ s \left( x _ { 1 : d } \right) \right] \right) } \end{array} \right] ,
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
where diag $\left( \exp { \left[ s \left( x _ { 1 : d } \right) \right] } \right)$ is the diagonal matrix whose diagonal elements correspond to the vector $\exp { \left[ s \left( x _ { 1 : d } \right) \right] }$ . Given the observation that this Jacobian is triangular, we can efficiently compute its determinant as $\begin{array} { r } { \exp \left[ \sum _ { j } s \left( x _ { 1 : d } \right) _ { j } \right] } \end{array}$ . Since computing the Jacobian determinant of the coupling layer operation does not involve computing the Jacobian of $s$ or $t$ , those functions can be arbitrarily complex. We will make them deep convolutional neural networks. Note that the hidden layers of $s$ and $t$ can have more features than their input and output layers.
|
| 103 |
+
|
| 104 |
+
Another interesting property of these coupling layers in the context of defining probabilistic models is their invertibility. Indeed, computing the inverse is no more complex than the forward propagation
|
| 105 |
+
|
| 106 |
+

|
| 107 |
+
Figure 3: Masking schemes for affine coupling layers. On the left, a spatial checkerboard pattern mask. On the right, a channel-wise masking. The squeezing operation reduces the $4 \times 4 \times 1$ tensor (on the left) into a $2 \times 2 \times 4$ tensor (on the right). Before the squeezing operation, a checkerboard pattern is used for coupling layers while a channel-wise masking pattern is used afterward.
|
| 108 |
+
|
| 109 |
+
(see Figure 2(b)),
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\begin{array} { r l } { \underset { y _ { d + 1 : D } } { \overset { } { \{ y _ { 1 : d } } } } & { = x _ { 1 : d } } \\ { \underset { \Leftrightarrow \begin{array} { l l } { y _ { d + 1 : D } } & { = x _ { d + 1 : D } \odot \exp \big ( s ( x _ { 1 : d } ) \big ) + t ( x _ { 1 : d } ) } \\ { \quad } \end{array} } \\ { \quad \Leftrightarrow \underset { x _ { d + 1 : D } } { \overset { } { \{ x _ { 1 : d } } } } } & { = y _ { 1 : d } } \\ { \quad \qquad \quad x _ { d + 1 : D } } & { = \big ( y _ { d + 1 : D } - t ( y _ { 1 : d } ) \big ) \odot \exp \big ( - s ( y _ { 1 : d } ) \big ) , } \end{array}
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
meaning that sampling is as efficient as inference for this model. Note again that computing the inverse of the coupling layer does not require computing the inverse of $s$ or $t$ , so these functions can be arbitrarily complex and difficult to invert.
|
| 116 |
+
|
| 117 |
+
# 3.4 Masked convolution
|
| 118 |
+
|
| 119 |
+
Partitioning can be implemented using a binary mask $b$ , and using the functional form for $y$ ,
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
y = b \odot x + ( 1 - b ) \odot { \Big ( } x \odot \exp { \big ( } s ( b \odot x ) { \big ) } + t ( b \odot x ) { \Big ) } .
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
We use two partitionings that exploit the local correlation structure of images: spatial checkerboard patterns, and channel-wise masking (see Figure 3). The spatial checkerboard pattern mask has value 1 where the sum of spatial coordinates is odd, and 0 otherwise. The channel-wise mask $b$ is 1 for the first half of the channel dimensions and 0 for the second half. For the models presented here, both $s ( \cdot )$ and $t ( \cdot )$ are rectified convolutional networks.
|
| 126 |
+
|
| 127 |
+
# 3.5 Combining coupling layers
|
| 128 |
+
|
| 129 |
+
Although coupling layers can be powerful, their forward transformation leaves some components unchanged. This difficulty can be overcome by composing coupling layers in an alternating pattern, such that the components that are left unchanged in one coupling layer are updated in the next (see Figure 4(a)).
|
| 130 |
+
|
| 131 |
+
The Jacobian determinant of the resulting function remains tractable, relying on the fact that
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\begin{array} { r l r } { { \frac { \partial ( f _ { b } \circ f _ { a } ) } { \partial x _ { a } ^ { T } } ( x _ { a } ) = \frac { \partial f _ { a } } { \partial x _ { a } ^ { T } } ( x _ { a } ) \cdot \frac { \partial f _ { b } } { \partial x _ { b } ^ { T } } \big ( x _ { b } = f _ { a } ( x _ { a } ) \big ) } } \\ & { } & { \operatorname* { d e t } ( A \cdot B ) = \operatorname* { d e t } ( A ) \operatorname* { d e t } ( B ) . } \end{array}
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
Similarly, its inverse can be computed easily as
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
( f _ { b } \circ f _ { a } ) ^ { - 1 } = f _ { a } ^ { - 1 } \circ f _ { b } ^ { - 1 } .
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
|
| 145 |
+
(a) In this alternating pattern, units which remain identical in one transformation are modified in the next.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
(b) Factoring out variables. At each step, half the variables are directly modeled as Gaussians, while the other half undergo further transformation.
|
| 149 |
+
Figure 4: Composition schemes for affine coupling layers.
|
| 150 |
+
|
| 151 |
+
# 3.6 Multi-scale architecture
|
| 152 |
+
|
| 153 |
+
We implement a multi-scale architecture using a squeezing operation: for each channel, it divides the image into subsquares of shape $2 \times 2 \times c$ , then reshapes them into subsquares of shape $1 \times 1 \times 4 c$ . The squeezing operation transforms an $s \times s \times c$ tensor into an $\frac { s } { 2 } \times \frac { s } { 2 } \times 4 c$ tensor (see Figure 3), effectively trading spatial size for number of channels.
|
| 154 |
+
|
| 155 |
+
At each scale, we combine several operations into a sequence: we first apply three coupling layers with alternating checkerboard masks, then perform a squeezing operation, and finally apply three more coupling layers with alternating channel-wise masking. The channel-wise masking is chosen so that the resulting partitioning is not redundant with the previous checkerboard masking (see Figure 3). For the final scale, we only apply four coupling layers with alternating checkerboard masks.
|
| 156 |
+
|
| 157 |
+
Propagating a $D$ dimensional vector through all the coupling layers would be cumbersome, in terms of computational and memory cost, and in terms of the number of parameters that would need to be trained. For this reason we follow the design choice of [57] and factor out half of the dimensions at regular intervals (see Equation 14). We can define this operation recursively (see Figure 4(b)),
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\begin{array} { c } { h ^ { ( 0 ) } = x } \\ { ( z ^ { ( i + 1 ) } , h ^ { ( i + 1 ) } ) = f ^ { ( i + 1 ) } ( h ^ { ( i ) } ) } \\ { z ^ { ( L ) } = f ^ { ( L ) } ( h ^ { ( L - 1 ) } ) } \\ { z = ( z ^ { ( 1 ) } , . . . , z ^ { ( L ) } ) . } \end{array}
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
In our experiments, we use this operation for $i < L$ . The sequence of coupling-squeezing-coupling operations described above is performed per layer when computing $f ^ { ( i ) }$ (Equation 14). At each layer, as the spatial resolution is reduced, the number of hidden layer features in $s$ and $t$ is doubled. All variables which have been factored out at different scales are concatenated to obtain the final transformed output (Equation 16).
|
| 164 |
+
|
| 165 |
+
As a consequence, the model must Gaussianize units which are factored out at a finer scale (in an earlier layer) before those which are factored out at a coarser scale (in a later layer). This results in the definition of intermediary levels of representation [53, 49] corresponding to more local, fine-grained features as shown in Appendix D.
|
| 166 |
+
|
| 167 |
+
Moreover, Gaussianizing and factoring out units in earlier layers has the practical benefit of distributing the loss function throughout the network, following the philosophy similar to guiding intermediate layers using intermediate classifiers [40]. It also reduces significantly the amount of computation and memory used by the model, allowing us to train larger models.
|
| 168 |
+
|
| 169 |
+
# 3.7 Batch normalization
|
| 170 |
+
|
| 171 |
+
To further improve the propagation of training signal, we use deep residual networks [24, 25] with batch normalization [31] and weight normalization [2, 54] in $s$ and $t$ . As described in Appendix E we introduce and use a novel variant of batch normalization which is based on a running average over recent minibatches, and is thus more robust when training with very small minibatches.
|
| 172 |
+
|
| 173 |
+
We also apply batch normalization to the whole coupling layer output. The effects of batch normalization are easily included in the Jacobian computation, since it acts as a linear rescaling on each dimension. That is, given the estimated batch statistics $\tilde { \mu }$ and $\tilde { \sigma } ^ { 2 }$ , the rescaling function
|
| 174 |
+
|
| 175 |
+
$$
|
| 176 |
+
x \mapsto \frac { x - \tilde { \mu } } { \sqrt { \tilde { \sigma } ^ { 2 } + \epsilon } }
|
| 177 |
+
$$
|
| 178 |
+
|
| 179 |
+
has a Jacobian determinant
|
| 180 |
+
|
| 181 |
+
$$
|
| 182 |
+
\left( \prod _ { i } { ( \tilde { \sigma } _ { i } ^ { 2 } + \epsilon ) } \right) ^ { - \frac { 1 } { 2 } } .
|
| 183 |
+
$$
|
| 184 |
+
|
| 185 |
+
This form of batch normalization can be seen as similar to reward normalization in deep reinforcement learning [44, 65].
|
| 186 |
+
|
| 187 |
+
We found that the use of this technique not only allowed training with a deeper stack of coupling layers, but also alleviated the instability problem that practitioners often encounter when training conditional distributions with a scale parameter through a gradient-based approach.
|
| 188 |
+
|
| 189 |
+
# 4 Experiments
|
| 190 |
+
|
| 191 |
+
# 4.1 Procedure
|
| 192 |
+
|
| 193 |
+
The algorithm described in Equation 2 shows how to learn distributions on unbounded space. In general, the data of interest have bounded magnitude. For examples, the pixel values of an image typically lie in $[ 0 , 2 5 6 ] ^ { D }$ after application of the recommended jittering procedure [64, 62]. In order to reduce the impact of boundary effects, we instead model the density of $\textstyle \log \operatorname { i t } ( \alpha + ( 1 - \alpha ) \odot { \frac { x } { 2 5 6 } } )$ , where $\alpha$ is picked here as .05. We take into account this transformation when computing log-likelihood and bits per dimension. We also augment the CIFAR-10, CelebA and LSUN datasets during training to also include horizontal flips of the training examples.
|
| 194 |
+
|
| 195 |
+
We train our model on four natural image datasets: CIFAR-10 [36], Imagenet [52], Large-scale Scene Understanding (LSUN) [70], CelebFaces Attributes (CelebA) [41]. More specifically, we train on the downsampled to $3 2 \times 3 2$ and $6 4 \times 6 4$ versions of Imagenet [46]. For the LSUN dataset, we train on the bedroom, tower and church outdoor categories. The procedure for LSUN is the same as in [47]: we downsample the image so that the smallest side is 96 pixels and take random crops of $6 4 \times 6 4$ . For CelebA, we use the same procedure as in [38]: we take an approximately central crop of $1 4 8 \times 1 4 8$ then resize it to $6 4 \times 6 4$ .
|
| 196 |
+
|
| 197 |
+
We use the multi-scale architecture described in Section 3.6 and use deep convolutional residual networks in the coupling layers with rectifier nonlinearity and skip-connections as suggested by [46]. To compute the scaling functions $s$ , we use a hyperbolic tangent function multiplied by a learned scale, whereas the translation function $t$ has an affine output. Our multi-scale architecture is repeated recursively until the input of the last recursion is a $4 \times 4 \times c$ tensor. For datasets of images of size $3 2 \times 3 2$ , we use 4 residual blocks with 32 hidden feature maps for the first coupling layers with checkerboard masking. Only 2 residual blocks are used for images of size $6 4 \times 6 4$ . We use a batch size of 64. For CIFAR-10, we use 8 residual blocks, 64 feature maps, and downscale only once. We optimize with ADAM [33] with default hyperparameters and use an $L _ { 2 }$ regularization on the weight scale parameters with coefficient 5 · 10−5.
|
| 198 |
+
|
| 199 |
+
We set the prior $p _ { Z }$ to be an isotropic unit norm Gaussian. However, any distribution could be used for $p _ { Z }$ , including distributions that are also learned during training, such as from an auto-regressive model, or (with slight modifications to the training objective) a variational autoencoder.
|
| 200 |
+
|
| 201 |
+
Table 1: Bits/dim results for CIFAR-10, Imagenet, LSUN datasets and CelebA. Test results for CIFAR-10 and validation results for Imagenet, LSUN and CelebA (with training results in parenthesis for reference).
|
| 202 |
+
|
| 203 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>PixelRNN [46]</td><td rowspan=1 colspan=1>Real NVP</td><td rowspan=1 colspan=1>Conv DRAW[22]</td><td rowspan=1 colspan=1>IAF-VAE [34]</td></tr><tr><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>3.00</td><td rowspan=1 colspan=1>3.49</td><td rowspan=1 colspan=1><3.59</td><td rowspan=1 colspan=1><3.28</td></tr><tr><td rowspan=1 colspan=1>Imagenet (32 × 32)</td><td rowspan=1 colspan=1>3.86 (3.83)</td><td rowspan=1 colspan=1>4.28 (4.26)</td><td rowspan=1 colspan=1><4.40 (4.35)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Imagenet (64 × 64)</td><td rowspan=1 colspan=1>3.63 (3.57)</td><td rowspan=1 colspan=1>3.98 (3.75)</td><td rowspan=1 colspan=1>< 4.10 (4.04)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>LSUN (bedroom)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.72 (2.70)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>LSUN (tower)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.81 (2.78)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>LSUN (church outdoor)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.08 (2.94)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>CelebA</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.02 (2.97)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr></table>
|
| 204 |
+
|
| 205 |
+

|
| 206 |
+
Figure 5: On the left column, examples from the dataset. On the right column, samples from the model trained on the dataset. The datasets shown in this figure are in order: CIFAR-10, Imagenet $( 3 2 \times 3 2 )$ , Imagenet $( 6 4 \times 6 4 )$ ), CelebA, LSUN (bedroom).
|
| 207 |
+
|
| 208 |
+
# 4.2 Results
|
| 209 |
+
|
| 210 |
+
We show in Table 1 that the number of bits per dimension, while not improving over the Pixel RNN [46] baseline, is competitive with other generative methods. As we notice that our performance increases with the number of parameters, larger models are likely to further improve performance. For CelebA and LSUN, the bits per dimension for the validation set was decreasing throughout training, so little overfitting is expected.
|
| 211 |
+
|
| 212 |
+
We show in Figure 5 samples generated from the model with training examples from the dataset for comparison. As mentioned in [62, 22], maximum likelihood is a principle that values diversity over sample quality in a limited capacity setting. As a result, our model outputs sometimes highly improbable samples as we can notice especially on CelebA. As opposed to variational autoencoders, the samples generated from our model look not only globally coherent but also sharp. Our hypothesis is that as opposed to these models, real NVP does not rely on fixed form reconstruction cost like an $L _ { 2 }$ norm which tends to reward capturing low frequency components more heavily than high frequency components. Unlike autoregressive models, sampling from our model is done very efficiently as it is parallelized over input dimensions. On Imagenet and LSUN, our model seems to have captured well the notion of background/foreground and lighting interactions such as luminosity and consistent light source direction for reflectance and shadows.
|
| 213 |
+
|
| 214 |
+

|
| 215 |
+
Figure 6: Manifold generated from four examples in the dataset. Clockwise from top left: CelebA, Imagenet $( 6 4 \times 6 4 )$ , LSUN (tower), LSUN (bedroom).
|
| 216 |
+
|
| 217 |
+
We also illustrate the smooth semantically consistent meaning of our latent variables. In the latent space, we define a manifold based on four validation examples $z _ { ( 1 ) } , z _ { ( 2 ) } , z _ { ( 3 ) } , z _ { ( 4 ) } ,$ and parametrized by two parameters $\phi$ and $\phi ^ { \prime }$ by,
|
| 218 |
+
|
| 219 |
+
$$
|
| 220 |
+
z = \cos ( \phi ) \left( \cos ( \phi ^ { \prime } ) z _ { ( 1 ) } + \sin ( \phi ^ { \prime } ) z _ { ( 2 ) } \right) + \sin ( \phi ) \left( \cos ( \phi ^ { \prime } ) z _ { ( 3 ) } + \sin ( \phi ^ { \prime } ) z _ { ( 4 ) } \right) .
|
| 221 |
+
$$
|
| 222 |
+
|
| 223 |
+
We project the resulting manifold back into the data space by computing $g ( z )$ . Results are shown Figure 6. We observe that the model seems to have organized the latent space with a notion of meaning that goes well beyond pixel space interpolation. More manifold visualization are shown in the Appendix. To further test whether the latent space has a consistent semantic interpretation, we trained a class-conditional model on CelebA, and found that the learned representation had a consistent semantic meaning across class labels (see Appendix F).
|
| 224 |
+
|
| 225 |
+
# 5 Discussion and conclusion
|
| 226 |
+
|
| 227 |
+
In this paper, we have defined a class of invertible functions with tractable Jacobian determinant, enabling exact and tractable log-likelihood evaluation, inference, and sampling. We have shown that this class of generative model achieves competitive performances, both in terms of sample quality and log-likelihood. Many avenues exist to further improve the functional form of the transformations, for instance by exploiting the latest advances in dilated convolutions [69] and residual networks architectures [60].
|
| 228 |
+
|
| 229 |
+
This paper presented a technique bridging the gap between auto-regressive models, variational autoencoders, and generative adversarial networks. Like auto-regressive models, it allows tractable and exact log-likelihood evaluation for training. It allows however a much more flexible functional form, similar to that in the generative model of variational autoencoders. This allows for fast and exact sampling from the model distribution. Like GANs, and unlike variational autoencoders, our technique does not require the use of a fixed form reconstruction cost, and instead defines a cost in terms of higher level features, generating sharper images. Finally, unlike both variational autoencoders and GANs, our technique is able to learn a semantically meaningful latent space which is as high dimensional as the input space. This may make the algorithm particularly well suited to semi-supervised learning tasks, as we hope to explore in future work.
|
| 230 |
+
|
| 231 |
+
Real NVP generative models can additionally be conditioned on additional variables (for instance class labels) to create a structured output algorithm. More so, as the resulting class of invertible transformations can be treated as a probability distribution in a modular way, it can also be used to improve upon other probabilistic models like auto-regressive models and variational autoencoders. For variational autoencoders, these transformations could be used both to enable a more flexible reconstruction cost [38] and a more flexible stochastic inference distribution [48]. Probabilistic models in general can also benefit from batch normalization techniques as applied in this paper.
|
| 232 |
+
|
| 233 |
+
The definition of powerful and trainable invertible functions can also benefit domains other than generative unsupervised learning. For example, in reinforcement learning, these invertible functions can help extend the set of functions for which an argmax operation is tractable for continuous $Q$ - learning [23] or find representation where local linear Gaussian approximations are more appropriate [67].
|
| 234 |
+
|
| 235 |
+
# 6 Acknowledgments
|
| 236 |
+
|
| 237 |
+
The authors thank the developers of Tensorflow [1]. We thank Sherry Moore, David Andersen and Jon Shlens for their help in implementing the model. We thank Aäron van den Oord, Yann Dauphin, Kyle Kastner, Chelsea Finn, Maithra Raghu, David Warde-Farley, Daniel Jiwoong Im and Oriol Vinyals for fruitful discussions. Finally, we thank Ben Poole, Rafal Jozefowicz and George Dahl for their input on a draft of the paper.
|
| 238 |
+
|
| 239 |
+
# References
|
| 240 |
+
|
| 241 |
+
[1] Martın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv preprint arXiv:1603.04467, 2016. [2] Vijay Badrinarayanan, Bamdev Mishra, and Roberto Cipolla. Understanding symmetries in deep networks. arXiv preprint arXiv:1511.01029, 2015. [3] Johannes Ballé, Valero Laparra, and Eero P Simoncelli. Density modeling of images using a generalized normalization transformation. arXiv preprint arXiv:1511.06281, 2015. [4] Anthony J Bell and Terrence J Sejnowski. An information-maximization approach to blind separation and blind deconvolution. Neural computation, 7(6):1129–1159, 1995.
|
| 242 |
+
[5] Yoshua Bengio. Artificial neural networks and their application to sequence recognition. 1991.
|
| 243 |
+
[6] Yoshua Bengio and Samy Bengio. Modeling high-dimensional discrete data with multi-layer neural networks. In NIPS, volume 99, pages 400–406, 1999. [7] Mathias Berglund and Tapani Raiko. Stochastic gradient estimate variance in contrastive divergence and persistent contrastive divergence. arXiv preprint arXiv:1312.6002, 2013.
|
| 244 |
+
[8] Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. arXiv preprint arXiv:1511.06349, 2015. [9] Joan Bruna, Pablo Sprechmann, and Yann LeCun. Super-resolution with deep convolutional sufficient statistics. arXiv preprint arXiv:1511.05666, 2015.
|
| 245 |
+
[10] Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015.
|
| 246 |
+
[11] Scott Shaobing Chen and Ramesh A Gopinath. Gaussianization. In Advances in Neural Information Processing Systems, 2000.
|
| 247 |
+
[12] Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pages 2962–2970, 2015.
|
| 248 |
+
[13] Peter Dayan, Geoffrey E Hinton, Radford M Neal, and Richard S Zemel. The helmholtz machine. Neural computation, 7(5):889–904, 1995.
|
| 249 |
+
[14] Gustavo Deco and Wilfried Brauer. Higher order statistical decorrelation without information loss. In G. Tesauro, D. S. Touretzky, and T. K. Leen, editors, Advances in Neural Information Processing Systems 7, pages 247–254. MIT Press, 1995.
|
| 250 |
+
[15] Emily L. Denton, Soumith Chintala, Arthur Szlam, and Rob Fergus. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in Neural Information Processing Systems 28: Quebec, Canada, pages 1486–1494, 2015.
|
| 251 |
+
[16] Luc Devroye. Sample-based non-uniform random variate generation. In Proceedings of the 18th conference on Winter simulation, pages 260–265. ACM, 1986.
|
| 252 |
+
[17] Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
|
| 253 |
+
[18] Brendan J Frey. Graphical models for machine learning and digital communication. MIT press, 1998.
|
| 254 |
+
[19] Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. Texture synthesis using convolutional neural networks. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 262–270, 2015.
|
| 255 |
+
[20] Mathieu Germain, Karol Gregor, Iain Murray, and Hugo Larochelle. MADE: masked autoencoder for distribution estimation. CoRR, abs/1502.03509, 2015.
|
| 256 |
+
[21] 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 Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pages 2672–2680, 2014.
|
| 257 |
+
[22] Karol Gregor, Frederic Besse, Danilo Jimenez Rezende, Ivo Danihelka, and Daan Wierstra. Towards conceptual compression. arXiv preprint arXiv:1604.08772, 2016.
|
| 258 |
+
[23] Shixiang Gu, Timothy Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep q-learning with model-based acceleration. arXiv preprint arXiv:1603.00748, 2016.
|
| 259 |
+
[24] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015.
|
| 260 |
+
[25] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. CoRR, abs/1603.05027, 2016.
|
| 261 |
+
[26] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computation, 9(8):1735–1780, 1997.
|
| 262 |
+
[27] Matthew D Hoffman, David M Blei, Chong Wang, and John Paisley. Stochastic variational inference. The Journal of Machine Learning Research, 14(1):1303–1347, 2013.
|
| 263 |
+
[28] Aapo Hyvärinen, Juha Karhunen, and Erkki Oja. Independent component analysis, volume 46. John Wiley & Sons, 2004.
|
| 264 |
+
[29] Aapo Hyvärinen and Petteri Pajunen. Nonlinear independent component analysis: Existence and uniqueness results. Neural Networks, 12(3):429–439, 1999.
|
| 265 |
+
[30] Daniel Jiwoong Im, Chris Dongjoo Kim, Hui Jiang, and Roland Memisevic. Generating images with recurrent adversarial networks. arXiv preprint arXiv:1602.05110, 2016.
|
| 266 |
+
[31] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
|
| 267 |
+
[32] Rafal Józefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. CoRR, abs/1602.02410, 2016.
|
| 268 |
+
[33] Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 269 |
+
[34] Diederik P Kingma, Tim Salimans, and Max Welling. Improving variational inference with inverse autoregressive flow. arXiv preprint arXiv:1606.04934, 2016.
|
| 270 |
+
[35] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 271 |
+
[36] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images, 2009.
|
| 272 |
+
[37] Hugo Larochelle and Iain Murray. The neural autoregressive distribution estimator. In AISTATS, 2011.
|
| 273 |
+
[38] Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. CoRR, abs/1512.09300, 2015.
|
| 274 |
+
[39] Yann A LeCun, Léon Bottou, Genevieve B Orr, and Klaus-Robert Müller. Efficient backprop. In Neural networks: Tricks of the trade, pages 9–48. Springer, 2012.
|
| 275 |
+
[40] Chen-Yu Lee, Saining Xie, Patrick Gallagher, Zhengyou Zhang, and Zhuowen Tu. Deeply-supervised nets. arXiv preprint arXiv:1409.5185, 2014.
|
| 276 |
+
[41] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015.
|
| 277 |
+
[42] Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
|
| 278 |
+
[43] Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. arXiv preprint arXiv:1402.0030, 2014.
|
| 279 |
+
[44] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
|
| 280 |
+
[45] Radford M Neal and Geoffrey E Hinton. A view of the em algorithm that justifies incremental, sparse, and other variants. In Learning in graphical models, pages 355–368. Springer, 1998.
|
| 281 |
+
[46] Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016.
|
| 282 |
+
[47] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR, abs/1511.06434, 2015.
|
| 283 |
+
[48] Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. arXiv preprint arXiv:1505.05770, 2015.
|
| 284 |
+
[49] Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
|
| 285 |
+
[50] Oren Rippel and Ryan Prescott Adams. High-dimensional probability estimation with deep density models. arXiv preprint arXiv:1302.5125, 2013.
|
| 286 |
+
[51] David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning representations by backpropagating errors. Cognitive modeling, 5(3):1, 1988.
|
| 287 |
+
[52] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
|
| 288 |
+
[53] Ruslan Salakhutdinov and Geoffrey E Hinton. Deep boltzmann machines. In International conference on artificial intelligence and statistics, pages 448–455, 2009.
|
| 289 |
+
[54] Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. arXiv preprint arXiv:1602.07868, 2016.
|
| 290 |
+
[55] Tim Salimans, Diederik P Kingma, and Max Welling. Markov chain monte carlo and variational inference: Bridging the gap. arXiv preprint arXiv:1410.6460, 2014.
|
| 291 |
+
[56] Lawrence K Saul, Tommi Jaakkola, and Michael I Jordan. Mean field theory for sigmoid belief networks. Journal of artificial intelligence research, 4(1):61–76, 1996.
|
| 292 |
+
[57] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 293 |
+
[58] Paul Smolensky. Information processing in dynamical systems: Foundations of harmony theory. Technical report, DTIC Document, 1986.
|
| 294 |
+
[59] Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proceedings of the 32nd International Conference on Machine Learning, ICML 2015, Lille, France, 6-11 July 2015, pages 2256–2265, 2015.
|
| 295 |
+
[60] Sasha Targ, Diogo Almeida, and Kevin Lyman. Resnet in resnet: Generalizing residual architectures. CoRR, abs/1603.08029, 2016.
|
| 296 |
+
[61] Lucas Theis and Matthias Bethge. Generative image modeling using spatial lstms. In Advances in Neural Information Processing Systems, pages 1918–1926, 2015.
|
| 297 |
+
[62] Lucas Theis, Aäron Van Den Oord, and Matthias Bethge. A note on the evaluation of generative models. CoRR, abs/1511.01844, 2015.
|
| 298 |
+
[63] Dustin Tran, Rajesh Ranganath, and David M Blei. Variational gaussian process. arXiv preprint arXiv:1511.06499, 2015.
|
| 299 |
+
[64] Benigno Uria, Iain Murray, and Hugo Larochelle. Rnade: The real-valued neural autoregressive densityestimator. In Advances in Neural Information Processing Systems, pages 2175–2183, 2013.
|
| 300 |
+
[65] Hado van Hasselt, Arthur Guez, Matteo Hessel, and David Silver. Learning functions across many orders of magnitudes. arXiv preprint arXiv:1602.07714, 2016.
|
| 301 |
+
[66] Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: Sequence to sequence for sets. arXiv preprint arXiv:1511.06391, 2015.
|
| 302 |
+
[67] Manuel Watter, Jost Springenberg, Joschka Boedecker, and Martin Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In Advances in Neural Information Processing Systems, pages 2728–2736, 2015.
|
| 303 |
+
[68] Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 304 |
+
[69] Fisher Yu and Vladlen Koltun. Multi-scale context aggregation by dilated convolutions. arXiv preprint arXiv:1511.07122, 2015.
|
| 305 |
+
[70] Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
|
| 306 |
+
[71] Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. arXiv preprint arXiv:1603.08511, 2016.
|
| 307 |
+
|
| 308 |
+
# A Samples
|
| 309 |
+
|
| 310 |
+

|
| 311 |
+
Figure 7: Samples from a model trained on Imagenet $( 6 4 \times 6 4 )$ .
|
| 312 |
+
|
| 313 |
+

|
| 314 |
+
Figure 8: Samples from a model trained on CelebA.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure 9: Samples from a model trained on LSUN (bedroom category).
|
| 318 |
+
|
| 319 |
+

|
| 320 |
+
Figure 10: Samples from a model trained on LSUN (church outdoor category).
|
| 321 |
+
|
| 322 |
+

|
| 323 |
+
Figure 11: Samples from a model trained on LSUN (tower category).
|
| 324 |
+
|
| 325 |
+
# B Manifold
|
| 326 |
+
|
| 327 |
+

|
| 328 |
+
Figure 12: Manifold from a model trained on Imagenet $( 6 4 \times 6 4 )$ . Images with red borders are taken from the validation set, and define the manifold. The manifold was computed as described in Equation 19, where the $\mathbf { X }$ -axis corresponds to $\phi$ , and the y-axis to $\phi ^ { \prime }$ , and where $\phi , \phi ^ { \prime } \in \{ 0 , \frac { \pi } { 4 } , \cdot \cdot \cdot , \frac { 7 \pi } { 4 } \}$ .
|
| 329 |
+
|
| 330 |
+

|
| 331 |
+
Figure 13: Manifold from a model trained on CelebA. Images with red borders are taken from the training set, and define the manifold. The manifold was computed as described in Equation 19, where the $\mathbf { X } ^ { } -$ -axis corresponds to $\phi$ , and the y-axis to $\phi ^ { \prime }$ , and where $\phi , \phi ^ { \prime } \in \{ 0 , \frac { \pi } { 4 } , \cdot \cdot \cdot , \frac { 7 \pi } { 4 } \bar \}$ , 7 π4 }.
|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Figure 14: Manifold from a model trained on LSUN (bedroom category). Images with red borders are taken from the validation set, and define the manifold. The manifold was computed as described in Equation 19, where the $\mathbf { X }$ -axis corresponds to $\phi$ , and the y-axis to $\phi ^ { \prime }$ , and where $\phi , \phi ^ { \prime } \in \{ 0 , \frac { \pi } { 4 } , \therefore \frac { 7 \pi } { 4 } \}$ , 7 π4 }.
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
Figure 15: Manifold from a model trained on LSUN (church outdoor category). Images with red borders are taken from the validation set, and define the manifold. The manifold was computed as described in Equation 19, where the $\mathbf { X }$ -axis corresponds to $\phi$ , and the y-axis to $\phi ^ { \prime }$ , and where $\phi , \phi ^ { \prime } \in \{ 0 , \frac { \pi } { 4 } , \cdot \cdot \cdot , \frac { 7 \pi } { 4 } \}$ .
|
| 338 |
+
|
| 339 |
+

|
| 340 |
+
Figure 16: Manifold from a model trained on LSUN (tower category). Images with red borders are taken from the validation set, and define the manifold. The manifold was computed as described in Equation 19, where the $\mathbf { X }$ -axis corresponds to $\phi$ , and the y-axis to $\phi ^ { \prime }$ , and where $\phi , \phi ^ { \prime } \in \{ 0 , \frac { \pi } { 4 } , \cdot \cdot \cdot , \frac { 7 \pi } { 4 } \}$ .
|
| 341 |
+
|
| 342 |
+
# C Extrapolation
|
| 343 |
+
|
| 344 |
+
Inspired by the texture generation work by [19, 61] and extrapolation test with DCGAN [47], we also evaluate the statistics captured by our model by generating images twice or ten times as large as present in the dataset. As we can observe in the following figures, our model seems to successfully create a “texture” representation of the dataset while maintaining a spatial smoothness through the image. Our convolutional architecture is only aware of the position of considered pixel through edge effects in convolutions, therefore our model is similar to a stationary process. This also explains why these samples are more consistent in LSUN, where the training data was obtained using random crops.
|
| 345 |
+
|
| 346 |
+

|
| 347 |
+
Figure 17: We generate samples a factor bigger than the training set image size on Imagenet $( 6 4 \times 6 4 )$ .
|
| 348 |
+
|
| 349 |
+

|
| 350 |
+
Figure 18: We generate samples a factor bigger than the training set image size on CelebA.
|
| 351 |
+
|
| 352 |
+

|
| 353 |
+
Figure 19: We generate samples a factor bigger than the training set image size on LSUN (bedroom category).
|
| 354 |
+
|
| 355 |
+

|
| 356 |
+
Figure 20: We generate samples a factor bigger than the training set image size on LSUN (church outdoor category).
|
| 357 |
+
|
| 358 |
+

|
| 359 |
+
Figure 21: We generate samples a factor bigger than the training set image size on LSUN (tower category).
|
| 360 |
+
|
| 361 |
+
# D Latent variables semantic
|
| 362 |
+
|
| 363 |
+
As in [22], we further try to grasp the semantic of our learned layers latent variables by doing ablation tests. We infer the latent variables and resample the lowest levels of latent variables from a standard gaussian, increasing the highest level affected by this resampling. As we can see in the following figures, the semantic of our latent space seems to be more on a graphic level rather than higher level concept. Although the heavy use of convolution improves learning by exploiting image prior knowledge, it is also likely to be responsible for this limitation.
|
| 364 |
+
|
| 365 |
+

|
| 366 |
+
Figure 22: Conceptual compression from a model trained on Imagenet $( 6 4 \times 6 4 )$ . The leftmost column represent the original image, the subsequent columns were obtained by storing higher level latent variables and resampling the others, storing less and less as we go right. From left to right: $1 0 0 \%$ , $5 0 \%$ , $2 5 \%$ , $1 2 . 5 \%$ and $6 . 2 5 \%$ of the latent variables are kept.
|
| 367 |
+
|
| 368 |
+

|
| 369 |
+
Figure 23: Conceptual compression from a model trained on CelebA. The leftmost column represent the original image, the subsequent columns were obtained by storing higher level latent variables and resampling the others, storing less and less as we go right. From left to right: $1 0 0 \%$ , $5 0 \%$ , $2 5 \%$ , $1 2 . 5 \%$ and $6 . 2 \hat { 5 } \%$ of the latent variables are kept.
|
| 370 |
+
|
| 371 |
+

|
| 372 |
+
Figure 24: Conceptual compression from a model trained on LSUN (bedroom category). The leftmost column represent the original image, the subsequent columns were obtained by storing higher level latent variables and resampling the others, storing less and less as we go right. From left to right: $1 0 0 \%$ , $5 0 \%$ , $2 5 \%$ , $1 2 . 5 \%$ and $6 . 2 5 \%$ of the latent variables are kept.
|
| 373 |
+
|
| 374 |
+

|
| 375 |
+
Figure 25: Conceptual compression from a model trained on LSUN (church outdoor category). The leftmost column represent the original image, the subsequent columns were obtained by storing higher level latent variables and resampling the others, storing less and less as we go right. From left to right: $1 0 0 \%$ , $5 0 \%$ , $2 5 \%$ , $1 2 . 5 \%$ and $6 . 2 5 \%$ of the latent variables are kept.
|
| 376 |
+
|
| 377 |
+

|
| 378 |
+
Figure 26: Conceptual compression from a model trained on LSUN (tower category). The leftmost column represent the original image, the subsequent columns were obtained by storing higher level latent variables and resampling the others, storing less and less as we go right. From left to right: $1 0 0 \%$ , $5 0 \%$ , $2 5 \%$ , $1 2 . 5 \%$ and $6 . 2 5 \%$ of the latent variables are kept.
|
| 379 |
+
|
| 380 |
+
# E Batch normalization
|
| 381 |
+
|
| 382 |
+
We further experimented with batch normalization by using a weighted average of a moving average of the layer statistics $\tilde { \mu } _ { t } , \tilde { \tilde { \sigma } } _ { t } ^ { 2 }$ and the current batch batch statistics $\hat { \mu } _ { t } , \bar { \hat { \sigma } } _ { t } ^ { 2 }$ ,
|
| 383 |
+
|
| 384 |
+
$$
|
| 385 |
+
\begin{array} { r l } & { \tilde { \mu } _ { t + 1 } = \rho \tilde { \mu } _ { t } + ( 1 - \rho ) \hat { \mu } _ { t } } \\ & { \tilde { \sigma } _ { t + 1 } ^ { 2 } = \rho \tilde { \sigma } _ { t } ^ { 2 } + ( 1 - \rho ) \hat { \sigma } _ { t } ^ { 2 } , } \end{array}
|
| 386 |
+
$$
|
| 387 |
+
|
| 388 |
+
where $\rho$ is the momentum. When using $\tilde { \mu } _ { t + 1 } , \tilde { \sigma } _ { t + 1 } ^ { 2 }$ , we only propagate gradient through the current batch statistics $\hat { \mu } _ { t } , \hat { \sigma } _ { t } ^ { 2 }$ . We observe that using this lag helps the model train with very small minibatches.
|
| 389 |
+
|
| 390 |
+
We used batch normalization with a moving average for our results on CIFAR-10.
|
| 391 |
+
|
| 392 |
+
# F Attribute change
|
| 393 |
+
|
| 394 |
+
Additionally, we exploit the attribute information $y$ in CelebA to build a conditional model, i.e. the invertible function $f$ from image to latent variable uses the labels in $_ y$ to define its parameters. In order to observe the information stored in the latent variables, we choose to encode a batch of images $_ x$ with their original attribute $y$ and decode them using a new set of attributes $y ^ { \prime }$ , build by shuffling the original attributes inside the batch. We obtain the new images $x ^ { \prime } = g \bigl ( f ( x ; y ) ; y ^ { \prime } )$ .
|
| 395 |
+
|
| 396 |
+
We observe that, although the faces are changed as to respect the new attributes, several properties remain unchanged like position and background.
|
| 397 |
+
|
| 398 |
+

|
| 399 |
+
Figure 27: Examples $x$ from the CelebA dataset.
|
| 400 |
+
|
| 401 |
+

|
| 402 |
+
Figure 28: From a model trained on pairs of images and attributes from the CelebA dataset, we encode a batch of images with their original attributes before decoding them with a new set of attributes. We notice that the new images often share similar characteristics with those in Fig 27, including position and background.
|
md/train/HkxJpnVtPr/HkxJpnVtPr.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/Hyg96gBKPS/Hyg96gBKPS.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MONOTONIC MULTIHEAD ATTENTION
|
| 2 |
+
|
| 3 |
+
Xutai $\mathbf { M } \mathbf { a } ^ { 2 }$ ∗, Juan Pino1, James Cross1, Liezl Puzon1, Jiatao $\mathbf { G u } ^ { 1 }$
|
| 4 |
+
|
| 5 |
+
1Facebook
|
| 6 |
+
2Johns Hopkins University
|
| 7 |
+
|
| 8 |
+
xutai ma@jhu.edu, puzon@cs.stanford.edu {juancarabina,jcross,jgu}@fb.com
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Simultaneous machine translation models start generating a target sequence before they have encoded the source sequence. Recent approaches for this task either apply a fixed policy on a state-of-the art Transformer model, or a learnable monotonic attention on a weaker recurrent neural network-based structure. In this paper, we propose a new attention mechanism, Monotonic Multihead Attention (MMA), which extends the monotonic attention mechanism to multihead attention. We also introduce two novel and interpretable approaches for latency control that are specifically designed for multiple attention heads. We apply MMA to the simultaneous machine translation task and demonstrate better latency-quality tradeoffs compared to MILk, the previous state-of-the-art approach. We analyze how the latency controls affect the attention span and we study the relationship between the speed of a head and the layer it belongs to. Finally, we motivate the introduction of our model by analyzing the effect of the number of decoder layers and heads on quality and latency.1
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Simultaneous machine translation adds the capability of a live interpreter to machine translation: a simultaneous model starts generating a translation before it has finished reading the entire source sentence. Such models are useful in any situation where translation needs to be done in real time. For example, simultaneous models can translate live video captions or facilitate conversations between people speaking different languages. In a usual translation model, the encoder first reads the entire sentence, then the decoder writes the target sentence. On the other hand, a simultaneous neural machine translation model alternates between reading the input and writing the output using either a fixed or learned policy.
|
| 17 |
+
|
| 18 |
+
Monotonic attention mechanisms fall into the flexible policy category, in which the policies are automatically learned from data. Recent work exploring monotonic attention variants for simultaneous translation include: hard monotonic attention (Raffel et al., 2017), monotonic chunkwise attention (MoChA) (Chiu & Raffel, 2018) and monotonic infinite lookback attention (MILk) (Arivazhagan et al., 2019). MILk in particular has shown better quality/latency trade-offs than fixed policy approaches, such as wait- $k$ (Ma et al., 2019) or wait-if-\* (Cho & Esipova, 2016) policies. MILk also outperforms hard monotonic attention and MoChA; while the other two monotonic attention mechanisms only consider a fixed window, MILk computes a softmax attention over all previous encoder states, which may be the key to its improved latency-quality tradeoffs. These monotonic attention approaches also provide a closed-form expression for the expected alignment between source and target tokens.
|
| 19 |
+
|
| 20 |
+
However, monotonic attention-based models, including the state-of-the-art MILk, were built on top of RNN-based models. RNN-based models have been outperformed by the recent state-of-the-art Transformer model (Vaswani et al., 2017), which features multiple encoder-decoder attention layers and multihead attention at each layer.
|
| 21 |
+
|
| 22 |
+
We thus propose monotonic multihead attention (MMA), which combines the high translation quality from multilayer multihead attention and low latency from monotonic attention. We propose two variants, Hard MMA (MMA-H) and Infinite Lookback MMA (MMA-IL). MMA-H is designed with streaming systems in mind where the attention span must be limited. MMA-IL emphasizes the quality of the translation system. We also propose two novel latency regularization methods. The first encourages the model to be faster by directly minimizing the average latency. The second encourages the attention heads to maintain similar positions, preventing the latency from being dominated by a single or a few heads.
|
| 23 |
+
|
| 24 |
+
The main contributions of this paper are: (1) A novel monotonic attention mechanism, monotonic multihead attention, which enables the Transformer model to perform online decoding. This model leverages the power of the Transformer and the efficiency of monotonic attention. (2) Better latency/quality tradeoffs compared to the MILk model, the previous state-of-the-art, on two standard translation benchmarks, IWSLT15 English-Vietnamese (En-Vi) and WMT15 German-English (DeEn). (3) Analyses on how our model is able to control the attention span and on the relationship between the speed of a head and the layer it belongs to. We motivate the design of our model with an ablation study on the number of decoder layers and the number of decoder heads.
|
| 25 |
+
|
| 26 |
+
# 2 MONOTONIC MULTIHEAD ATTENTION MODEL
|
| 27 |
+
|
| 28 |
+
In this section, we review the monotonic attention-based approaches in RNN-based encoder-decoder models. We then introduce the two types of Monotonic Multihead Attention (MMA) for Transformer models: MMA-H and MMA-IL. Finally, we introduce strategies to control latency and coverage.
|
| 29 |
+
|
| 30 |
+
# 2.1 MONOTONIC ATTENTION
|
| 31 |
+
|
| 32 |
+
The hard monotonic attention mechanism (Raffel et al., 2017) was first introduced in order to achieve online linear time decoding for RNN-based encoder-decoder models. We denote the input sequence as $\mathbf { x } = \{ x _ { 1 } , . . . , x _ { T } \}$ , and the corresponding encoder states as $\mathbf { m } = \{ m _ { 1 } , . . . , m _ { T } \}$ , with $T$ being the length of the source sequence. The model generates a target sequence $\mathbf { y } = \{ y _ { 1 } , . . . , y _ { U } \}$ with $U$ being the length of the target sequence. At the $i$ -th decoding step, the decoder only attends to one encoder state $m _ { t _ { i } }$ with $t _ { i } = j$ . When generating a new target token $y _ { i }$ , the decoder chooses whether to move one step forward or to stay at the current position based on a Bernoulli selection probability $p _ { i , j }$ , so that $t _ { i } \ \geq \ t _ { i - 1 }$ . Denoting the decoder state at the $i$ -th position, starting from $j = t _ { i - 1 } , t _ { i - 1 } + 1 , t _ { i - 1 } + 2 , . . . _ $ , this process can be calculated as follows: 2
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
\begin{array} { l c l } { e _ { i , j } } & { = } & { \mathrm { M o n o t o n i c E n e r g y } ( s _ { i - 1 } , m _ { j } ) } \\ { p _ { i , j } } & { = } & { \mathrm { S i g m o i d } \left( e _ { i , j } \right) } \\ { z _ { i , j } } & { \sim } & { \mathrm { B e r n o u l l i } ( p _ { i , j } ) } \end{array}
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
When $z _ { i , j } = 1$ , we set $t _ { i } = j$ and start generating a target token $y _ { i }$ ; otherwise, we set $t _ { i } = j + 1$ and repeat the process. During training, an expected alignment $_ { \pmb { \alpha } }$ is introduced to replace the softmax attention. It can be calculated in a recurrent manner, shown in Equation 4:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\begin{array} { l } { \displaystyle \alpha _ { i , j } = p _ { i , j } \sum _ { k = 1 } ^ { j } \left( \alpha _ { i - 1 , k } \prod _ { l = k } ^ { j - 1 } \left( 1 - p _ { i , l } \right) \right) } \\ { \displaystyle = p _ { i , j } \left( \left( 1 - p _ { i , j - 1 } \right) \frac { \alpha _ { i , j - 1 } } { p _ { i , j - 1 } } + \alpha _ { i - 1 , j } \right) } \end{array}
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
Raffel et al. (2017) also introduce a closed-form parallel solution for the recurrence relation in Equation 5:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\alpha _ { i , : } = p _ { i , : } \mathrm { c u m p r o d } ( 1 - p _ { i , : } ) \mathrm { c u m s u m } \left( \frac { \alpha _ { i - 1 , : } } { \mathrm { c u m p r o d } ( 1 - p _ { i , : } ) } \right)
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
where $\begin{array} { r } { \mathtt { c u m p r o d } ( x ) = [ 1 , x _ { 1 } , x _ { 1 } x _ { 2 } , . . . , \prod _ { i = 1 } ^ { | x | - 1 } x _ { i } ] } \end{array}$ and $\mathsf { c u m s u m } ( { \pmb x } ) = [ x _ { 1 } , x _ { 1 } + x _ { 2 } , . . . , \sum _ { i = 1 } ^ { | { \pmb x } | } x _ { i } ]$ In practice, the denominator in Equation 5 is clamped into a range of [, 1] to avoid numerical instabilities introduced by cumprod. Although this monotonic attention mechanism achieves online linear time decoding, the decoder can only attend to one encoder state. This limitation can diminish translation quality as there may be insufficient information for reordering.
|
| 51 |
+
|
| 52 |
+
Moreover, the model lacks a mechanism to adjust latency based on different requirements at decoding time. To address these issues, Chiu & Raffel (2018) introduce Monotonic Chunkwise Attention (MoChA), which allows the decoder to apply softmax attention to a fixed-length subsequence of encoder states. Alternatively, Arivazhagan et al. (2019) introduce Monotonic Infinite Lookback Attention (MILk) which allows the decoder to access encoder states from the beginning of the source sequence. The expected attention for the MILk model is defined in Equation 6.
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\beta _ { i , j } = \sum _ { k = j } ^ { | x | } \left( \frac { \alpha _ { i , k } \exp ( u _ { i , j } ) } { \sum _ { l = 1 } ^ { k } \exp ( u _ { i , l } ) } \right)
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
# 2.2 MONOTONIC MULTIHEAD ATTENTION
|
| 59 |
+
|
| 60 |
+
Previous monotonic attention approaches are based on RNN encoder-decoder models with a single attention and haven’t explored the power of the Transformer model. 3 The Transformer architecture (Vaswani et al., 2017) has recently become the state-of-the-art for machine translation (Barrault et al., 2019). An important feature of the Transformer is the use of a separate multihead attention module at each layer. Thus, we propose a new approach, Monotonic Multihead Attention (MMA), which combines the expressive power of multihead attention and the low latency of monotonic attention.
|
| 61 |
+
|
| 62 |
+
Multihead attention allows each decoder layer to have multiple heads, where each head can compute a different attention distribution. Given queries $Q$ , keys $K$ and values $V$ , multihead attention MultiHead $( Q , K , V )$ is defined in Equation 7.
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\begin{array} { r } { \begin{array} { l } { \mathrm { M u l t i H e a d } ( Q , K , V ) = \mathrm { C o n c a t } ( \mathrm { h e a d } _ { 1 } , . . . , \mathrm { h e a d } _ { H } ) W ^ { O } } \\ { \mathrm { w h e r e ~ h e a d } _ { h } = \mathrm { A t t e n t i o n } \left( Q W _ { h } ^ { Q } , K W _ { h } ^ { K } , V W _ { h } ^ { V } , \right) } \end{array} } \end{array}
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
The attention function is the scaled dot-product attention, defined in Equation 8:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
{ \mathrm { A t t e n t i o n } } ( Q , K , V ) = { \mathrm { S o f t m a x } } \left( { \frac { Q K ^ { T } } { \sqrt { d _ { k } } } } \right) V
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
There are three applications of multihead attention in the Transformer model:
|
| 75 |
+
|
| 76 |
+
1. The Encoder contains self-attention layers where all of the queries, keys and values come from previous layers.
|
| 77 |
+
2. The Decoder contains self-attention layers that allow each position in the decoder to attend to all positions in the decoder up to and including that position.
|
| 78 |
+
3. The Encoder-Decoder attention contains multihead attention layers where queries come from the previous decoder layer and the keys and values come from the output of the encoder. Every decoder layer has a separate encoder-decoder attention.
|
| 79 |
+
|
| 80 |
+
For MMA, we assign each head to operate as a separate monotonic attention in encoder-decoder attention.
|
| 81 |
+
|
| 82 |
+
For a transformer with $L$ decoder layers and $H$ attention heads per layer, we define the selection process of the $h$ -th head encoder-decoder attention in the $l$ -th decoder layer as
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\begin{array} { l c l } { e _ { i , j } ^ { { l , h } } } & { = } & { \left( \frac { m _ { j } W _ { { l , h } } ^ { K } ( s _ { i - 1 } W _ { { l , h } } ^ { Q } ) ^ { T } } { \sqrt { d _ { k } } } \right) _ { i , j } } \\ { p _ { i , j } ^ { { l , h } } } & { = } & { \mathrm { S i g m o i d } ( e _ { i , j } ) } \\ { z _ { i , j } ^ { { l , h } } } & { \sim } & { \mathrm { B e r n o u l l i } ( p _ { i , j } ) } \end{array}
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+

|
| 89 |
+
Figure 1: Monotonic Attention (Left) versus Monotonic Multihead Attention (Right).
|
| 90 |
+
|
| 91 |
+
where $W _ { l , h }$ is the input projection matrix, $d _ { k }$ is the dimension of the attention head. We make the selection process independent for each head in each layer. We then investigate two types of MMA, MMA-H(ard) and MMA-IL(infinite lookback). For MMA-H, we use Equation 4 in order to calculate the expected alignment for each layer each head, given $p _ { i , j } ^ { l , h }$ . For MMA-IL, we calculate the softmax energy for each head as follows:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
u _ { i , j } ^ { l , h } = \mathrm { S o f t E n e r g y } = \left( \frac { m _ { j } \hat { W } _ { l , h } ^ { K } ( s _ { i - 1 } \hat { W } _ { l , h } ^ { Q } ) ^ { T } } { \sqrt { d _ { k } } } \right) _ { i , j }
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
and then use Equation 6 to calculate the expected attention. Each attention head in MMA-H hardattends to one encoder state. On the other hand, each attention head in MMA-IL can attend to all previous encoder states. Thus, MMA-IL allows the model to leverage more information for translation, but MMA-H may be better suited for streaming systems with stricter efficiency requirements. Finally, our models use unidirectional encoders: the encoder self-attention can only attend to previous states, which is also required for simultaneous translation.
|
| 98 |
+
|
| 99 |
+
At inference time, our decoding strategy is shown in Algorithm 1. For each $l , h$ , at decoding step $i$ , we apply the sampling processes discussed in subsection 2.1 individually and set the encoder step at $t _ { i } ^ { l , \bar { h } }$ . Then a hard alignment or partial softmax attention from encoder states, shown in Equation 13, will be retrieved to feed into the decoder to generate the $i$ -th token. The model will write a new target token only after all the attentions have decided to write. In other words, the heads that have decided to write must wait until the others have finished reading.
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\begin{array}{c} \begin{array} { r l } & { \qquad c _ { i } ^ { l } = \mathrm { C o n c a t } ( c _ { i } ^ { l , 1 } , c _ { i } ^ { l , 2 } , . . . , c _ { i } ^ { l , H } ) } \\ & { \qquad \mathrm \quad \mathbf { \ " } } \\ & { \qquad \mathbf { \ " } \mathbf { \ " } e _ { i } ^ { l , h } = f _ { \mathrm { c o n t e x t } } ( \boldsymbol { h } , t _ { i } ^ { l , h } ) = \displaystyle \left\{ \sum _ { j = 1 } ^ { m _ { t _ { i } ^ { l , h } } } \frac { \mathrm { e x p } \left( u _ { i , j } ^ { l , h } \right) } { \sum _ { j = 1 } ^ { t _ { i } ^ { l , h } } \mathrm { e x p } \left( u _ { i , j } ^ { l , h } \right) } m _ { j } \quad \mathrm { M M A \mathrm { - } I L } \right.} \end{array} \end{array}
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Figure 1 illustrates a comparison between our model and the monotonic model with one attention head. Compared with the monotonic model, the MMA model is able to set attention to different positions so that it can still attend to previous states while reading each new token. Each head can adjust its speed on-the-fly. Some heads read new inputs, while the others can stay in the past to retain the source history information. Even with the hard alignment variant (MMA-H), the model is still able to preserve the history information by setting heads to past states. In contrast, the hard monotonic model, which only has one head, loses the previous information at the attention layer.
|
| 106 |
+
|
| 107 |
+
# 2.3 LATENCY CONTROL
|
| 108 |
+
|
| 109 |
+
Effective simultaneous machine translation must balance quality and latency. At a high level, latency measures how many source tokens the model has read until a translation is generated. The model we have introduced in subsection 2.2 is not able to control latency on its own. While MMA allows simultaneous translation by having a read or write schedule for each head, the overall latency is determined by the fastest head, i.e. the head that reads the most. It is possible that a head always reads new input without producing output, which would result in the maximum possible latency. Note that the attention behaviors in MMA-H and MMA-IL can be different. In MMA-IL, a head reaching the end of the sentence will provide the model with maximum information about the source sentence. On the other hand, in the case of MMA-H, reaching the end of sentence for a head only
|
| 110 |
+
|
| 111 |
+
Algorithm 1 MMA monotonic decoding. Because each head is independent, we compute line 3 to 16 in parallel
|
| 112 |
+
|
| 113 |
+
Input: ${ \bf { \delta } } _ { \bf { \mathcal { X } } } =$ source tokens, $h =$ encoder states, $i = 1 , j = 1 , t _ { 0 } ^ { l , h } = 1 , y _ { 0 } =$ StartOfSequence.
|
| 114 |
+
|
| 115 |
+
<table><tr><td colspan="3">1:while yi-1 ≠ EndOfSequence do</td></tr><tr><td>2:</td><td>tmax =1</td><td></td></tr><tr><td>3:</td><td>h = empty sequence</td><td></td></tr><tr><td>4:</td><td>forl←1toLdo</td><td></td></tr><tr><td>5:</td><td>forh←1to Hdo</td><td></td></tr><tr><td>6:</td><td>forj←ttoacldo</td><td></td></tr><tr><td>7:</td><td>l,h Pi,j, = Sigmoid (MonotonicEnergy(Si-1,mj ))</td><td></td></tr><tr><td>8:</td><td>ifpi l,h > 0.5 then</td><td></td></tr><tr><td>9:</td><td>=j</td><td></td></tr><tr><td>10:</td><td>l,h =fcontext(h,t,h)</td><td></td></tr><tr><td>11:</td><td>Ci Break</td><td></td></tr><tr><td>12:</td><td>else</td><td></td></tr><tr><td>13:</td><td>if j>tmax then</td><td></td></tr><tr><td>14:</td><td>Read token x j</td><td></td></tr><tr><td>15:</td><td></td><td>Calculate state h j and append to h</td></tr><tr><td>16:</td><td>tmax =j</td><td></td></tr><tr><td>17:</td><td>c = Concat(c,1,</td><td>,cH)</td></tr><tr><td>18:</td><td>s =DecoderLayer'(s-1,s)</td><td></td></tr><tr><td>19:</td><td>yi = Output(s)</td><td></td></tr><tr><td>20:</td><td></td><td></td></tr></table>
|
| 116 |
+
|
| 117 |
+
gives a hard alignment to the end-of-sentence token, which provides very little information to the decoder. Furthermore, it is possible that an MMA-H attention head stays at the beginning of sentence without moving forward. Such a head would not cause latency issues but would degrade the model quality since the decoder would not have any information about the input. In addition, this behavior is not suited for streaming systems.
|
| 118 |
+
|
| 119 |
+
To address these issues, we introduce two latency control methods. The first one is weighted average latency, shown in Equation 14:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
g _ { i } ^ { W } = \frac { \exp ( g _ { i } ^ { l , h } ) } { \sum _ { l = 1 } ^ { L } \sum _ { h = 1 } ^ { H } \exp ( g _ { i } ^ { l , h } ) } g _ { i } ^ { l , h }
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $\begin{array} { r } { g _ { i } ^ { l , h } = \sum _ { j = 1 } ^ { | x | } j \alpha _ { i , j } } \end{array}$ . Then we calculate the latency loss with a differentiable latency metric $\mathcal { C }$
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\begin{array} { r c l } { { L _ { a v g } } } & { { = } } & { { { \mathcal { C } } \left( g ^ { W } \right) } } \end{array}
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
Like Arivazhagan et al. (2019), we use the Differentiable Average Lagging. It is important to note that, unlike the original latency augmented training in Arivazhagan et al. (2019), Equation 15 is not the expected latency metric given $\mathcal { C }$ , but weighted average $\mathcal { C }$ on all the attentions. The real expected latency is $\hat { \pmb g } = \mathrm { m a x } _ { l , h } \left( \pmb g ^ { l , h } \right)$ instead of $\bar { \pmb { g } }$ , but using this directly would only affect the speed of the fastest head. Equation 15 can control every head in a way that the faster heads will be automatically assigned to larger weights and slower heads will also be moderately regularized. For MMA-H models, we found that the latency of are mainly due to outliers that skip almost every token. The weighted average latency loss is not sufficient to control the outliers. We therefore introduce the head divergence loss, the average variance of expected delays at each step, defined in Equation 16:
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\begin{array} { c c l } { { { \cal L } _ { v a r } } } & { { = } } & { { \displaystyle \frac { 1 } { L H } \sum _ { l = 1 } ^ { L } \sum _ { h = 1 } ^ { H } \left( g _ { i } ^ { l , h } - \bar { g } _ { i } \right) ^ { 2 } } } \end{array}
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where $\begin{array} { r } { \bar { g _ { i } } = \frac { 1 } { L H } \sum g _ { i } } \end{array}$ The final objective function is presented in Equation 17:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
L ( \theta ) = - \log ( \pmb { y } \mid \pmb { x } ; \theta ) + \lambda _ { a v g } L _ { a v g } + \lambda _ { v a r } L _ { v a r }
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
where $\lambda _ { a v g } , \lambda _ { v a r }$ are hyperparameters that control both losses. Intuitively, while $\lambda _ { a v g }$ controls the overall speed, $\lambda _ { v a r }$ controls the divergence of the heads. Combining these two losses, we are able to dynamically control the range of attention heads so that we can control the latency and the reading buffer. For MMA-IL model, we only use $L _ { a v g }$ ; for MMA-H we only use $L _ { v a r }$ .
|
| 144 |
+
|
| 145 |
+
# 3 EXPERIMENTAL SETUP
|
| 146 |
+
|
| 147 |
+
# 3.1 EVALUATION METRICS
|
| 148 |
+
|
| 149 |
+
We evaluate our model using quality and latency. For translation quality, we use tokenized BLEU 4 for IWSLT15 En-Vi and detokenized BLEU with SacreBLEU (Post, 2018) for WMT15 De-En. For latency, we use three different recent metrics, Average Proportion (AP) (Cho & Esipova, 2016), Average Lagging (AL) (Ma et al., 2019) and Differentiable Average Lagging (DAL) (Arivazhagan et al., 2019) 5. We remind the reader of the metric definitions in Appendix A.2.
|
| 150 |
+
|
| 151 |
+
# 3.2 DATASETS
|
| 152 |
+
|
| 153 |
+
Table 1: Number of sentences in each split.
|
| 154 |
+
|
| 155 |
+
<table><tr><td>Dataset</td><td>Train</td><td>Validation</td><td>Test</td></tr><tr><td>IWSLT15 En-Vi</td><td>133k</td><td>1268</td><td>1553</td></tr><tr><td>WMT15 De-En</td><td>4.5M</td><td>3000</td><td>2169</td></tr></table>
|
| 156 |
+
|
| 157 |
+
Table 2: Offline model performance with unidirectional encoder and greedy decoding.
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Dataset</td><td>RNN</td><td>Transformer</td></tr><tr><td>IWSLT15 En-Vi</td><td>25.66</td><td>28.7</td></tr><tr><td>WMT15 De-En</td><td>28.4 (Arivazhagan et al., 2019)</td><td>32.3</td></tr></table>
|
| 160 |
+
|
| 161 |
+
<table><tr><td>Dataset</td><td>Beam Search</td><td>Bidirectional Encoder</td><td>Unidirectional Encoder</td></tr><tr><td rowspan="2">WMT15 De-En</td><td>1</td><td>32.6</td><td>32.3</td></tr><tr><td>4</td><td>33.0</td><td>33.0</td></tr><tr><td rowspan="2">IWSLT15 En-Vi</td><td>1</td><td>28.7</td><td>29.4</td></tr><tr><td>10</td><td>28.8</td><td>29.5</td></tr></table>
|
| 162 |
+
|
| 163 |
+
Table 3: Effect of using a unidirectional encoder and greedy decoding to BLEU score.
|
| 164 |
+
|
| 165 |
+
We evaluate our method on two standard machine translation datasets, IWSLT14 En-Vi and WMT15 De-En. Statistics of the datasets can be found in Table 1. For each dataset, we apply tokenization with the Moses (Koehn et al., 2007) tokenizer and preserve casing.
|
| 166 |
+
|
| 167 |
+
IWSLT15 English-Vietnamese TED talks from IWSLT 2015 Evaluation Campaign (Cettolo et al., 2016). We follow the settings from Luong & Manning (2015) and Raffel et al. (2017). We replace words with frequency less than 5 by $< u n k >$ . We use tst2012 as a validation set tst2013 as a test set.
|
| 168 |
+
|
| 169 |
+
WMT15 German-English We follow the setting from Arivazhagan et al. (2019). We apply byte pair encoding (BPE) (Sennrich et al., 2016) jointly on the source and target to construct a shared vocabulary with 32K symbols. We use newstest2013 as validation set and newstest2015 as test set.
|
| 170 |
+
|
| 171 |
+
# 3.3 MODELS
|
| 172 |
+
|
| 173 |
+
We evaluate MMA-H and MMA-IL models on both datasets. The MILK model we evaluate on IWSLT15 En-Vi is based on Luong et al. (2015) rather than RNMT $^ +$ (Chen et al., 2018). In general, our offline models use unidirectional encoders, i.e. the encoder self-attention can only attend to previous states, and greedy decoding. We report offline model performance in Table 2 and the effect of using unidirectional encoders and greedy decoding in Table 3. For MMA models, we replace the encoder-decoder layers with MMA and keep other hyperparameter settings the same as the offline model. Detailed hyperparameter settings can be found in subsection A.1. We use the Fairseq library (Ott et al., 2019) for our implementation.
|
| 174 |
+
|
| 175 |
+
# 4 RESULTS
|
| 176 |
+
|
| 177 |
+
In this section, we present the main results of our model in terms of latency-quality tradeoffs, ablation studies and analyses. In the first study, we analyze the effect of the variance loss on the attention span. Then, we study the effect of the number of decoder layers and decoder heads on quality and latency. We also provide a case study for the behavior of attention heads in an example. Finally, we study the relationship between the rank of an attention head and the layer it belongs to.
|
| 178 |
+
|
| 179 |
+

|
| 180 |
+
Figure 2: Latency-quality tradeoffs for MILk (Arivazhagan et al., 2019) and MMA on IWSLT15 En-Vi and WMT15 De-En. Black dashed line indicates the unidirectional offline transformer model with greedy search.
|
| 181 |
+
|
| 182 |
+
# 4.1 LATENCY-QUALITY TRADEOFFS
|
| 183 |
+
|
| 184 |
+
We plot the quality-latency curves for MMA-H and MMA-IL in Figure 2. The BLEU and latency scores on the test sets are generated by setting a latency range and selecting the checkpoint with best BLEU score on the validation set. We use differentiable average lagging (Arivazhagan et al., 2019) when setting the latency range. We find that for a given latency, our models obtain a better translation quality. While MMA-IL tends to have a decrease in quality as the latency decreases, MMA-H has a small gain in quality as latency decreases: a larger latency does not necessarily mean an increase in source information available to the model. In fact, the large latency is from the outlier attention heads, which skip the entire source sentence and point to the end of the sentence. The outliers not only increase the latency but they also do not provide useful information. We introduce the attention variance loss to eliminate the outliers, as such a loss makes the attention heads focus on the current context for translating the new target token.
|
| 185 |
+
|
| 186 |
+
It is interesting to observe that MMA-H has a better latency-quality tradeoff than $\mathrm { M I L K } ^ { 7 }$ even though each head only attends to only one state. Although MMA-H is not yet able to handle an arbitrarily long input (without resorting to segmenting the input), since both encoder and decoder self-attention have an infinite lookback, that model represents a good step in that direction.
|
| 187 |
+
|
| 188 |
+
# 4.2 ATTENTION SPAN
|
| 189 |
+
|
| 190 |
+
In subsection 2.3, we introduced the attention variance loss to MMA-H in order to prevent outlier attention heads from increasing the latency or increasing the attention span. We have already evaluated the effectiveness of this method on latency in subsection 4.1. We also want to measure the difference between the fastest and slowest heads at each decoding step. We define the average
|
| 191 |
+
|
| 192 |
+
attention span in Equation 18:
|
| 193 |
+
|
| 194 |
+
$$
|
| 195 |
+
\bar { S } = \frac { 1 } { \vert \pmb { y } \vert } \left( \sum _ { i } ^ { \vert \pmb { y } \vert } \underset { l , h } { \operatorname* { m a x } } t _ { i } ^ { l , h } - \underset { l , h } { \operatorname* { m i n } } t _ { i } ^ { l , h } \right)
|
| 196 |
+
$$
|
| 197 |
+
|
| 198 |
+
It estimates the reading buffer we need for streaming translation. We show the relation between the average attention span versus $\lambda _ { v a r }$ in Figure 3. As expected, the average attention span is reduced as we increase $\lambda _ { v a r }$ .
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 3: Effect of $\lambda _ { v a r }$ on the average attention span. The variance loss works as intended by reducing the span with higher weights.
|
| 202 |
+
|
| 203 |
+
# 4.3 EFFECT ON NUMBER OF LAYERS AND NUMBER OF HEADS
|
| 204 |
+
|
| 205 |
+
One motivation to introduce MMA is to adapt the Transformer, which is the current state-of-the-art model for machine translation, to online decoding. Important features of the Transformer architecture include having a separate attention layer for each decoder layer block and multihead attention. In this section, we test the effect of these two components on the offline, MMA-H, and MMA-IL models from a quality and latency perspective. We report quality as measured by detokenized BLEU and latency as measured by DAL on the WMT13 validation set in Figure 4. We set $\lambda _ { a v g } = 0 . 2$ for MMA-IL and $\lambda _ { v a r } = 0 . 2$ for MMA-H.
|
| 206 |
+
|
| 207 |
+
The offline model benefits from having more than one decoder layer. In the case of 1 decoder layer, increasing the number of attention heads is beneficial but in the case of 3 and 6 decoder layers, we do not see much benefit from using more than 2 heads. The best performance is obtained for 3 layers and 2 heads (6 effective heads). The MMA-IL model behaves similarly to the offline model, and the best performance is observed with 6 layers and 4 heads (24 effective heads). For MMA-H, with 1 layer, performance improves with more heads. With 3 layers, the single-head setting is the most effective (3 effective heads). Finally, with 6 layers, the best performance is reached with 16 heads (96 effective heads).
|
| 208 |
+
|
| 209 |
+
The general trend we observe is that performance improves as we increase the number of effective heads, either from multiple layers or multihead attention, up to a certain point, then either plateaus or degrades. This motivates the introduction of the MMA model.
|
| 210 |
+
|
| 211 |
+
We also note that latency increases with the number of effective attention heads. This is due to having fixed loss weights: when more heads are involved, we should increase $\lambda _ { v a r }$ or $\lambda _ { a v g }$ to better control latency.
|
| 212 |
+
|
| 213 |
+
# 4.4 ATTENTION BEHAVIORS
|
| 214 |
+
|
| 215 |
+
We characterize attention behaviors by providing a running example of MMA-H and MMA-IL, shown in Figure 5. Each curve represents the path that an attention head goes through at inference time. For MMA-H, shown in Figure 5a, we found that when the source and target tokens have the same order, the attention heads behave linearly and the distance between fastest head and slowest head is small. For example, this can be observed from partial sentence pair “I also didn’t know that” and target tokens “Tôi cũng không biết rằng”, which have the same order. However, when the source tokens and target tokens have different orders, such as “the second step” and “bước (step) thứ hai (second)”, the model will generate “bước (step)” first and some heads will stay in the past to retain the information for later reordered translation “thứ hai (second)”. We can also see that the attention heads have a near-diagonal trajectory, which is appropriate for streaming inputs.
|
| 216 |
+
|
| 217 |
+

|
| 218 |
+
Figure 4: Effect of the number of decoder attention heads and the number of decoder attention layers on quality and latency, reported on the WMT13 validation set.
|
| 219 |
+
|
| 220 |
+
The behavior of the heads in MMA-IL models is shown in Figure 5b. Notice that we remove the partial softmax alignment in this figure. We don’t expect streaming capability for MMA-IL: some heads stop at early position of the source sentence to retain the history information. Moreover, because MMA-IL has more information when generating a new target token, it tends to produce translations with better quality. In this example, the MMA-IL model has a better translation on “isolate the victim” than MMA-H (“là cô lập nạn nhân” vs “là tách biệt nạn nhân”)
|
| 221 |
+
|
| 222 |
+

|
| 223 |
+
Figure 5: Running examples on IWSLT15 English-Vietnamese dataset
|
| 224 |
+
|
| 225 |
+
# 4.5 RANK OF THE HEADS
|
| 226 |
+
|
| 227 |
+
In Figure 6, we calculate the average and standard deviation of rank of each head when generating every target token. For MMA-IL, we find that heads in lower layers tend to have higher rank and are thus slower. However, in MMA-H, the difference of the average rank are smaller. Furthermore, the standard deviation is very large which means that the order of the heads in MMA-H changes frequently over the inference process.
|
| 228 |
+
|
| 229 |
+

|
| 230 |
+
Figure 6: The average rank of attention heads during inference on IWSLT15 En-Vi. Error bars indicate the standard deviation. L indicates the layer number and $\mathrm { H }$ indicates the head number.
|
| 231 |
+
|
| 232 |
+
# 5 RELATED WORK
|
| 233 |
+
|
| 234 |
+
Recent work on simultaneous machine translation falls into three categories. In the first one, models use a rule-based policy for reading input and writing output. Cho & Esipova (2016) propose a WaitIf-\* policy to enable an offline model to decode simultaneously. Ma et al. (2019) propose a wait- $k$ policy where the model first reads $k$ tokens, then alternates between read and write actions. Dalvi et al. (2018) propose an incremental decoding method, also based on a rule-based schedule. In the second category, a flexible policy is learnt from data. Grissom II et al. (2014) introduce a Markov chain to phrase-based machine translation models for simultaneous machine translation, in which they apply reinforcement learning to learn the read-write policy based on states. Gu et al. (2017) introduce an agent which learns to make decisions on when to translate from the interaction with a pre-trained offline neural machine translation model. Luo et al. (2017) used continuous rewards policy gradient for online alignments for speech recognition. Lawson et al. (2018) proposed a hard alignment with variational inference for online decoding. Alinejad et al. (2018) propose a new operation ”predict” which predicts future source tokens. Zheng et al. (2019b) introduce a restricted dynamic oracle and restricted imitation learning for simultaneous translation. Zheng et al. (2019a) train the agent with an action sequence from labels that are generated based on the rank of the gold target word given partial input. Models from the last category leverage monotonic attention and replace the softmax attention with an expected attention calculated from a stepwise Bernoulli selection probability. Raffel et al. (2017) first introduce the concept of monotonic attention for online linear time decoding, where the attention only attends to one encoder state at a time. Chiu & Raffel (2018) extended that work to let the model attend to a chunk of encoder state. Arivazhagan et al. (2019) also make use of the monotonic attention but introduce an infinite lookback to improve the translation quality.
|
| 235 |
+
|
| 236 |
+
# 6 CONCLUSION
|
| 237 |
+
|
| 238 |
+
In this paper, we propose two variants of the monotonic multihead attention model for simultaneous machine translation. By introducing two new targeted loss terms which allow us to control both latency and attention span, we are able to leverage the power of the Transformer architecture to achieve better quality-latency trade-offs than the previous state-of-the-art model. We also present detailed ablation studies demonstrating the efficacy and rationale of our approach. By introducing these stronger simultaneous sequence-to-sequence models, we hope to facilitate important applications, such as high-quality real-time interpretation between human speakers.
|
| 239 |
+
|
| 240 |
+
# REFERENCES
|
| 241 |
+
|
| 242 |
+
Ashkan Alinejad, Maryam Siahbani, and Anoop Sarkar. Prediction improves simultaneous neural machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3022–3027, 2018.
|
| 243 |
+
|
| 244 |
+
Naveen Arivazhagan, Colin Cherry, Wolfgang Macherey, Chung-Cheng Chiu, Semih Yavuz, Ruoming Pang, Wei Li, and Colin Raffel. Monotonic infinite lookback attention for simultaneous machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 1313–1323, Florence, Italy, July 2019. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/P19-1126.
|
| 245 |
+
|
| 246 |
+
Lo¨ıc Barrault, Ondˇrej Bojar, Marta R. Costa-jussa, Christian Federmann, Mark Fishel, Yvette \` Graham, Barry Haddow, Matthias Huck, Philipp Koehn, Shervin Malmasi, Christof Monz, Mathias Muller, Santanu Pal, Matt Post, and Marcos Zampieri. Findings of the 2019 con- ¨ ference on machine translation (WMT19). In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pp. 1–61, Florence, Italy, August 2019. Association for Computational Linguistics. doi: 10.18653/v1/W19-5301. URL https://www.aclweb.org/anthology/W19-5301.
|
| 247 |
+
|
| 248 |
+
Mauro Cettolo, Niehues Jan, Stuker Sebastian, Luisa Bentivogli, Roldano Cattoni, and Marcello ¨ Federico. The iwslt 2016 evaluation campaign. In International Workshop on Spoken Language Translation, 2016.
|
| 249 |
+
|
| 250 |
+
Mia Xu Chen, Orhan Firat, Ankur Bapna, Melvin Johnson, Wolfgang Macherey, George Foster, Llion Jones, Mike Schuster, Noam Shazeer, Niki Parmar, et al. The best of both worlds: Combining recent advances in neural machine translation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 76–86, 2018.
|
| 251 |
+
|
| 252 |
+
Chung-Cheng Chiu and Colin Raffel. Monotonic chunkwise attention. 2018. URL https:// openreview.net/pdf?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Hko85plCW.
|
| 253 |
+
|
| 254 |
+
Kyunghyun Cho and Masha Esipova. Can neural machine translation do simultaneous translation? arXiv preprint arXiv:1606.02012, 2016.
|
| 255 |
+
|
| 256 |
+
Fahim Dalvi, Nadir Durrani, Hassan Sajjad, and Stephan Vogel. Incremental decoding and training methods for simultaneous translation in neural machine translation. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pp. 493–499, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-2079. URL https://www.aclweb.org/anthology/N18-2079.
|
| 257 |
+
|
| 258 |
+
Alvin Grissom II, He He, Jordan Boyd-Graber, John Morgan, and Hal Daume III. Don’t until the ´ final verb wait: Reinforcement learning for simultaneous machine translation. In Proceedings of the 2014 Conference on empirical methods in natural language processing (EMNLP), pp. 1342– 1352, 2014.
|
| 259 |
+
|
| 260 |
+
Jiatao Gu, Graham Neubig, Kyunghyun Cho, and Victor OK Li. Learning to translate in real-time with neural machine translation. In 15th Conference of the European Chapter of the Association for Computational Linguistics, EACL 2017, pp. 1053–1062. Association for Computational Linguistics (ACL), 2017.
|
| 261 |
+
|
| 262 |
+
Philipp Koehn, Hieu Hoang, Alexandra Birch, Chris Callison-Burch, Marcello Federico, Nicola Bertoldi, Brooke Cowan, Wade Shen, Christine Moran, Richard Zens, Chris Dyer, Ondˇrej Bojar, Alexandra Constantin, and Evan Herbst. Moses: Open source toolkit for statistical machine translation. In Proceedings of the 45th Annual Meeting of the Association for Computational Linguistics Companion Volume Proceedings of the Demo and Poster Sessions, pp. 177–180, Prague, Czech Republic, June 2007. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/P07-2045.
|
| 263 |
+
|
| 264 |
+
Dieterich Lawson, Chung-Cheng Chiu, George Tucker, Colin Raffel, Kevin Swersky, and Navdeep Jaitly. Learning hard alignments with variational inference. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5799–5803. IEEE, 2018.
|
| 265 |
+
|
| 266 |
+
Yuping Luo, Chung-Cheng Chiu, Navdeep Jaitly, and Ilya Sutskever. Learning online alignments with continuous rewards policy gradient. In 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 2801–2805. IEEE, 2017.
|
| 267 |
+
|
| 268 |
+
Minh-Thang Luong and Christopher D Manning. Stanford neural machine translation systems for spoken language domains. 2015.
|
| 269 |
+
|
| 270 |
+
Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attentionbased neural machine translation. arXiv preprint arXiv:1508.04025, 2015.
|
| 271 |
+
|
| 272 |
+
Mingbo Ma, Liang Huang, Hao Xiong, Renjie Zheng, Kaibo Liu, Baigong Zheng, Chuanqiang Zhang, Zhongjun He, Hairong Liu, Xing Li, Hua Wu, and Haifeng Wang. STACL: Simultaneous translation with implicit anticipation and controllable latency using prefix-to-prefix framework. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 3025–3036, Florence, Italy, July 2019. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/P19-1289.
|
| 273 |
+
|
| 274 |
+
Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL-HLT 2019: Demonstrations, 2019.
|
| 275 |
+
|
| 276 |
+
Matt Post. A call for clarity in reporting BLEU scores. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 186–191, Belgium, Brussels, October 2018. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ W18-6319.
|
| 277 |
+
|
| 278 |
+
Colin Raffel, Minh-Thang Luong, Peter J Liu, Ron J Weiss, and Douglas Eck. Online and linear-time attention by enforcing monotonic alignments. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2837–2846. JMLR. org, 2017.
|
| 279 |
+
|
| 280 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1715–1725, 2016.
|
| 281 |
+
|
| 282 |
+
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.
|
| 283 |
+
|
| 284 |
+
Baigong Zheng, Renjie Zheng, Mingbo Ma, and Liang Huang. Simpler and faster learning of adaptive policies for simultaneous translation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 1349–1354, Hong Kong, China, November 2019a. Association for Computational Linguistics. doi: 10.18653/v1/D19-1137. URL https://www.aclweb.org/anthology/D19-1137.
|
| 285 |
+
|
| 286 |
+
Baigong Zheng, Renjie Zheng, Mingbo Ma, and Liang Huang. Simultaneous translation with flexible policy via restricted imitation learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5816–5822, Florence, Italy, July 2019b. Association for Computational Linguistics. doi: 10.18653/v1/P19-1582. URL https://www.aclweb. org/anthology/P19-1582.
|
| 287 |
+
|
| 288 |
+
# A APPENDIX
|
| 289 |
+
|
| 290 |
+
# A.1 HYPERPARAMETERS
|
| 291 |
+
|
| 292 |
+
The hyperparameters we used for offline and monotonic transformer models are defined in Table 4.
|
| 293 |
+
|
| 294 |
+
# A.2 LATENCY METRICS DEFINITIONS
|
| 295 |
+
|
| 296 |
+
Given the delays $\mathbf { g } = \{ g _ { 1 } , g _ { 2 } , . . . , g _ { | \mathbf { y } | } \}$ of generating each target token, AP, AL and DAL are defined in Table 5.
|
| 297 |
+
|
| 298 |
+
Table 4: Offline and monotonic models hyperparameters.
|
| 299 |
+
|
| 300 |
+
<table><tr><td>Hyperparameter</td><td>WMT15 German-English</td><td>IWSLT English-Vietnamese</td></tr><tr><td>encoder embed dim</td><td>1024</td><td>512</td></tr><tr><td>encoder ffn embed dim</td><td>4096</td><td>1024</td></tr><tr><td>encoder attention heads</td><td>16</td><td>4</td></tr><tr><td>encoder layers</td><td></td><td>6</td></tr><tr><td>decoder embed dim</td><td>1024</td><td>512</td></tr><tr><td>decoder ffn embed dim</td><td>4096</td><td>1024</td></tr><tr><td>decoder attention heads</td><td>16</td><td>4</td></tr><tr><td>decoder layers</td><td></td><td>6</td></tr><tr><td>dropout</td><td>0.3</td><td></td></tr><tr><td>optimizer</td><td></td><td>adam</td></tr><tr><td>adam-β</td><td></td><td>(0.9,0.98)</td></tr><tr><td>clip-norm</td><td></td><td>0.0</td></tr><tr><td>lr lr scheduler</td><td></td><td>0.0005</td></tr><tr><td></td><td></td><td>inverse sqrt</td></tr><tr><td>warmup-updates</td><td></td><td>4000</td></tr><tr><td>warmup-init-lr</td><td></td><td>1e-07</td></tr><tr><td>label-smoothing</td><td></td><td>0.1</td></tr><tr><td>max tokens</td><td>3584×8×8×2</td><td>16000</td></tr></table>
|
| 301 |
+
|
| 302 |
+
Table 5: The calculation of latency metrics, given source $_ { \textbf { \em x } }$ , target $\textbf { { y } }$ and delays $\pmb { g }$
|
| 303 |
+
|
| 304 |
+
<table><tr><td colspan="2">Latency Metric</td></tr><tr><td>Average Proportion</td><td>y 1 M gi lacllyl i=1</td></tr><tr><td>Average Lagging</td><td>1 T i-1 gi 1y1/ac T i=1 where T = arg maxi(gi = |xl)</td></tr><tr><td>1 ly Differentiable Average Lagging</td><td>lyl i-1 M gi lyl//ac| i=1 gi i=0 where g' = ly max(gi, 9i-1 i<0 [x</td></tr></table>
|
| 305 |
+
|
| 306 |
+
# A.3 DETAILED RESULTS
|
| 307 |
+
|
| 308 |
+
We provide the detailed results in Figure 2 as Table 6 and Table 7.
|
| 309 |
+
|
| 310 |
+
# A.4 THRESHOLD OF READING ACTION
|
| 311 |
+
|
| 312 |
+
We explore a simple method that can adjust system’s latency at inference time without training new models. In Algorithm 1 line 8, 0.5 was used as an threshold. One can set different threshold $p$ during the inference time to control the latency. We run the pilot experiments on IWSLT15 En-Vi dataset and the results are shown as Table 8. Although this method doesn’t require training new model, it dramatically hurts the translation quality.
|
| 313 |
+
|
| 314 |
+
Table 6: Detailed results for MMA-H and MMA-IL on WMT15 DeEn
|
| 315 |
+
|
| 316 |
+
<table><tr><td rowspan=1 colspan=1>BLEU AP AL DAL</td></tr><tr><td rowspan=1 colspan=1>Xavg MMA-IL</td></tr><tr><td rowspan=1 colspan=1>0.05 30.7 0.78 10.91 12.64</td></tr><tr><td rowspan=1 colspan=1>0.1 30.5 0.70 7.42 8.82</td></tr><tr><td rowspan=1 colspan=1>0.2 30.1 0.63 5.17 6.41</td></tr><tr><td rowspan=1 colspan=1>0.3 30.3 0.60 4.18 5.35</td></tr><tr><td rowspan=1 colspan=1>0.4 29.2 0.59 3.75 4.90</td></tr><tr><td rowspan=1 colspan=1>0.5 26.7 0.59 3.69 4.83</td></tr><tr><td rowspan=1 colspan=1>0.75 25.5 0.58 3.40 4.46</td></tr><tr><td rowspan=1 colspan=1>1.0 25.1 0.56 3.00 4.03</td></tr><tr><td rowspan=1 colspan=1>Xvar MMA-H</td></tr><tr><td rowspan=1 colspan=1>0.1 28.5 0.74 8.94 10.83</td></tr><tr><td rowspan=1 colspan=1>0.2 28.9 0.69 6.82 8.622</td></tr><tr><td rowspan=1 colspan=1>0.3 29.2 0.64 5.45 7.03</td></tr><tr><td rowspan=1 colspan=1>0.4 28.5 0.59 3.90 5.21</td></tr><tr><td rowspan=1 colspan=1>0.5 28.5 0.59 3.88 5.19</td></tr><tr><td rowspan=1 colspan=1>0.6 29.6 0.56 3.13 4.32</td></tr><tr><td rowspan=1 colspan=1>0.7 29.1 0.56 2.93 4.10</td></tr></table>
|
| 317 |
+
|
| 318 |
+
Table 7: Detailed results for MILk, MMA-H and MMA-IL on IWSLT15 En-Vi
|
| 319 |
+
|
| 320 |
+
<table><tr><td>BLEU</td><td></td><td>AP</td><td>AL</td><td>DAL</td></tr><tr><td>入</td><td></td><td>MILk</td><td></td><td></td></tr><tr><td>0.1</td><td>24.62</td><td>0.71</td><td>5.93</td><td>7.19</td></tr><tr><td>0.2</td><td>24.68</td><td>0.67</td><td>4.90</td><td>5.97</td></tr><tr><td>0.3</td><td>24.31</td><td>0.65</td><td>4.45</td><td>5.43</td></tr><tr><td>0.4</td><td>23.73</td><td>0.64</td><td>4.28</td><td>5.24</td></tr><tr><td>Xaug</td><td></td><td>MMA-IL</td><td></td><td></td></tr><tr><td>0.02</td><td>28.28</td><td>0.76</td><td>7.09</td><td>8.29</td></tr><tr><td>0.04</td><td>28.33</td><td>0.70</td><td>5.44</td><td>6.57</td></tr><tr><td>0.1</td><td>28.42</td><td>0.67</td><td>4.63</td><td>5.65</td></tr><tr><td>0.2</td><td>28.47</td><td>0.63</td><td>3.57</td><td>4.44</td></tr><tr><td>0.3</td><td>27.9</td><td>0.59</td><td>2.98</td><td>3.81</td></tr><tr><td>0.4</td><td>27.73</td><td>0.58</td><td>2.68</td><td>3.46</td></tr><tr><td>Xuar</td><td></td><td>MMA-H</td><td></td><td></td></tr><tr><td>0.02</td><td>27.26</td><td>0.77</td><td>7.52</td><td>8.71</td></tr><tr><td>0.1</td><td></td><td></td><td>5.22</td><td>6.31</td></tr><tr><td></td><td>27.68</td><td>0.69</td><td>3.81</td><td></td></tr><tr><td>0.2</td><td>28.06</td><td>0.63</td><td></td><td>4.84</td></tr><tr><td>0.4</td><td>27.79</td><td>0.62</td><td>3.57</td><td>4.59</td></tr><tr><td>0.8</td><td>27.95</td><td>0.60</td><td>3.22</td><td>4.19</td></tr></table>
|
| 321 |
+
|
| 322 |
+
# A.5 AVERAGE LOSS FOR MMA-H
|
| 323 |
+
|
| 324 |
+
We explore applying a simple average instead of a weighted average loss to MMA-H. The results are shown in Figure 7 and Table 9. We find that even with very large weights, we are unable to reduce the overall latency. In addition, we find that the weighted average loss severely affects the translation quality negatively. On the other hand, the divergence loss we propose in Equation 16 can efficiently reduce the latency while retaining relatively good translation quality for MMA-H models.
|
| 325 |
+
|
| 326 |
+
<table><tr><td colspan="6">Reading Threshold</td><td colspan="4">Weighted Average Latency Loss</td></tr><tr><td>p</td><td>BLEU</td><td>AP</td><td>AL</td><td>DAL</td><td>Lavg</td><td>BLEU</td><td>AP</td><td>AL</td><td>DAL</td></tr><tr><td>0.5</td><td>25.5</td><td>0.792387</td><td>7.13673</td><td>8.27187</td><td>0.02</td><td>25.5</td><td>0.792387</td><td>7.13673</td><td>8.27187</td></tr><tr><td>0.4</td><td>25.25</td><td>0.73749</td><td>5.72003</td><td>6.85812</td><td>0.04</td><td>25.68</td><td>0.728107</td><td>5.52856</td><td>6.61744</td></tr><tr><td>0.3</td><td>23.06</td><td>0.697398</td><td>4.88087</td><td>6.03342</td><td>0.3</td><td>24.9</td><td>0.602703</td><td>2.90054</td><td>3.68039</td></tr><tr><td>0.2</td><td>18.37</td><td>0.678298</td><td>4.71099</td><td>5.94636</td><td>0.2</td><td>25.3</td><td>0.636914</td><td>3.54577</td><td>4.38623</td></tr><tr><td>0.1</td><td>8.73</td><td>0.696452</td><td>5.5225</td><td>7.20439</td><td>0.1</td><td>25.48</td><td>0.684424</td><td>4.57901</td><td>5.54102</td></tr></table>
|
| 327 |
+
|
| 328 |
+
Table 8: Comparison between setting threshold for reading action and weighted average latency loss.
|
| 329 |
+
|
| 330 |
+

|
| 331 |
+
Figure 7: Effect average loss, weighted average loss and variance loss on MMA-H on WMT15 DeEn development set.
|
| 332 |
+
Table 9: Detailed numbers on average loss, weighted average loss and head divergence loss on WMT15 De-En development set
|
| 333 |
+
|
| 334 |
+
<table><tr><td></td><td>BLEU</td><td>AP</td><td>AL</td><td>DAL</td></tr><tr><td>Xaug</td><td colspan="4">Average</td></tr><tr><td>0.05</td><td>28.5</td><td>0.862581</td><td>14.3847</td><td>17.3702</td></tr><tr><td>0.1</td><td>27.8</td><td>0.855435</td><td>13.974</td><td>17.02</td></tr><tr><td>0.2</td><td>28</td><td>0.835324</td><td>12.8531</td><td>15.908</td></tr><tr><td>0.4</td><td>28.1</td><td>0.819408</td><td>11.9816</td><td>14.9763</td></tr><tr><td>1.0</td><td>28.2</td><td>0.810609</td><td>11.7528</td><td>14.6695</td></tr><tr><td>2.0</td><td>28.1</td><td>0.800258</td><td>11.1763</td><td>14.0761</td></tr><tr><td>8.0</td><td>28.4</td><td>0.806439</td><td>11.5289</td><td>14.6431</td></tr><tr><td>Xaug</td><td colspan="4">Weighted Average</td></tr><tr><td>0.02</td><td>28.24</td><td>0.773922</td><td>10.2109</td><td>12.2274</td></tr><tr><td>0.04</td><td>24.35</td><td>0.685834</td><td>7.06716</td><td>8.64069</td></tr><tr><td>0.06</td><td>7.80</td><td>0.875825</td><td>16.2046</td><td>19.0892</td></tr><tr><td>0.08</td><td>9.51</td><td>0.57372</td><td>3.92011</td><td>6.1421</td></tr><tr><td>0.1</td><td>9.78</td><td>0.556585</td><td>3.3007</td><td>5.46142</td></tr><tr><td>Xvar</td><td colspan="4">Divergence</td></tr><tr><td>0.1</td><td>27.35</td><td>0.736025</td><td>8.70968</td><td>10.5253</td></tr><tr><td>0.2</td><td>27.64</td><td>0.681491</td><td>6.63914</td><td>8.3856</td></tr><tr><td>0.3</td><td>27.37</td><td>0.6623</td><td>6.04902</td><td>7.71922</td></tr><tr><td>0.4</td><td>27.62</td><td>0.638188</td><td>5.31672</td><td>6.86834</td></tr><tr><td>0.5</td><td>27.50</td><td>0.625759</td><td>4.93044</td><td>6.38998</td></tr><tr><td>1.0</td><td>27.1</td><td>0.582194</td><td>3.64864</td><td>4.90997</td></tr></table>
|
md/train/HygBZnRctX/HygBZnRctX.md
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TRANSFERRING KNOWLEDGE ACROSS LEARNING PROCESSES
|
| 2 |
+
|
| 3 |
+
Sebastian Flennerhag The Alan Turing Institute London, UK sflennerhag@turing.ac.uk
|
| 4 |
+
|
| 5 |
+
Pablo G. Moreno
|
| 6 |
+
Amazon
|
| 7 |
+
Cambridge, UK
|
| 8 |
+
morepabl@amazon.com
|
| 9 |
+
|
| 10 |
+
# Andreas Damianou
|
| 11 |
+
|
| 12 |
+
Neil D. Lawrence
|
| 13 |
+
Amazon
|
| 14 |
+
Cambridge, UK
|
| 15 |
+
lawrennd@amazon.com
|
| 16 |
+
Amazon
|
| 17 |
+
Cambridge, UK
|
| 18 |
+
damianou@amazon.com
|
| 19 |
+
|
| 20 |
+
# ABSTRACT
|
| 21 |
+
|
| 22 |
+
In complex transfer learning scenarios new tasks might not be tightly linked to previous tasks. Approaches that transfer information contained only in the final parameters of a source model will therefore struggle. Instead, transfer learning at a higher level of abstraction is needed. We propose Leap, a framework that achieves this by transferring knowledge across learning processes. We associate each task with a manifold on which the training process travels from initialization to final parameters and construct a meta-learning objective that minimizes the expected length of this path. Our framework leverages only information obtained during training and can be computed on the fly at negligible cost. We demonstrate that our framework outperforms competing methods, both in meta-learning and transfer learning, on a set of computer vision tasks. Finally, we demonstrate that Leap can transfer knowledge across learning processes in demanding reinforcement learning environments (Atari) that involve millions of gradient steps.
|
| 23 |
+
|
| 24 |
+
# 1 INTRODUCTION
|
| 25 |
+
|
| 26 |
+
Transfer learning is the process of transferring knowledge encoded in one model trained on one set of tasks to another model that is applied to a new task. Since a trained model encodes information in its learned parameters, transfer learning typically transfers knowledge by encouraging the target model’s parameters to resemble those of a previous (set of) model(s) (Pan & Yang, 2009). This approach limits transfer learning to settings where good parameters for a new task can be found in the neighborhood of parameters that were learned from a previous task. For this to be a viable assumption, the two tasks must have a high degree of structural affinity, such as when a new task can be learned by extracting features from a pretrained model (Girshick et al., 2014; He et al., 2017; Mahajan et al., 2018). If not, this approach has been observed to limit knowledge transfer since the training process on one task will discard information that was irrelevant for the task at hand, but that would be relevant for another task (Higgins et al., 2017; Achille et al., 2018).
|
| 27 |
+
|
| 28 |
+
We argue that such information can be harnessed, even when the downstream task is unknown, by transferring knowledge of the learning process itself. In particular, we propose a meta-learning framework for aggregating information across task geometries as they are observed during training. These geometries, formalized as the loss surface, encode all information seen during training and thus avoid catastrophic information loss. Moreover, by transferring knowledge across learning processes, information from previous tasks is distilled to explicitly facilitate the learning of new tasks.
|
| 29 |
+
|
| 30 |
+
Meta learning frames the learning of a new task as a learning problem itself, typically in the few-shot learning paradigm (Lake et al., 2011; Santoro et al., 2016; Vinyals et al., 2016). In this environment, learning is a problem of rapid adaptation and can be solved by training a meta-learner by backpropagating through the entire training process (Ravi & Larochelle, 2016; Andrychowicz et al., 2016; Finn et al., 2017). For more demanding tasks, meta-learning in this manner is challenging; backpropagating through thousands of gradient steps is both impractical and susceptible to instability. On the other hand, truncating backpropagation to a few initial steps induces a short-horizon bias (Wu et al., 2018). We argue that as the training process grows longer in terms of the distance traversed on the loss landscape, the geometry of this landscape grows increasingly important. When adapting to a new task through a single or a handful of gradient steps, the geometry can largely be ignored. In contrast, with more gradient steps, it is the dominant feature of the training process.
|
| 31 |
+
|
| 32 |
+
To scale meta-learning beyond few-shot learning, we propose Leap, a light-weight framework for meta-learning over task manifolds that does not need any forward- or backward-passes beyond those already performed by the underlying training process. We demonstrate empirically that Leap is a superior method to similar meta and transfer learning methods when learning a task requires more than a handful of training steps. Finally, we evaluate Leap in a reinforcement Learning environment (Atari 2600; Bellemare et al., 2013), demonstrating that it can transfer knowledge across learning processes that require millions of gradient steps to converge.
|
| 33 |
+
|
| 34 |
+
# 2 TRANSFERRING KNOWLEDGE ACROSS LEARNING PROCESSES
|
| 35 |
+
|
| 36 |
+
We start in section 2.1 by introducing the gradient descent algorithm from a geometric perspective. Section 2.2 builds a framework for transfer learning and explains how we can leverage geometrical quantities to transfer knowledge across learning processes by guiding gradient descent. We focus on the point of initialization for simplicity, but our framework can readily be extended. Section 2.3 presents Leap, our lightweight algorithm for transfer learning across learning processes.
|
| 37 |
+
|
| 38 |
+
# 2.1 GRADIENT PATHS ON TASK MANIFOLDS
|
| 39 |
+
|
| 40 |
+
Central to our framework is the notion of a learning process; the harder a task is to learn, the harder it is for the learning process to navigate on the loss surface (fig. 1). Our framework is based on the idea that transfer learning can be achieved by leveraging information contained in similar learning processes. Exploiting that this information is encoded in the geometry of the loss surface, we leverage geometrical quantities to facilitate the learning process with respect to new tasks. We focus on the supervised learning setting for simplicity, though our framework applies more generally. Given a learning objective $f$ that consumes an input $\boldsymbol { x } \in \mathbb { R } ^ { m }$ and a target $\boldsymbol { y } \in \mathbb { R } ^ { c }$ and maps a parameterization $\boldsymbol \theta \in \mathbb { R } ^ { n }$ to a scalar loss value, we have the gradient descent update as
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\theta ^ { i + 1 } = \theta ^ { i } - \alpha ^ { i } S ^ { i } \nabla f ( \theta ^ { i } ) ,
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $\nabla f ( \theta ^ { i } ) = \mathbb { E } _ { x , y \sim p ( x , y ) } \big [ \nabla f ( \theta ^ { i } , x , y ) \big ]$ . We take the learning rate schedule $\{ \alpha ^ { i } \} _ { i }$ and preconditioning matrices $\{ S ^ { i } \} _ { i }$ as given, but our framework can be extended to learn these jointly with the initialization. Different schemes represent different optimizers; for instance $\alpha ^ { i } = \alpha , \ S ^ { i } = I _ { n }$ yields gradient descent, while defining ${ \dot { S } } ^ { i }$ as the inverse Fisher matrix results in natural gradient descent (Amari, 1998). We assume this process converges to a stationary point after $K$ gradient steps.
|
| 47 |
+
|
| 48 |
+
To distinguish different learning processes originating from the same initialization, we need a notion of their length. The longer the process, the worse the initialization is (conditional on reaching equivalent performance, discussed further below). Measuring the Euclidean distance between initialization and final parameters is misleading as it ignores the actual path taken. This becomes crucial when we compare paths from different tasks, as gradient paths from different tasks can originate from the same initialization and converge to similar final parameters, but take very different paths. Therefore, to capture the length of a learning process we must associate it with the loss surface it traversed.
|
| 49 |
+
|
| 50 |
+
The process of learning a task can be seen as a curve on a specific task manifold $M$ . While this manifold can be constructed in a variety of ways, here we exploit that, by definition, any learning process traverses the loss surface of $f$ . As such, to accurately describe the length of a gradient-based learning process, it is sufficient to define the task manifold as the loss surface. In particular, because the learning process in eq. 1 follows the gradient trajectory, it constantly provides information about the geometry of the loss surface. Gradients that largely point in the same direction indicate a well-behaved loss surface, whereas gradients with frequently opposing directions indicate an ill-conditioned loss surface—something we would like to avoid. Leveraging this insight, we propose a framework for transfer learning that exploits the accumulation of geometric information by constructing a meta objective that minimizes the expected length of the gradient descent path across tasks. In doing so, the meta objective intrinsically balances local geometries across tasks and encourages an initialization that makes the learning process as short as possible.
|
| 51 |
+
|
| 52 |
+

|
| 53 |
+
Figure 1: Example of gradient paths on a manifold described by the loss surface. Leap learns an initialization with shorter expected gradient path that improves performance.
|
| 54 |
+
|
| 55 |
+
To formalize the notion of the distance of a learning process, we define a task manifold $M$ as a submanifold of $\mathbb { R } ^ { n + 1 }$ given by the graph of $f$ . Every point $p ~ = ~ ( \theta , f ( \theta ) ) ~ \in ~ M$ is locally homeomorphic to a Euclidean subspace, described by the tangent space $T _ { p } M$ . Taking $\mathbb { R } ^ { n + 1 }$ to be Euclidean, it is a Riemann manifold. By virtue of being a submanifold of $\mathbb { R } ^ { n + 1 }$ , $M$ is also a Riemann manifold. As such, $M$ comes equipped with an smoothly varying inner product $g _ { p } : T _ { p } M \times T _ { p } M \mapsto$ $\mathbb { R }$ on tangent spaces, allowing us to measure the length of a path on $M$ . In particular, the length (or energy) of any curve $\gamma : [ 0 , 1 ] \mapsto M$ is defined by accumulating infinitesimal changes along the trajectory,
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\operatorname { L e n g t h } ( \gamma ) = \int _ { 0 } ^ { 1 } { \sqrt { g _ { \gamma ( t ) } ( { \dot { \gamma } } ( t ) , { \dot { \gamma } } ( t ) ) } } d t , \qquad \operatorname { E n e r g y } ( \gamma ) = \int _ { 0 } ^ { 1 } g _ { \gamma ( t ) } ( { \dot { \gamma } } ( t ) , { \dot { \gamma } } ( t ) ) d t ,
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
where $\begin{array} { r } { { \dot { \gamma } } ( t ) = { \frac { d } { d t } } \gamma ( t ) \in T _ { \gamma ( t ) } M } \end{array}$ is a tangent vector of $\gamma ( t ) = ( \theta ( t ) , f ( \theta ( t ) ) ) \in M$ . We use parentheses (i.e. $\gamma ( t ) )$ to differentiate discrete and continuous domains. With $M$ being a submanifold of $\mathbb { R } ^ { n + 1 }$ , the induced metric on $M$ is defined by $g _ { \gamma ( t ) } ( \dot { \gamma } ( t ) , \dot { \gamma } ( t ) ) = \langle \dot { \gamma } ( t ) , \dot { \gamma } ( t ) \rangle$ . Different constructions of $M$ yield different Riemann metrics. In particular, if the model underlying $f$ admits a predictive probability distribution $P ( y \mid x )$ , the task manifold can be given an information geometric interpretation by choosing the Fisher matrix as Riemann metric, in which case the task manifold is defined over the space of probability distributions (Amari & Nagaoka, 2007). If eq. 1 is defined as natural gradient descent, the learning process corresponds to gradient descent on this manifold (Amari, 1998; Martens, 2010; Pascanu & Bengio, 2014; Luk & Grosse, 2018).
|
| 62 |
+
|
| 63 |
+
Having a complete description of a task manifold, we can measure the length of a learning process by noting that gradient descent can be seen as a discrete approximation to the scaled gradient flow $\dot { \theta } ( t ) = - S ( t ) \nabla f ( \theta ( t ) )$ . This flow describes a curve that originates in $\gamma ( 0 ) = ( \theta ^ { 0 } , f ( \theta ^ { 0 } ) )$ and follows the gradient at each point. Going forward, we define $\gamma$ to be this unique curve and refer to it as the gradient path from $\theta ^ { \hat { 0 } }$ on $M$ . The metrics in eq. 2 can be computed exactly, but in practice we observe a discrete learning process. Analogously to how the gradient update rule approximates the gradient flow, the gradient path length or energy can be approximated by the cumulative chordal distance (Ahlberg et al., 1967),
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
d _ { p } ( \theta ^ { 0 } , M ) = \sum _ { i = 0 } ^ { K - 1 } \| \gamma ^ { i + 1 } - \gamma ^ { i } \| _ { 2 } ^ { p } , \qquad p \in \{ 1 , 2 \} .
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
Figure 2: Left: illustration of Leap (algorithm 1) for two tasks, $\tau$ and $\tau ^ { \prime }$ . From an initialization $\theta ^ { 0 }$ , the learning process of each task generates gradient paths, $\Psi _ { \tau }$ and $\Psi _ { \tau ^ { \prime } }$ , which Leap uses to minimize the expected path length. Iterating the process, Leap converges to a locally Pareto optimal initialization. Right: the pull-forward objective (eq. 6) used to minimize the expected gradient path length. Any gradient path $\Psi _ { \tau } = \{ \psi _ { \tau } ^ { i } \} _ { i = 1 } ^ { \tilde { K _ { \tau } } }$ acts on $\theta ^ { 0 }$ by pulling each $\theta _ { \tau } ^ { i }$ towards $\psi _ { \tau } ^ { i + 1 }$ .
|
| 71 |
+
|
| 72 |
+
We write $d$ when the distinction between the length or energy metric is immaterial. Using the energy yields a slightly simpler objective, but the length normalizes each length segment and as such protects against differences in scale between task objectives. In appendix C, we conduct an ablation study and find that they perform similarly, though using the length leads to faster convergence. Importantly, $d$ involves only terms seen during task training. We exploit this later when we construct the meta gradient, enabling us to perform gradient descent on the meta objective at negligible cost (eq. 8).
|
| 73 |
+
|
| 74 |
+
We now turn to the transfer learning setting where we face a set of tasks, each with a distinct task manifold. Our framework is built on the idea that we can transfer knowledge across learning processes via the local geometry by aggregating information obtained along observed gradient paths. As such, Leap finds an initialization from which learning converges as rapidly as possible in expectation.
|
| 75 |
+
|
| 76 |
+
# 2.2 META LEARNING ACROSS TASK MANIFOLDS
|
| 77 |
+
|
| 78 |
+
Formally, we define a task $\tau = ( f _ { \tau } , p _ { \tau } , u _ { \tau } )$ as the process of learning to approximate the relationship $x \mapsto y$ through samples from the data distribution $p _ { \tau } ( x , y )$ . This process is defined by the gradient update rule $u _ { \tau }$ (as defined in eq. 1), applied $K _ { \tau }$ times to minimize the task objective $f _ { \tau }$ . Thus, a learning process starts at $\theta _ { \tau } ^ { 0 } = \theta ^ { 0 }$ and progresses via $\theta _ { \tau } ^ { i + 1 } = u _ { \tau } ( \theta _ { \tau } ^ { i } )$ until $\theta _ { \tau } ^ { K _ { \tau } }$ is obtained. The sequence $\{ \theta _ { \tau } ^ { i } \} _ { i = 0 } ^ { K _ { \tau } }$ defines an approximate gradient path on the task manifold $M _ { \tau }$ with distance $d ( \theta ^ { 0 } ; M _ { \tau } )$ .
|
| 79 |
+
|
| 80 |
+
To understand how $d$ transfers knowledge across learning processes, consider two distinct tasks. We can transfer knowledge across these tasks’ learning processes by measuring how good a shared initialization is. Assuming two candidate initializations converge to limit points with equivalent performance on each task, the initialization with shortest expected gradient path distance encodes more knowledge sharing. In particular, if both tasks have convex loss surfaces a unique optimal initialization exists that achieves Pareto optimality in terms of total path distance. This can be crucial in data sparse regimes: rapid convergence may be the difference between learning a task and failing due to overfitting (Finn et al., 2017).
|
| 81 |
+
|
| 82 |
+
Given a distribution of tasks $p ( \tau )$ , each candidate initialization $\theta ^ { 0 }$ is associated with a measure of its expected gradient path distance, $\mathbb { E } _ { \tau \sim p ( \tau ) } \big [ d ( \theta ^ { 0 } ; M _ { \tau } ) \big ]$ , that summarizes the suitability of the initialization to the task distribution. The initialization (or a set thereof) with shortest expected gradient path distance maximally transfers knowledge across learning processes and is Pareto optimal in this regard. Above, we have assumed that all candidate initializations converge to limit points of equal performance. If the task objective $f _ { \tau }$ is non-convex this is not a trivial assumption and the gradient path distance itself does not differentiate between different levels of final performance.
|
| 83 |
+
|
| 84 |
+
As such, it is necessary to introduce a feasibility constraint to ensure only initializations with some minimum level of performance are considered. We leverage that transfer learning never happens in a vacuum; we always have a second-best option, such as starting from a random initialization or a pretrained model. This “second-best” initialization, $\psi ^ { 0 }$ , provides us with the performance we
|
| 85 |
+
|
| 86 |
+
# Algorithm 1 Leap: Transferring Knowledge over Learning Processes
|
| 87 |
+
|
| 88 |
+
Require: $p ( \tau )$ , $\tau = ( f _ { \tau } , u _ { \tau } , p _ { \tau } )$ : distribution over tasks
|
| 89 |
+
|
| 90 |
+
Require: $\beta$ : step size
|
| 91 |
+
1: randomly initialize $\theta ^ { 0 }$
|
| 92 |
+
2: while not done do
|
| 93 |
+
3: $\nabla \bar { F } 0$ : initialize meta gradient
|
| 94 |
+
4: sample task batch $\boldsymbol { B }$ from $p ( \tau )$
|
| 95 |
+
5: for all $\tau \in B$ do
|
| 96 |
+
6: $\psi _ { \tau } ^ { 0 } \theta ^ { 0 }$ : initialize task baseline
|
| 97 |
+
7: for all $i \in \{ 0 , \ldots , K _ { \tau ^ { - 1 } } \}$ do
|
| 98 |
+
8: ${ \psi } _ { \tau } ^ { i + 1 } { u } _ { \tau } ( { \psi } _ { \tau } ^ { i } )$ −: update baseline
|
| 99 |
+
9: $\theta _ { \tau } ^ { i } \psi _ { \tau } ^ { i }$ : follow baseline (recall $\psi _ { \tau } ^ { 0 } = \theta ^ { 0 }$ )
|
| 100 |
+
10: increment $\nabla \bar { F }$ using the pull-forward gradient (eq. 8)
|
| 101 |
+
11: end for
|
| 102 |
+
12: end for
|
| 103 |
+
13: $\begin{array} { r } { \theta ^ { 0 } \theta ^ { 0 } - \frac { \beta } { | \boldsymbol { B } | } \nabla \bar { F } } \end{array}$ : update initialization
|
| 104 |
+
14: end while
|
| 105 |
+
|
| 106 |
+
would obtain on a given task in the absence of knowledge transfer. As such, performance obtained by initializing from $\psi ^ { 0 }$ provides us with an upper bound for each task: a candidate solution $\theta ^ { 0 }$ must achieve at least as good performance to be a viable solution. Formally, this implies the task-specific requirement that a candidate $\theta ^ { 0 }$ must satisfy $f _ { \tau } ( \theta _ { \tau } ^ { K _ { \tau } } ) \le f _ { \tau } ( \psi _ { \tau } ^ { K _ { \tau } } )$ . As this must hold for every task, we obtain the canonical meta objective
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\begin{array} { r l } { \underset { \theta ^ { 0 } } { \operatorname* { m i n } } } & { F ( \theta ^ { 0 } ) = \mathbb { E } _ { \tau \sim p ( \tau ) } \big [ d ( \theta ^ { 0 } ; M _ { \tau } ) \big ] } \\ { \mathrm { s . t . } \quad } & { \theta _ { \tau } ^ { i + 1 } = u _ { \tau } ( \theta _ { \tau } ^ { i } ) , \quad \theta _ { \tau } ^ { 0 } = \theta ^ { 0 } , } \\ & { \theta ^ { 0 } \in \Theta = \cap _ { \tau } \left\{ \theta ^ { 0 } \ \big | \ f _ { \tau } ( \theta _ { \tau } ^ { K _ { \tau } } ) \leq f _ { \tau } ( \psi _ { \tau } ^ { K _ { \tau } } ) \right\} . } \end{array}
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
This meta objective is robust to variations in the geometry of loss surfaces, as it balances complementary and competing learning processes (fig. 2). For instance, there may be an initialization that can solve a small subset of tasks in a handful of gradient steps, but would be catastrophic for other related tasks. When transferring knowledge via the initialization, we must trade off commonalities and differences between gradient paths. In eq. 4 these trade-offs arise naturally. For instance, as the number of tasks whose gradient paths move in the same direction increases, so does their pull on the initialization. Conversely, as the updates to the initialization renders some gradient paths longer, these act as springs that exert increasingly strong pressure on the initialization. The solution to eq. 4 thus achieves an equilibrium between these competing forces.
|
| 113 |
+
|
| 114 |
+
Solving eq. 4 naively requires training to convergence on each task to determine whether an initialization satisfies the feasibility constraint, which can be very costly. Fortunately, because we have access to a second-best initialization, we can solve eq. 4 more efficiently by obtaining gradient paths from $\psi ^ { 0 }$ and use these as baselines that we incrementally improve upon. This improved initialization converges to the same limit points, but with shorter expected gradient paths (theorem 1). As such, it becomes the new second-best option; Leap (algorithm 1) repeats this process of improving upon increasingly demanding baselines, ultimately finding a solution to the canonical meta objective.
|
| 115 |
+
|
| 116 |
+
# 2.3 LEAP
|
| 117 |
+
|
| 118 |
+
Leap starts from a given second-best initialization $\psi ^ { 0 }$ , shared across all tasks, and constructs baseline gradient paths $\Psi _ { \tau } ~ = ~ \{ \psi _ { \tau } ^ { i } \} _ { i = 0 } ^ { K _ { \tau } }$ for each task $\tau$ in a batch $\boldsymbol { B }$ . These provide a set of baselines $\Psi = \left\{ \Psi _ { \tau } \right\} _ { \tau \in { \cal B } }$ . Recall that all tasks share the same initialization, $\psi _ { \tau } ^ { 0 } = \psi ^ { 0 } \in \Theta$ . We use these baselines, corresponding to task-specific learning processes, to modify the gradient path distance metric in eq. 3 by freezing the forward point $\gamma _ { \tau } ^ { i + 1 }$ in all norms,
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
\bar { d } _ { p } ( \theta ^ { 0 } ; M _ { \tau } , \Psi _ { \tau } ) = \sum _ { i = 0 } ^ { K _ { \tau } - 1 } \| \bar { \gamma } _ { \tau } ^ { i + 1 } - \gamma _ { \tau } ^ { i } \| _ { 2 } ^ { p } ,
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
where $\bar { \gamma } _ { \tau } ^ { i } = ( \psi _ { \tau } ^ { i } , f ( \psi _ { \tau } ^ { i } ) )$ represents the frozen forward point from the baseline and $\gamma _ { \tau } ^ { i } = ( \theta _ { \tau } ^ { i } , f ( \theta _ { \tau } ^ { i } ) )$ the point on the gradient path originating from $\theta ^ { 0 }$ . This surrogate distance metric encodes the feasibility constraint; optimizing $\bar { \theta ^ { 0 } }$ with respect to $\Psi$ pulls the initialization forward along each task-specific gradient path in an unconstrained variant of eq. 4 that replaces $\Theta$ with $\Psi$ ,
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\begin{array} { r l } { \underset { \theta ^ { 0 } } { \operatorname* { m i n } } } & { \bar { F } ( \theta ^ { 0 } ; \Psi ) = \mathbb { E } _ { \tau \sim p ( \tau ) } \big [ \bar { d } ( \theta ^ { 0 } ; M _ { \tau } , \Psi _ { \tau } ) \big ] , } \\ { \mathrm { s . t . } } & { \theta _ { \tau } ^ { i + 1 } = u _ { \tau } ( \theta _ { \tau } ^ { i } ) , \quad \theta _ { \tau } ^ { 0 } = \theta ^ { 0 } . } \end{array}
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
We refer to eq. 6 as the pull-forward objective. Incrementally improving $\theta ^ { 0 }$ over $\psi ^ { 0 }$ leads to a new second-best option that Leap uses to generate a new set of more demanding baselines, to further improve the initialization. Iterating this process, Leap produces a sequence of candidate solutions to eq. 4, all in $\Theta$ , with incrementally shorter gradient paths. While the pull-forward objective can be solved with any optimization algorithm, we consider gradient-based methods. In theorem 1, we show that gradient descent on $\bar { F }$ yields solutions that always lie in $\Theta$ . In principle, $\bar { F }$ can be evaluated at any $\theta ^ { 0 }$ , but a more efficient strategy is to evaluate $\theta ^ { 0 }$ at $\psi ^ { 0 }$ . In this case, $\bar { d } = d$ , so that ${ \bar { F } } = F$ .
|
| 131 |
+
|
| 132 |
+
Theorem 1 (Pull-forward). Define a sequence of initializations $\{ \theta _ { s } ^ { 0 } \} _ { s \in \mathbb { N } } b y$
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\begin{array} { r } { \theta _ { s + 1 } ^ { 0 } = \theta _ { s } ^ { 0 } - \beta _ { s } \nabla \bar { F } ( \theta _ { s } ^ { 0 } ; \Psi _ { s } ) , \qquad \theta ^ { 0 } \in \Theta , } \end{array}
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
with $\psi _ { s } ^ { 0 } = \theta _ { s } ^ { 0 }$ for all s. For $\beta _ { s } > 0$ sufficiently small, there exist learning rates schedules $\{ \alpha _ { \tau } ^ { i } \} _ { i = 1 } ^ { K _ { \tau } }$ for all tasks such that $\theta _ { k \to \infty } ^ { 0 }$ is a limit point in $\Theta$ .
|
| 139 |
+
|
| 140 |
+
Proof: see appendix A. Because the meta gradient requires differentiating the learning process, we must adopt an approximation. In doing so, we obtain a meta-gradient that can be computed analytically on the fly during task training. Differentiating $\bar { F }$ , we have
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\nabla \bar { F } ( \theta ^ { 0 } , \Psi ) = - p \mathbb { E } _ { \tau \sim p ( \tau ) } \left[ \sum _ { i = 0 } ^ { K _ { \tau } - 1 } J _ { \tau } ^ { i } ( \theta _ { \tau } ^ { 0 } ) ^ { T } \left( \Delta f _ { \tau } ^ { i } \nabla f _ { \tau } ( \theta _ { \tau } ^ { i } ) + \Delta \theta _ { \tau } ^ { i } \right) \left( \| \bar { \gamma } _ { \tau } ^ { i + 1 } - \gamma _ { \tau } ^ { i } \| _ { 2 } ^ { p } \right) ^ { p - 2 } \right]
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
where ${ \cal J } _ { \tau } ^ { i }$ denotes the Jacobian of $\theta _ { \tau } ^ { i }$ with respect to the initialization, $\Delta f _ { \tau } ^ { i } = f _ { \tau } ( \psi _ { \tau } ^ { i + 1 } ) - f _ { \tau } ( \theta _ { \tau } ^ { i } )$ and $\Delta \theta _ { \tau } ^ { i ^ { \cdot } } = \psi _ { \tau } ^ { i + 1 } - \theta _ { \tau } ^ { i }$ . To render the meta gradient tractable, we need to approximate the Jacobians, as these are costly to compute. Empirical evidence suggest that they are largely redundant (Finn et al., 2017; Nichol et al., 2018). Nichol et al. (2018) further shows that an identity approximation yields a meta-gradient that remains faithful to the original meta objective. We provide some further support for this approximation (see appendix B). First, we note that the learning rate directly controls the quality of the approximation; for any $K _ { \tau }$ , the identity approximation can be made arbitrarily accurate by choosing a sufficiently small learning rates. We conduct an ablation study to ascertain how severe this limitation is and find that it is relatively loose. For the best-performing learning rate, the identity approximation is accurate to four decimal places and shows no signs of significant deterioration as the number of training steps increases. As such, we assume $J ^ { i } \approx I _ { n }$ throughout. Finally, by evaluating $\nabla \bar { F }$ at $\theta ^ { 0 } = \psi ^ { 0 }$ , the meta gradient contains only terms seen during standard training and can be computed asynchronously on the fly at negligible cost.
|
| 147 |
+
|
| 148 |
+
In practice, we use stochastic gradient descent during task training. This injects noise in $f$ as well as in its gradient, resulting in a noisy gradient path. Noise in the gradient path does not prevent Leap from converging. However, noise reduces the rate of convergence, in particular when a noisy gradient step results in $f _ { \tau } ( \psi _ { \tau } ^ { s + 1 } ) - f _ { \tau } ( \theta _ { \tau } ^ { i } ) > 0$ . If the gradient estimator is reasonably accurate, this causes the term $\Delta f _ { \tau } ^ { i } { \boldsymbol { \nabla } } { \dot { f } } _ { \tau } ( { \dot { \theta } _ { \tau } ^ { i } } )$ in eq. 8 to point in the steepest ascent direction. We found that adding a stabilizer to ensure we always follow the descent direction significantly speeds up convergence and allows us to use larger learning rates. In this paper, we augment $\bar { F }$ with a stabilizer of the form
|
| 149 |
+
|
| 150 |
+
$$
|
| 151 |
+
\begin{array} { r } { \mu \left( f _ { \tau } ( \theta _ { \tau } ^ { i } ) ; f _ { \tau } ( \psi _ { \tau } ^ { i + 1 } ) \right) = \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f } \quad f _ { \tau } ( \psi _ { \tau } ^ { i + 1 } ) \leq f _ { \tau } ( \theta _ { \tau } ^ { i } ) , } \\ { - 2 \big ( f _ { \tau } ( \psi _ { \tau } ^ { i + 1 } ) - f _ { \tau } ( \theta _ { \tau } ^ { i } ) \big ) ^ { 2 } } & { \mathrm { e l s e } . } \end{array} \right. } \end{array}
|
| 152 |
+
$$
|
| 153 |
+
|
| 154 |
+
Adding $\nabla \mu$ (re-scaled if necessary) to the meta-gradient is equivalent to replacing $\Delta f _ { \tau } ^ { i }$ with $- | \Delta f _ { \tau } ^ { i } |$ in eq. 8. This ensures that we never follow $\nabla f _ { \tau } ( \theta _ { \tau } ^ { i } )$ in the ascent direction, instead reinforcing the descent direction at that point. This stabilizer is a heuristic, there are many others that could prove helpful. In appendix C we perform an ablation study and find that the stabilizer is not necessary for Leap to converge, but it does speed up convergence significantly.
|
| 155 |
+
|
| 156 |
+
# 3 RELATED WORK
|
| 157 |
+
|
| 158 |
+
Transfer learning has been explored in a variety of settings, the most typical approach attempting to infuse knowledge in a target model’s parameters by encouraging them to lie close to those of a pretrained source model (Pan & Yang, 2009). Because such approaches can limit knowledge transfer (Higgins et al., 2017; Achille et al., 2018), applying standard transfer learning techniques leads to catastrophic forgetting, by which the model is rendered unable to perform a previously mastered task (McCloskey & Cohen, 1989; Goodfellow et al., 2013). These problems are further accentuated when there is a larger degree of diversity among tasks that push optimal parameterizations further apart. In these cases, transfer learning can in fact be worse than training from scratch.
|
| 159 |
+
|
| 160 |
+
Recent approaches extend standard finetuning by adding regularizing terms to the training objective that encourage the model to learn parameters that both solve a new task and retain high performance on previous tasks. These regularizers operate by protecting the parameters that affect the loss function the most (Miconi et al., 2018; Zenke et al., 2017; Kirkpatrick et al., 2017; Lee et al., 2017; Serrà et al., 2018). Because these approaches use a single model to encode both global task-general information and local task-specific information, they can over-regularize, preventing the model from learning further tasks. More importantly, Schwarz et al. (2018) found that while these approaches mitigate catastrophic forgetting, they are unable to facilitate knowledge transfer on the benchmark they considered. Ultimately, if a single model must encode both task-generic and task-specific information, it must either saturate or grow in size (Rusu et al., 2016).
|
| 161 |
+
|
| 162 |
+
In contrast, meta-learning aims to learn the learning process itself (Schmidhuber, 1987; Bengio et al., 1991; Santoro et al., 2016; Ravi & Larochelle, 2016; Andrychowicz et al., 2016; Vinyals et al., 2016; Finn et al., 2017). The literature focuses primarily on few-shot learning, where a task is some variation on a common theme, such as subsets of classes drawn from a shared pool of data (Lake et al., 2015; Vinyals et al., 2016). The meta-learning algorithm adapts a model to a new task given a handful of samples. Recent attention has been devoted to three main approaches. One trains the meta-learner to adapt to a new task by comparing an input to samples from previous tasks (Vinyals et al., 2016; Mishra et al., 2018; Snell et al., 2017). More relevant to our framework are approaches that parameterize the training process through a recurrent neural network that takes the gradient as input and produces a new set of parameters (Ravi & Larochelle, 2016; Santoro et al., 2016; Andrychowicz et al., 2016; Hochreiter et al., 2001). The approach most closely related to us learns an initialization such that the model can adapt to a new task through one or a few gradient updates (Finn et al., 2017; Nichol et al., 2018; Al-Shedivat et al., 2017; Lee & Choi, 2018). In contrast to our work, these methods focus exclusively on few-shot learning, where the gradient path is trivial as only a single or a handful of training steps are allowed, limiting them to settings where the current task is closely related to previous ones.
|
| 163 |
+
|
| 164 |
+
It is worth noting that the Model Agnostic Meta Learner (MAML: Finn et al., 2017) can be written as $\mathbb { E } _ { \tau \sim p ( \tau ) } \big [ f _ { \tau } ( \theta _ { \tau } ^ { K } ) \big ]$ .1 As such, it arises as a special case of Leap where only the final parameterization is evaluated in terms of its final performance. Similarly, the Reptile algorithm (Nichol et al., 2018), which proposes to update rule $\begin{array} { r } { \Dot { \theta ^ { 0 } } \theta ^ { 0 } + \epsilon ( \mathbb { E } _ { \tau \sim p ( \tau ) } [ \mathcal { \bar { \theta } } _ { \tau } ^ { K } ] - \theta ^ { \hat { 0 } } ) } \end{array}$ , can be seen as a naive version of Leap that assumes all task geometries are Euclidean. In particular, Leap reduces to Reptile if $f _ { \tau }$ is removed from the task manifold and the energy metric without stabilizer is used. We find this configuration to perform significantly worse than any other (see section 4.1 and appendix C).
|
| 165 |
+
|
| 166 |
+

|
| 167 |
+
Figure 3: Results on Omniglot. Left: Comparison of average learning curves on held-out tasks (across 10 seeds) for 25 tasks in the meta-training set. Curves are moving averages with window size 5. Shading: standard deviation within window. Right: AUC across number of tasks in the meta-training set. Shading: standard deviation across 10 seeds.
|
| 168 |
+
|
| 169 |
+
Related work studying models from a geometric perspective have explored how to interpolate in a generative model’s learned latent space (Tosi et al., 2014; Shao et al., 2017; Arvanitidis et al., 2018; Chen et al., 2018; Kumar et al., 2017). Riemann manifolds have also garnered attention in the context of optimization, as a preconditioning matrix can be understood as the instantiation of some Riemann metric (Amari & Nagaoka, 2007; Abbati et al., 2018; Luk & Grosse, 2018).
|
| 170 |
+
|
| 171 |
+
# 4 EMPIRICAL RESULTS
|
| 172 |
+
|
| 173 |
+
We consider three experiments with increasingly complex knowledge transfer. We measure transfer learning in terms of final performance and speed of convergence, where the latter is defined as the area under the training error curve. We compare Leap to competing meta-learning methods on the Omniglot dataset by transferring knowledge across alphabets (section 4.1). We study Leap’s ability to transfer knowledge over more complex and diverse tasks in a Multi-CV experiment (section 4.2) and finally evaluate Leap on in a demanding reinforcement environment (section 4.3).
|
| 174 |
+
|
| 175 |
+
# 4.1 OMNIGLOT
|
| 176 |
+
|
| 177 |
+
The Omniglot (Lake et al., 2015) dataset consists of 50 alphabets, which we define to be distinct tasks. We hold 10 alphabets out for final evaluation and use subsets of the remaining alphabets for metalearning or pretraining. We vary the number of alphabets used for meta-learning / pretraining from 1 to 25 and compare final performance and rate of convergence on held-out tasks. We compare against no pretraining, multi-headed finetuning, MAML, the first-order approximation of MAML (FOMAML; Finn et al., 2017), and Reptile. We train on a given task for 100 steps, with the exception of MAML where we backpropagate through 5 training steps during meta-training. For Leap, we report performance under the length metric $( d _ { 1 } )$ ; see appendix C for an ablation study on Leap hyper-parameters. For further details, see appendix D.
|
| 178 |
+
|
| 179 |
+
Any type of knowledge transfer significantly improves upon a random initialization. MAML exhibits a considerable short-horizon bias (Wu et al., 2018). While FOMAML is trained full trajectories, but because it only leverages gradient information at final iteration, which may be arbitrarily uninformative, it does worse. Multi-headed finetuning is a tough benchmark to beat as tasks are very similar. Nevertheless, for sufficiently rich task distributions, both Reptile and Leap outperform finetuning, with Leap outperforming Reptile as the complexity grows. Notably, the AUC gap between Reptile and Leap grows in the number of training steps (fig. 3), amounting to a 4 percentage point difference in final validation error (table 2). Overall, the relative performance of meta-learners underscores the importance of leveraging geometric information in meta-learning.
|
| 180 |
+
|
| 181 |
+
Table 1: Results on Multi-CV benchmark. All methods are trained until convergence on held-out tasks. Finetuning is multiheaded. † Area under training error curve; scaled to 0–100.‡Our implementation. MNIST results omitted; see appendix E, table 4.
|
| 182 |
+
|
| 183 |
+
<table><tr><td>Held-out task</td><td>Method</td><td>Test (%)</td><td>Train (%)</td><td>AUCt</td></tr><tr><td>Facescrub</td><td>Leap</td><td>19.9</td><td>0.0</td><td>11.6</td></tr><tr><td></td><td>Finetuning</td><td>32.7</td><td>0.0</td><td>13.2</td></tr><tr><td></td><td>Progressive Nets‡</td><td>18.0</td><td>0.0</td><td>8.9</td></tr><tr><td></td><td>HAT‡</td><td>25.6</td><td>0.1</td><td>14.6</td></tr><tr><td></td><td>No pretraining</td><td>18.2</td><td>0.0</td><td>10.5</td></tr><tr><td>Cifar10</td><td>Leap</td><td>21.2</td><td>10.8</td><td>17.5</td></tr><tr><td></td><td>Finetuning</td><td>27.4</td><td>13.3</td><td>20.7</td></tr><tr><td></td><td>Progressive Netst</td><td>24.2</td><td>15.2</td><td>24.0</td></tr><tr><td></td><td>HATt</td><td>27.7</td><td>21.2</td><td>27.3</td></tr><tr><td></td><td>No pretraining</td><td>26.2</td><td>13.1</td><td>23.0</td></tr><tr><td>SVHN</td><td>Leap</td><td>8.4</td><td>5.6</td><td>7.5</td></tr><tr><td></td><td>Finetuning</td><td>10.9</td><td>6.1</td><td>10.5</td></tr><tr><td></td><td>Progressive Netst</td><td>10.1</td><td>6.3</td><td>13.8</td></tr><tr><td></td><td>HAT‡</td><td>10.5</td><td>5.7</td><td>8.5</td></tr><tr><td></td><td>No pretraining</td><td>10.3</td><td>6.9</td><td>11.5</td></tr><tr><td>Cifar100</td><td>Leap</td><td>52.0</td><td>30.5</td><td>43.4</td></tr><tr><td></td><td>Finetuning</td><td>59.2</td><td>31.5</td><td>44.1</td></tr><tr><td></td><td>Progressive Nets‡</td><td>55.7</td><td>42.1</td><td>54.6</td></tr><tr><td></td><td>HATt</td><td>62.0</td><td>49.8</td><td>58.4</td></tr><tr><td></td><td>No pretraining</td><td>54.8</td><td>33.1</td><td>50.1</td></tr><tr><td>Traffic Signs</td><td>Leap</td><td>2.9</td><td>0.0</td><td>1.2</td></tr><tr><td></td><td>Finetuning</td><td>5.7</td><td>0.0</td><td>1.7</td></tr><tr><td></td><td>Progressive Nets‡</td><td>3.6</td><td>0.0</td><td>4.0</td></tr><tr><td></td><td>HATt</td><td>5.4</td><td>0.0</td><td>2.3</td></tr><tr><td></td><td>No pretraining</td><td>3.6</td><td>0.0</td><td>2.4</td></tr></table>
|
| 184 |
+
|
| 185 |
+
# 4.2 MULTI-CV
|
| 186 |
+
|
| 187 |
+
Inspired by Serrà et al. (2018), we consider a set of computer vision datasets as distinct tasks. We pretrain on all but one task, which is held out for final evaluation. For details, see appendix E. To reduce the computational burden during meta training, we pretrain on each task in the meta batch for one epoch using the energy metric $( d _ { 2 } )$ . We found this to reach equivalent performance to training on longer gradient paths or using the length metric. This indicates that it is sufficient for Leap to see a partial trajectory to correctly infer shared structures across task geometries.
|
| 188 |
+
|
| 189 |
+
We compare Leap against a random initialization, multi-headed finetuning, a non-sequential version of HAT (Serrà et al., 2018) (i.e. allowing revisits) and a non-sequential version of Progressive Nets (Rusu et al., 2016), where we allow lateral connection between every task. Note that this makes Progressive Nets over 8 times larger in terms of learnable parameters.
|
| 190 |
+
|
| 191 |
+
The Multi-CV experiment is more challenging both due to greater task diversity and greater complexity among tasks. We report results on held-out tasks in table 1. Leap outperforms all baselines on all but one transfer learning tasks (Facescrub), where Progressive Nets does marginally better than a random initialization owing to its increased parameter count. Notably, while Leap does marginally worse than a random initialization, finetuning and HAT leads to a substantial drop in performance. On all other tasks, Leap converges faster to optimal performance and achieves superior final performance.
|
| 192 |
+
|
| 193 |
+

|
| 194 |
+
Figure 4: Mean normalized episode scores on Atari games across training steps. Shaded regions depict two standard deviations across ten seeds. Leap (orange) generally outperforms a random initialization (blue), even when the action space is twice as large as during pretraining (table 6, appendix F).
|
| 195 |
+
|
| 196 |
+
# 4.3 ATARI
|
| 197 |
+
|
| 198 |
+
To demonstrate that Leap can scale to large problems, both in computational terms and in task complexity, we apply it in a reinforcement learning environment, specifically Atari 2600 games (Bellemare et al., 2013). We use an actor-critic architecture (Sutton et al., 1998) with the policy and the value function sharing a convolutional encoder. We apply Leap with respect to the encoder using the energy metric $( d _ { 2 } )$ . During meta training, we sample mini-batches from 27 games that have an action space dimensionality of at most 10, holding out two games with similar action space dimensionality for evaluation, as well as games with larger action spaces (table 6). During meta-training, we train on each task for five million training steps. See appendix F for details.
|
| 199 |
+
|
| 200 |
+
We train for 100 meta training steps, which is sufficient to see a distinct improvement; we expect a longer meta-training phase to yield further gains. We find that Leap generally outperforms a random initialization. This performance gain is primarily driven by less volatile exploration, as seen by the confidence intervals in fig. 4 (see also fig. 8). Leap finds a useful exploration space faster and more consistently, demonstrating that Leap can find shared structures across a diverse set of complex learning processes. We note that these gains may not cater equally to all tasks. In the case of WizardOfWor (part of the meta-training set), Leap exhibits two modes: in one it performs on par with the baseline, in the other exploration is protracted (fig. 8). This phenomena stems from randomness in the learning process, which renders an observed gradient path relatively less representative. Such randomness can be marginalized by training for longer.
|
| 201 |
+
|
| 202 |
+
That Leap can outperform a random initialization on the pretraining set (AirRaid, UpNDown) is perhaps not surprising. More striking is that it exhibits the same behavior on out-of-distribution tasks. In particular, Alien, Gravitar and RoadRunner all have at least $50 \%$ larger state space than anything encountered during pretraining (appendix F, table 6), yet Leap outperforms a random initialization. This suggests that transferring knowledge at a higher level of abstraction, such as in the space of gradient paths, generalizes to unseen task variations as long as underlying learning dynamics agree.
|
| 203 |
+
|
| 204 |
+
# 5 CONCLUSIONS
|
| 205 |
+
|
| 206 |
+
Transfer learning typically ignores the learning process itself, restricting knowledge transfer to scenarios where target tasks are very similar to source tasks. In this paper, we present Leap, a framework for knowledge transfer at a higher level of abstraction. By formalizing knowledge transfer as minimizing the expected length of gradient paths, we propose a method for meta-learning that scales to highly demanding problems. We find empirically that Leap has superior generalizing properties to finetuning and competing meta-learners.
|
| 207 |
+
|
| 208 |
+
# ACKNOWLEDGMENTS
|
| 209 |
+
|
| 210 |
+
The authors would like to thank anonymous reviewers for their comments. This work was supported by The Alan Turing Institute under the EPSRC grant EP/N510129/1.
|
| 211 |
+
|
| 212 |
+
# REFERENCES
|
| 213 |
+
|
| 214 |
+
Gabriele Abbati, Alessandra Tosi, Michael Osborne, and Seth Flaxman. Adageo: Adaptive geometric learning for optimization and sampling. In International Conference on Artificial Intelligence and Statistics, pp. 226–234, 2018.
|
| 215 |
+
|
| 216 |
+
Alessandro Achille, Tom Eccles, Loic Matthey, Christopher P. Burgess, Nick Watters, Alexander Lerchner, and Irina Higgins. Life-long disentangled representation learning with cross-domain latent homologies. arXiv preprint arXiv:1808.06508, 2018.
|
| 217 |
+
|
| 218 |
+
J Harold Ahlberg, Edwin Norman Nilson, and Joseph Leonard Walsh. The Theory of Splines and Their Applications. Academic Press, 1967. p. 51.
|
| 219 |
+
|
| 220 |
+
Maruan Al-Shedivat, Trapit Bansal, Yuri Burda, Ilya Sutskever, Igor Mordatch, and Pieter Abbeel. Continuous Adaptation via Meta-Learning in Nonstationary and Competitive Environments. In International Conference on Learning Representations, 2017.
|
| 221 |
+
|
| 222 |
+
Shun-Ichi Amari. Natural gradient works efficiently in learning. Neural computation, 10(2):251–276, 1998.
|
| 223 |
+
|
| 224 |
+
Shun-ichi Amari and Hiroshi Nagaoka. Methods of information geometry, volume 191. American Mathematical Society, 2007.
|
| 225 |
+
|
| 226 |
+
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, 2016.
|
| 227 |
+
|
| 228 |
+
Georgios Arvanitidis, Lars Kai Hansen, and Søren Hauberg. Latent Space Oddity: on the Curvature of Deep Generative Models. In International Conference on Learning Representations, 2018.
|
| 229 |
+
|
| 230 |
+
M. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013.
|
| 231 |
+
|
| 232 |
+
Yoshua Bengio, Samy Bengio, and Jocelyn Cloutier. Learning a synaptic learning rule. Université de Montréal, Département d’informatique et de recherche opérationnelle, 1991.
|
| 233 |
+
|
| 234 |
+
Nutan Chen, Alexej Klushyn, Richard Kurle, Xueyan Jiang, Justin Bayer, and Patrick van der Smagt. Metrics for Deep Generative Models. In International Conference on Artificial Intelligence and Statistics, 2018.
|
| 235 |
+
|
| 236 |
+
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks. In International Conference on Machine Learning, 2017.
|
| 237 |
+
|
| 238 |
+
Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In International Conference on Computer Vision and Pattern Recognition, pp. 580–587, 2014.
|
| 239 |
+
|
| 240 |
+
Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211, 2013.
|
| 241 |
+
|
| 242 |
+
Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In International Conference on Computer Vision, pp. 2980–2988, 2017.
|
| 243 |
+
|
| 244 |
+
Irina Higgins, Arka Pal, Andrei A Rusu, Loic Matthey, Christopher P Burgess, Alexander Pritzel, Matthew Botvinick, Charles Blundell, and Alexander Lerchner. Darla: Improving zero-shot transfer in reinforcement learning. arXiv preprint arXiv:1707.08475, 2017.
|
| 245 |
+
|
| 246 |
+
Sepp Hochreiter, A Steven Younger, and Peter R Conwell. Learning to learn using gradient descent. In International Conference on Artificial Neural Networks, 2001.
|
| 247 |
+
|
| 248 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. In International Conference on Learning Representations, 2015.
|
| 249 |
+
|
| 250 |
+
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 2017.
|
| 251 |
+
|
| 252 |
+
Abhishek Kumar, Prasanna Sattigeri, and P Thomas Fletcher. Improved Semi-supervised Learning with GANs using Manifold Invariances. In Advances in Neural Information Processing Systems, 2017.
|
| 253 |
+
|
| 254 |
+
Brenden Lake, Ruslan Salakhutdinov, Jason Gross, and Joshua Tenenbaum. One shot learning of simple visual concepts. In Proceedings of the Annual Meeting of the Cognitive Science Society, 2011.
|
| 255 |
+
|
| 256 |
+
Brenden M. Lake, Ruslan Salakhutdinov, and Joshua B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
|
| 257 |
+
|
| 258 |
+
Sang-Woo Lee, Jin-Hwa Kim, JungWoo Ha, and Byoung-Tak Zhang. Overcoming Catastrophic Forgetting by Incremental Moment Matching. In Advances in Neural Information Processing Systems, 2017.
|
| 259 |
+
|
| 260 |
+
Yoonho Lee and Seungjin Choi. Meta-Learning with Adaptive Layerwise Metric and Subspace. In International Conference on Machine Learning, 2018.
|
| 261 |
+
|
| 262 |
+
Ilya Loshchilov and Frank Hutter. SGDR: stochastic gradient descent with restarts. In International Conference on Learning Representations, 2017.
|
| 263 |
+
|
| 264 |
+
Kevin Luk and Roger Grosse. A coordinate-free construction of scalable natural gradient. arXiv preprint arXiv:1808.10340, 2018.
|
| 265 |
+
|
| 266 |
+
Dhruv Mahajan, Ross B. Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. arXiv preprint arXiv:1805.00932, 2018.
|
| 267 |
+
|
| 268 |
+
James Martens. Deep learning via hessian-free optimization. In International Conference on Machine Learning, 2010.
|
| 269 |
+
|
| 270 |
+
Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of Learning and Motivation, volume 24, pp. 109–165. Elsevier, 1989.
|
| 271 |
+
|
| 272 |
+
Thomas Miconi, Jeff Clune, and Kenneth O. Stanley. Differentiable plasticity: training plastic neural networks with backpropagation. International Conference on Machine Learning, 2018.
|
| 273 |
+
|
| 274 |
+
Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A Simple Neural Attentive Meta-Learner. In International Conference on Learning Representations, 2018.
|
| 275 |
+
|
| 276 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
|
| 277 |
+
|
| 278 |
+
Alex Nichol, Joshua Achiam, and John Schulman. On First-Order Meta-Learning Algorithms. arXiv preprint ArXiv:1803.02999, 2018.
|
| 279 |
+
|
| 280 |
+
Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. IEEE Transactions on Knowledge & Data Engineering, (10):1345–1359, 2009.
|
| 281 |
+
|
| 282 |
+
Razvan Pascanu and Yoshua Bengio. Revisiting natural gradient for deep networks. In International Conference on Learning Representations, 2014.
|
| 283 |
+
|
| 284 |
+
Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In International Conference on Learning Representations, 2016.
|
| 285 |
+
|
| 286 |
+
Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
|
| 287 |
+
|
| 288 |
+
Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In International Conference on Machine Learning, 2016.
|
| 289 |
+
|
| 290 |
+
Jürgen Schmidhuber. Evolutionary principles in self-referential learning. PhD thesis, Technische Universität München, 1987.
|
| 291 |
+
|
| 292 |
+
Jonathan Schwarz, Jelena Luketina, Wojciech M Czarnecki, Agnieszka Grabska-Barwinska, Yee Whye Teh, Razvan Pascanu, and Raia Hadsell. Progress & compress: A scalable framework for continual learning. In International Conference on Machine Learning, 2018.
|
| 293 |
+
|
| 294 |
+
Joan Serrà, Dídac Surís, Marius Miron, and Alexandros Karatzoglou. Overcoming catastrophic forgetting with hard attention to the task. In International Conference on Machine Learning, 2018.
|
| 295 |
+
|
| 296 |
+
Hang Shao, Abhishek Kumar, and P Thomas Fletcher. The Riemannian Geometry of Deep Generative Models. arXiv preprint ArXiv:1711.08014, 2017.
|
| 297 |
+
|
| 298 |
+
Jake Snell, Kevin Swersky, and Richard S Zemel. Prototypical Networks for Few-shot Learning. In Advances in Neural Information Processing Systems, 2017.
|
| 299 |
+
|
| 300 |
+
Richard S Sutton, Andrew G Barto, et al. Reinforcement learning: An introduction. MIT Press, Cambridge, 1998.
|
| 301 |
+
|
| 302 |
+
Alessandra Tosi, Søren Hauberg, Alfredo Vellido, and Neil D Lawrence. Metrics for Probabilistic Geometries. Conference on Uncertainty in Artificial Intelligence, 2014.
|
| 303 |
+
|
| 304 |
+
Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching Networks for One Shot Learning. In Advances in Neural Information Processing Systems, 2016.
|
| 305 |
+
|
| 306 |
+
Yuhuai Wu, Mengye Ren, Renjie Liao, and Roger B. Grosse. Understanding short-horizon bias in stochastic meta-optimization. In International Conference on Learning Representations, 2018.
|
| 307 |
+
|
| 308 |
+
Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual Learning Through Synaptic Intelligence. In International Conference on Machine Learning, 2017.
|
| 309 |
+
|
| 310 |
+
# APPENDIX
|
| 311 |
+
|
| 312 |
+
# A PROOF OF THEOREM 1
|
| 313 |
+
|
| 314 |
+
Proof. We first establish that, for all $s$ ,
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
\begin{array} { r } { \mathbb { E } _ { \tau } d ( \theta _ { s + 1 } ^ { 0 } , M _ { \tau } ) = F ( \theta _ { s + 1 } ^ { 0 } ) = \bar { F } ( \theta _ { s + 1 } ^ { 0 } ; \Psi _ { s + 1 } ) \le \bar { F } ( \theta _ { s } ^ { 0 } ; \Psi _ { s } ) = F ( \theta _ { s } ^ { 0 } ) = \mathbb { E } _ { \tau } d ( \theta _ { s } ^ { 0 } , M _ { \tau } ) , } \end{array}
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
with strict inequality for at least some $s$ . Because $\{ \beta _ { s } \} _ { s = 1 } ^ { \infty }$ satisfies the gradient descent criteria, it follows that the sequence $\{ \theta _ { s } ^ { 0 } \} _ { s = 1 } ^ { \infty }$ is convergent. To complete the proof we must show that this limit point lies in $\Theta$ . To this end, we show that for $\beta _ { s }$ sufficiently small, for all $s$ , $\begin{array} { r } { \operatorname* { l i m } _ { i \to \infty } \theta _ { s + 1 } ^ { i } = } \end{array}$ $\operatorname* { l i m } _ { i \to \infty } \theta _ { s } ^ { i }$ . That is, each updated initialization incrementally reduces the expected gradient path length while converging to the same limit point as $\theta _ { 0 } ^ { 0 }$ . Since $\theta _ { 0 } ^ { 0 } \overset { \cdot } { \in } \Theta$ by assumption, we obtain $\theta _ { s } ^ { 0 } \in \Theta$ for all $s$ as an immediate consequence.
|
| 321 |
+
|
| 322 |
+
To establish $\mathbb { E } _ { \tau } d ( \theta _ { s + 1 } ^ { 0 } , M _ { \tau } ) \le \mathbb { E } _ { \tau } d ( \theta _ { s } ^ { 0 } , M _ { \tau } )$ , with strict inequality for some $s$ , let
|
| 323 |
+
|
| 324 |
+
$$
|
| 325 |
+
\begin{array} { l l } { { z _ { \tau } ^ { i } = ( \theta _ { \tau } ^ { s , i } , f _ { \tau } ( \theta _ { \tau } ^ { s , i } ) ) } } & { { \qquad x _ { \tau } ^ { i } = ( \theta _ { \tau } ^ { s + 1 , i } , f _ { \tau } ( \theta _ { \tau } ^ { s + 1 , i } ) ) } } \\ { { h _ { \tau } ^ { i } = ( \psi _ { \tau } ^ { s , i + 1 } , f _ { \tau } ( \psi _ { \tau } ^ { s , i + 1 } ) ) } } & { { \qquad y _ { \tau } ^ { i } = ( \psi _ { \tau } ^ { s + 1 , i + 1 } , f _ { \tau } ( \psi _ { \tau } ^ { s + 1 , i + 1 } ) ) , } } \end{array}
|
| 326 |
+
$$
|
| 327 |
+
|
| 328 |
+
with $\psi _ { \tau } ^ { s , i + 1 } = \theta _ { \tau } ^ { s , i + 1 }$ . Denote by $\mathbb { E } _ { \tau , i }$ the expectation over gradient paths, $\mathbb { E } _ { \tau \sim p ( \tau ) } \sum _ { i = 1 } ^ { K _ { \tau } }$ . Note that
|
| 329 |
+
|
| 330 |
+
$$
|
| 331 |
+
\begin{array} { c c } { \bar { F } ( \theta _ { s } ^ { 0 } , \Psi _ { s } ) = \mathbb { E } _ { \tau , i } \| h _ { \tau } ^ { i } - z _ { \tau } ^ { i } \| _ { 2 } ^ { p } \qquad } & { \bar { F } ( \theta _ { s } ^ { 0 } , \Psi _ { s + 1 } ) = \mathbb { E } _ { \tau , i } \| y _ { \tau } ^ { i } - z _ { \tau } ^ { i } \| _ { 2 } ^ { p } } \\ { \bar { F } ( \theta _ { s + 1 } ^ { 0 } , \Psi _ { s } ) = \mathbb { E } _ { \tau , i } \| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| _ { 2 } ^ { p } \qquad } & { \bar { F } ( \theta _ { s + 1 } ^ { 0 } , \Psi _ { s + 1 } ) = \mathbb { E } _ { \tau , i } \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| _ { 2 } ^ { p } } \end{array}
|
| 332 |
+
$$
|
| 333 |
+
|
| 334 |
+
with $p = 2$ defining the meta objective in terms of the gradient path energy and $p = 1$ in terms of the gradient path length. As we are exclusively concerned with the Euclidean norm, we omit the subscript. By assumption, every $\beta _ { s }$ is sufficiently small to satisfy the gradient descent criteria $\bar { F } ( \theta _ { s } ^ { 0 } ; \Psi _ { s } ) \overset { * } { \geq } \bar { F } ( \bar { \theta } _ { s + 1 } ^ { 0 } ; \Psi _ { s } ^ { * } )$ . Adding and subtracting $\dot { \bar { F } } ( \theta _ { s + 1 } ^ { 0 } , \Psi _ { s + 1 } )$ to the RHS, we have
|
| 335 |
+
|
| 336 |
+
$$
|
| 337 |
+
\begin{array} { r l } & { \mathbb { E } _ { \tau , i } \| h _ { \tau } ^ { i } - z _ { \tau } ^ { i } \| ^ { p } \geq \mathbb { E } _ { \tau , i } \| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p } } \\ & { \qquad = \mathbb { E } _ { \tau , i } \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p } + \| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p } - \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p } . } \end{array}
|
| 338 |
+
$$
|
| 339 |
+
|
| 340 |
+
It follows that $\begin{array} { r } { \mathbb E _ { \tau } d ( \theta _ { s } ^ { 0 } , M _ { \tau } ) \ge \mathbb E _ { \tau } d ( \theta _ { s + 1 } ^ { 0 } , M _ { \tau } ) } \end{array}$ if $\mathbb { E } _ { \tau , i } \| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p } \geq \mathbb { E } _ { \tau , i } \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p }$ . As our main concern is existence, we will show something stronger, namely that there exists $\alpha _ { \tau } ^ { i }$ such that
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\begin{array} { r } { \| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p } \geq \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p } \qquad \forall i , \tau , s , p } \end{array}
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
with at least one such inequality strict for some $i , \tau , s$ , in which case ${ d _ { p } } ( { \theta _ { s + 1 } ^ { 0 } } , { M _ { \tau } } ) < { d _ { p } } ( { \theta _ { s } ^ { 0 } } , { M _ { \tau } } )$ for any $p \in \{ 1 , 2 \}$ . We proceed by establishing the inequality for $p = 2$ and obtain $p = 1$ as an immediate consequence of monotonicity of the square root. Expanding $\| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 }$ we have
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\begin{array} { r l } & { \| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } - \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } = \| ( h _ { \tau } ^ { i } - z _ { \tau } ^ { i } ) + ( z _ { \tau } ^ { i } - x _ { \tau } ^ { i } ) \| ^ { 2 } - \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } } \\ & { \qquad = \| h _ { \tau } ^ { i } - z _ { \tau } ^ { i } \| ^ { 2 } + 2 \langle h _ { \tau } ^ { i } - z _ { \tau } ^ { i } , z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rangle + \| z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } - \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } . } \end{array}
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
Every term except $\lVert z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rVert ^ { 2 }$ can be minimized by choosing $\alpha _ { \tau } ^ { i }$ small, whereas $\lVert z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rVert ^ { 2 }$ is controlled by $\beta _ { s }$ . Thus, our strategy is to make all terms except $\lVert \dot { z } _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rVert ^ { 2 }$ small, for a given $\beta _ { s }$ , by placing an upper bound on $\alpha _ { \tau } ^ { i }$ . We first show that $\| h _ { \tau } ^ { i } - z _ { \tau } ^ { i } \| ^ { 2 } - \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } = O \left( \alpha _ { \tau } ^ { i } { } ^ { 2 } \right)$ . Some care is needed as the $( n + 1 )$ th dimension is the loss value associated with the other $n$ dimensions. Define $\hat { z } _ { \tau } ^ { i } = \theta _ { \tau } ^ { s , i }$ , so that $z _ { \tau } ^ { i } = ( \hat { z } _ { \tau } ^ { i } , f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) )$ . Similarly define $\hat { x } _ { \tau } ^ { i } , \hat { h } _ { \tau } ^ { i }$ , and $\hat { y } _ { \tau } ^ { i }$ to obtain
|
| 353 |
+
|
| 354 |
+
$$
|
| 355 |
+
\begin{array} { r l } & { \| h _ { \tau } ^ { i } - z _ { \tau } ^ { i } \| ^ { 2 } = \| \hat { h } _ { \tau } ^ { i } - \hat { z } _ { \tau } ^ { i } \| ^ { 2 } + \big ( f _ { \tau } ( \hat { h } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) \big ) ^ { 2 } } \\ & { \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } = \| \hat { y } _ { \tau } ^ { i } - \hat { x } _ { \tau } ^ { i } \| ^ { 2 } + \big ( f _ { \tau } ( \hat { y } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { x } _ { \tau } ^ { i } ) \big ) ^ { 2 } } \\ & { 2 \langle h _ { \tau } ^ { i } - z _ { \tau } ^ { i } , z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rangle = 2 \langle \hat { h } _ { \tau } ^ { i } - \hat { z } _ { \tau } ^ { i } , \hat { z } _ { \tau } ^ { i } - \hat { x } _ { \tau } ^ { i } \rangle + \big ( f _ { \tau } ( \hat { h } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) \big ) \big ( f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { x } _ { \tau } ^ { i } ) \big ) . } \end{array}
|
| 356 |
+
$$
|
| 357 |
+
|
| 358 |
+
Consider $\lVert \hat { h } _ { \tau } ^ { i } - \hat { z } _ { \tau } ^ { i } \rVert ^ { 2 } - \lVert \hat { y } _ { \tau } ^ { i } - \hat { x } _ { \tau } ^ { i } \rVert ^ { 2 } \mathrm { . }$ . Note that $\hat { h } _ { \tau } ^ { i } = \hat { z } _ { \tau } ^ { i } - \alpha _ { \tau } ^ { i } g ( \hat { z } _ { \tau } ^ { i } )$ , where $g ( \hat { z } _ { \tau } ^ { i } ) = S _ { \tau } ^ { s , i } \nabla f ( \hat { z } _ { \tau } ^ { i } )$ , and similarly $\hat { y } _ { \tau } ^ { i } = \hat { x } _ { \tau } ^ { i } - \alpha _ { \tau } ^ { i } g ( \hat { x } _ { \tau } ^ { i } )$ with $g ( \hat { x } _ { \tau } ^ { i } ) = S _ { \tau } ^ { s + 1 , i } \nabla f ( \hat { x } _ { \tau } ^ { i } )$ . Thus, $\| \hat { h } _ { \tau } ^ { i } - \hat { z } _ { \tau } ^ { i } \| ^ { 2 } = { \alpha _ { \tau } ^ { i } } ^ { 2 } \| g ( \hat { z } _ { \tau } ^ { i } ) \| ^ { 2 }$ and similarly for $\| \hat { y } _ { \tau } ^ { i } - \hat { x } _ { \tau } ^ { i } \| ^ { 2 }$ , so
|
| 359 |
+
|
| 360 |
+
$$
|
| 361 |
+
\| \hat { h } _ { \tau } ^ { i } - \hat { z } _ { \tau } ^ { i } \| ^ { 2 } - \| \hat { y } _ { \tau } ^ { i } - \hat { x } _ { \tau } ^ { i } \| ^ { 2 } = \left( \alpha _ { \tau } ^ { i } \right) ^ { 2 } \left( \| g ( \hat { z } _ { \tau } ^ { i } ) \| ^ { 2 } - \| g ( \hat { x } _ { \tau } ^ { i } ) \| ^ { 2 } \right) = O \left( \left( \alpha _ { \tau } ^ { i } \right) ^ { 2 } \right) .
|
| 362 |
+
$$
|
| 363 |
+
|
| 364 |
+
Now consider $\left( f _ { \tau } ( \hat { h } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) \right) ^ { 2 } - \left( f _ { \tau } ( \hat { y } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { x } _ { \tau } ^ { i } ) \right) ^ { 2 }$ . Using the above identities and first-order Taylor series expansion, we have
|
| 365 |
+
|
| 366 |
+
$$
|
| 367 |
+
\begin{array} { r l } & { \left( f _ { \tau } ( \hat { h } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) \right) ^ { 2 } = \left( \nabla f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) ^ { T } ( \hat { h } _ { \tau } ^ { i } - \hat { z } _ { \tau } ^ { i } ) + O \left( \alpha _ { \tau } ^ { i } \right) \right) ^ { 2 } } \\ & { \qquad = \left( - \alpha _ { \tau } ^ { i } \nabla f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) ^ { T } g ( \hat { z } _ { \tau } ^ { i } ) + O \left( \alpha _ { \tau } ^ { i } \right) \right) ^ { 2 } = O \left( \left( \alpha _ { \tau } ^ { i } \right) ^ { 2 } \right) , } \end{array}
|
| 368 |
+
$$
|
| 369 |
+
|
| 370 |
+
and similarly for $\left( f _ { \tau } ( \hat { y } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { x } _ { \tau } ^ { i } ) \right) ^ { 2 }$ . As such, $\| h _ { \tau } ^ { i } - z _ { \tau } ^ { i } \| ^ { 2 } - \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } = O \Big ( \big ( \alpha _ { \tau } ^ { i } \big ) ^ { 2 } \Big ) .$
|
| 371 |
+
|
| 372 |
+
Finally, consider the inner product $\langle h _ { \tau } ^ { i } - z _ { \tau } ^ { i } , z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rangle$ . From above we have that $( f _ { \tau } ( \hat { h } _ { \tau } ^ { i } ) - f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) ) ^ { 2 } =$ $- \alpha _ { \tau } ^ { i } ( \dot { \nabla } f _ { \tau } ( \hat { z } _ { \tau } ^ { i } ) ^ { T } g ( \hat { z } _ { \tau } ^ { i } ) - \dot { R _ { \tau } ^ { i } } ) = - \dot { \alpha } _ { \tau } ^ { i } \dot { \xi } _ { \tau } ^ { i }$ , where $R _ { \tau } ^ { i }$ denotes an upper bound on the residual. We extend $g$ to operate on $z _ { \tau } ^ { i }$ by defining $\tilde { g } ( z _ { \tau } ^ { i } ) \dot { = } ( g ( \hat { z } _ { \tau } ^ { i } ) , \xi _ { \tau } ^ { i } )$ . Returning to $\| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } - \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 }$ , we have
|
| 373 |
+
|
| 374 |
+
$$
|
| 375 |
+
\begin{array} { r l r } & { } & { \| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } - \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } = \| z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } + 2 \langle h _ { \tau } ^ { i } - z _ { \tau } ^ { i } , z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rangle + O \left( \left( \alpha _ { \tau } ^ { i } \right) ^ { 2 } \right) } \\ & { } & { = \| z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } - 2 \alpha _ { \tau } ^ { i } \langle \tilde { g } ( z _ { \tau } ^ { i } ) , z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rangle + O \left( \left( \alpha _ { \tau } ^ { i } \right) ^ { 2 } \right) . } \end{array}
|
| 376 |
+
$$
|
| 377 |
+
|
| 378 |
+
The first term is non-negative, and importantly, always non-zero whenever $\beta _ { s } \neq 0$ . Furthermore, $\alpha _ { \tau } ^ { i }$ can always be made sufficiently small for $\lVert z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rVert ^ { 2 }$ to dominate the residual, so we can focus on the inner product $\langle \tilde { g } ( z _ { \tau } ^ { i } ) , \dot { z } _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rangle$ . If it is negative, all terms are positive and we have $\| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } \geq \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 }$ as desired. If not, $\| z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { \breve { 2 } }$ dominates if
|
| 379 |
+
|
| 380 |
+
$$
|
| 381 |
+
\alpha _ { \tau } ^ { i } \leq \frac { \| z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } } { 2 \langle \tilde { g } ( z _ { \tau } ^ { i } ) , z _ { \tau } ^ { i } - x _ { \tau } ^ { i } \rangle } \in ( 0 , \infty ) .
|
| 382 |
+
$$
|
| 383 |
+
|
| 384 |
+
Thus, for $\alpha _ { \tau } ^ { i }$ sufficiently small, we have $\| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } \geq \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } \forall i , \tau , s$ , with strict inequality whenever $\langle \dot { \tilde { g } } ( z _ { \tau } ^ { i } ) , z _ { \tau } ^ { i } - \dot { x } _ { \tau } ^ { i } \rangle < 0$ or the bound on $\alpha _ { \tau } ^ { \ i }$ holds strictly. This establishes $d _ { 2 } ( \theta _ { s + 1 } ^ { 0 } , \bar { M } _ { \tau } ) \stackrel { . } { \leq }$ $d _ { 2 } ( \theta _ { s } ^ { 0 } , M _ { \tau } )$ for all $\tau , s$ , with strict inequality for at least some $\tau , s$ . To also establish it for the gradient path length $\gamma = 1 \gamma$ ), taking square roots on both sides of $\| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 } \geq \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { 2 }$ yields the desired results, and so $\| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { - } \dot { \geq } \| y _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p }$ for $p \in \{ 1 , 2 \}$ , and therefore
|
| 385 |
+
|
| 386 |
+
$$
|
| 387 |
+
d ( \theta _ { s + 1 } ^ { 0 } , M _ { \tau } ) = \bar { F } ( \theta _ { s + 1 } ^ { 0 } ; \Psi _ { s + 1 } ) \leq \bar { F } ( \theta _ { s } ^ { 0 } ; \Psi _ { s } ) = d ( \theta _ { s } ^ { 0 } , M _ { \tau } ) \quad \forall \tau , s
|
| 388 |
+
$$
|
| 389 |
+
|
| 390 |
+
with strict inequality for at least some $\tau , s$ , in particular whenever $\beta _ { s } \neq 0$ and $\alpha _ { \tau } ^ { i }$ sufficiently small.
|
| 391 |
+
|
| 392 |
+
Then, to see that the limit point of $\Psi _ { s + 1 }$ is the same as that of $\Psi _ { s }$ for $\beta _ { s }$ sufficiently small, note that $x _ { \tau } ^ { i } = y _ { \tau } ^ { i - 1 }$ . As before, by the gradient descent criteria, $\beta _ { s }$ is such that
|
| 393 |
+
|
| 394 |
+
$$
|
| 395 |
+
\begin{array} { r } { \mathbb { E } _ { \tau , i } \| h _ { \tau } ^ { i } - x _ { \tau } ^ { i } \| ^ { p } = \mathbb { E } _ { \tau , i } \| h _ { \tau } ^ { i } - y _ { \tau } ^ { i - 1 } \| ^ { p } \leq \mathbb { E } _ { \tau , i } \| h _ { \tau } ^ { i } - z _ { \tau } ^ { i } \| ^ { p } = \mathbb { E } _ { \tau , i } \left( \alpha _ { \tau } ^ { i } \right) ^ { p } \| \tilde { g } ( z _ { \tau } ^ { i } ) \| ^ { p } . } \end{array}
|
| 396 |
+
$$
|
| 397 |
+
|
| 398 |
+
Define $\epsilon _ { \tau } ^ { i }$ as the noise residual from the expectation; each $y _ { \tau } ^ { i - 1 }$ is bounded by $\| h _ { \tau } ^ { i } - y _ { \tau } ^ { i - 1 } \| ^ { p } \leq$ $\begin{array} { r } { \big ( \alpha _ { \tau } ^ { i } \big ) ^ { p } \| \tilde { g } ( z _ { \tau } ^ { i } ) \| ^ { p } + \epsilon _ { \tau } ^ { i } } \end{array}$ . For $\beta _ { s }$ small this noise component vanishes, and since $\{ \alpha _ { \tau } ^ { i } \} _ { i }$ is a converging sequence, the bound on $y _ { \tau } ^ { i - 1 }$ grows increasingly tight. It follows then that $\left\{ \theta _ { s + 1 } ^ { i } \right\} _ { i = 1 } ^ { \infty }$ converges to the same limit point as $\{ \theta _ { s } ^ { i } \} _ { i = 1 } ^ { \infty }$ , yielding $\theta _ { s + 1 } ^ { 0 } \in \Theta$ for all $s$ , as desired.
|
| 399 |
+
|
| 400 |
+
# B ABLATION STUDY: APPROXIMATING JACOBIANS $J ^ { i } ( \theta ^ { 0 } )$
|
| 401 |
+
|
| 402 |
+
To understand the role of the Jacobians, note that (we drop task subscripts for simplicity)
|
| 403 |
+
|
| 404 |
+
$$
|
| 405 |
+
\begin{array} { l } { { J ^ { i + 1 } ( \theta ^ { 0 } ) = \left( I _ { n } - \alpha ^ { i } S ^ { i } H _ { f } ( \theta ^ { i } ) \right) J ^ { i } ( \theta ^ { 0 } ) = \displaystyle \prod _ { j = 0 } ^ { i } \left( I _ { n } - \alpha ^ { j } S ^ { j } H _ { f } ( \theta ^ { j } ) \right) } } \\ { { \displaystyle ~ = I _ { n } - \sum _ { j = 0 } ^ { i } \alpha ^ { i } S ^ { i } H _ { f } ( \theta ^ { i } ) + O \left( \left( \alpha ^ { i } \right) ^ { 2 } \right) , } } \end{array}
|
| 406 |
+
$$
|
| 407 |
+
|
| 408 |
+
where $H _ { f } ( \theta ^ { j } )$ denotes the Hessian of $f$ at $\theta ^ { j }$ . Thus, changes to $\theta ^ { i + 1 }$ are translated into $\theta ^ { 0 }$ via all intermediary Hessians. This makes the Jacobians memoryless up to second-order curvature. Importantly, the effect of curvature can directly be controlled via $\alpha ^ { i }$ , and by choosing $\alpha ^ { i }$ small we can ensure $J ^ { i } ( \theta ^ { 0 } ) \approx I _ { n }$ to be a arbitrary precision. In practice, this approximation works well (c.f. Finn et al., 2017; Nichol et al., 2018). Moreover, as a practical matter, if the alternative is some other approximation to the Hessians, the amount of noise injected grows exponentially with every iteration. The problem of devising an accurate low-variance estimator for the ${ \hat { J ^ { i } } } ( \theta ^ { 0 } )$ is highly challenging and beyond the scope of this paper.
|
| 409 |
+
|
| 410 |
+

|
| 411 |
+
Figure 5: Relative precision of Jacobian approximation. Precision is calculated for the Jacobian of the first layer, across different learning rates (colors) and gradient steps.
|
| 412 |
+
|
| 413 |
+
To understand how this approximation limits our choice of learning rates $\alpha ^ { i }$ , we conduct an ablation study in the Omniglot experiment setting. We are interested in the relative precision of the identity approximation under different learning rates and across time steps, which we define as
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
\rho \left( i , \{ \alpha ^ { j } \} _ { j = 0 } ^ { i } \right) = \frac { \| I _ { n } - J ^ { i } ( \theta ^ { 0 } ) \| _ { 1 } } { \| J ^ { i } ( \theta ^ { 0 } ) \| _ { 1 } } ,
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
where the norm is the Schatten 1-norm. We use the same four-layer convolutional neural network as in the Omniglot experiment (appendix D). For each choice of learning rate, we train a model from a random initialization for 20 steps and compute $\rho$ every 5 steps. Due to exponential growth of memory consumption, we were unable to compute $\rho$ for more than 20 gradient steps. We report the relative precision of the first convolutional layer. We do not report the Jacobian with respect to other layers, all being considerably larger, as computing their Jacobians was too costly. We computed $\rho$ for all layers on the first five gradient steps and found no significant variation in precision across layers. Consequently, we prioritize reporting how precision varies with the number of gradient steps. As in the main experiments, we use stochastic gradient descent. We evaluate $\alpha ^ { i } = \overline { { \alpha } } \in \{ 0 . 0 1 , \mathrm { { 0 . 1 } , 0 . 5 } \}$ across 5 different tasks. Figure 5 summarizes our results.
|
| 420 |
+
|
| 421 |
+

|
| 422 |
+
Figure 6: Average task training loss over meta-training steps. $p$ denotes the $\bar { d } _ { p }$ used in the meta objective, $\mu = 1$ the use of the stabilizer, and $f _ { \tau } = 1$ the inclusion of the loss in the task manifold.
|
| 423 |
+
|
| 424 |
+
Reassuringly, we find the identity approximation to be accurate to at least the fourth decimal for learning rates we use in practice, and to the third decimal for the largest learning rate (0.5) we were able to converge with. Importantly, except for the smallest learning rate, the quality of the approximation is constant in the number of gradient steps. The smallest learning rate that exhibits some deterioration on the fifth decimal, however larger learning rates provide an upper bound that is constant on the fourth decimal, indicating that this is of minor concern. Finally, we note that while these results suggest the identity approximation to be a reasonable approach on the class of problems we consider, other settings may put stricter limits on the effective size of learning rates.
|
| 425 |
+
|
| 426 |
+
# C ABLATION STUDY: LEAP HYPER-PARAMETERS
|
| 427 |
+
|
| 428 |
+
As Leap is a general framework, we have several degrees of freedom in specifying a meta learner. In particular, we are free to choose the task manifold structure, the gradient path distance metric, $d _ { p }$ , and whether to incorporate stabilizers. These are non-trivial choices and to ascertain the importance of each, we conduct an ablation study. We vary (a) the task manifold between using the full loss surface and only parameter space, (b) the gradient path distance metric between using the energy or length, and (c) inclusion of the stabilizer $\mu$ in the meta objective. We stay as close as possible to the set-up used in the Omniglot experiment (appendix D), fixing the number of pretraining tasks to 20 and perform 500 meta gradient updates. All other hyper-parameters are the same.
|
| 429 |
+
|
| 430 |
+
Our ablation study indicates that the richer the task manifold and the more accurate the gradient path length is approximated, the better Leap performs (fig. 6). Further, adding a stabilizer has the intended effect and leads to significantly faster convergence. The simplest configuration, defined in terms of the gradient path energy and with the task manifold identifies as parameter space, yields a meta gradient equivalent to the update rule used in Reptile. We find this configuration to be less efficient in terms of convergence and we observe a significant deterioration in performance. Extending the task manifold to the loss surface does not improve meta-training convergence speed, but does cut prediction error in half. Adding the stabilizer significantly speeds up convergence. These conclusions also hold under the gradient path length as distance measure, and in general using the gradient path length does better than using the gradient path energy as the distance measure.
|
| 431 |
+
|
| 432 |
+
D EXPERIMENT DETAILS: OMNIGLOT
|
| 433 |
+
|
| 434 |
+
Table 2: Mean test error after 100 training steps on held out evaluation tasks.†Multi-headed finetuning.
|
| 435 |
+
|
| 436 |
+
<table><tr><td>Method No. Pretraining tasks</td><td>Leap</td><td>Reptile</td><td>Finetuningt</td><td>MAML</td><td>FOMAML</td><td>No pretraining</td></tr><tr><td>1</td><td>62.3</td><td>59.8</td><td>46.5</td><td>64.0</td><td>64.5</td><td>82.3</td></tr><tr><td>3</td><td>46.5</td><td>46.5</td><td>36.0</td><td>56.2</td><td>59.0</td><td>82.3</td></tr><tr><td>5</td><td>40.3</td><td>41.4</td><td>32.5</td><td>50.1</td><td>53.0</td><td>82.5</td></tr><tr><td>10</td><td>32.6</td><td>35.6</td><td>28.7</td><td>49.3</td><td>49.6</td><td>82.9</td></tr><tr><td>15</td><td>29.6</td><td>33.3</td><td>26.9</td><td>45.5</td><td>47.8</td><td>82.6</td></tr><tr><td>20</td><td>26.0</td><td>30.8</td><td>24.7</td><td>41.7</td><td>45.4</td><td>82.6</td></tr><tr><td>25</td><td>24.8</td><td>29.4</td><td>23.5</td><td>42.9</td><td>44.0</td><td>82.8</td></tr></table>
|
| 437 |
+
|
| 438 |
+
Table 3: Summary of hyper-parameters for Omniglot. “Meta” refers to the outer training loop, “task” refers to the inner training loop.
|
| 439 |
+
|
| 440 |
+
<table><tr><td></td><td>Leap</td><td>Finetuning</td><td>Reptile</td><td>MAML</td><td>FOMAML</td><td>No pretraining</td></tr><tr><td colspan="7">Meta training</td></tr><tr><td>Learning rate</td><td>0.1</td><td></td><td>0.1</td><td>0.5</td><td>0.5</td><td></td></tr><tr><td>Training steps</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td><td></td></tr><tr><td>Batch size (tasks)</td><td>20</td><td>20</td><td>20</td><td>20</td><td>20</td><td></td></tr><tr><td colspan="7">Task training</td></tr><tr><td>Learning rate</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td></td></tr><tr><td>Training steps</td><td>100</td><td>100</td><td>100</td><td>5</td><td>100</td><td></td></tr><tr><td>Batch size (samples)</td><td>20</td><td>20</td><td>20</td><td>20</td><td>20</td><td></td></tr><tr><td colspan="7">Task evaluation</td></tr><tr><td>Learning rate</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Training steps</td><td>100</td><td>100</td><td>100</td><td>100</td><td>100</td><td>100</td></tr><tr><td>Batch size (samples)</td><td>20</td><td>20</td><td>20</td><td>20</td><td>20</td><td>20</td></tr></table>
|
| 441 |
+
|
| 442 |
+
Omniglot contains 50 alphabets, each with a set of characters that in turn have 20 unique samples. We treat each alphabet as a distinct task and pretrain on up to 25 alphabets, holding out 10 out for final evaluation. We use data augmentation on all tasks to render the problem challenging. In particular, we augment any image with a random affine transformation by (a) random sampling a scaling factor between [0.8, 1.2], (b) random rotation between [0, 360), and (c) randomly cropping the height and width by a factor between $[ - 0 . 2 , 0 . 2 ]$ in each dimension. This setup differs significantly from previous protocols (Vinyals et al., 2016; Finn et al., 2017), where tasks are defined by selecting different permutations of characters and restricting the number of samples available for each character.
|
| 443 |
+
|
| 444 |
+
We use the same convolutional neural network architecture as in previous works (Vinyals et al., 2016; Schwarz et al., 2018). This model stacks a module, comprised of a $3 \times 3$ convolution with 64 filters, followed by batch-normalization, ReLU activation and $2 \times 2$ max-pooling, four times. All images are downsampled to $2 8 \times 2 8$ , resulting in a $1 \times 1 \times 6 4$ feature map that is passed on to a final linear layer. We define a task as a 20-class classification problem with classes drawn from a distinct alphabet. For alphabets with more than 20 characters, we pick 20 characters at random, alphabets with fewer characters (4) are dropped from the task set. On each task, we train a model using stochastic gradient descent. For each model, we evaluated learning rates in the range [0.001, 0.01, 0.1, 0.5]; we found 0.1 to be the best choice in all cases. See table 3 for further hyper-parameters.
|
| 445 |
+
|
| 446 |
+
Table 4: Transfer learning results on Multi-CV benchmark. All methods are trained until convergence on held-out tasks. †Area under training error curve; scaled to 0–100. ‡Our implementation.
|
| 447 |
+
|
| 448 |
+
<table><tr><td>Held-out task</td><td>Method</td><td>Test (%)</td><td>Train (%)</td><td>AUCt</td></tr><tr><td>Facescrub</td><td>Leap</td><td>19.9</td><td>0.0</td><td>11.6</td></tr><tr><td></td><td>Finetuning</td><td>32.7</td><td>0.0</td><td>13.2</td></tr><tr><td></td><td>Progressive Netst</td><td>18.0</td><td>0.0</td><td>8.9</td></tr><tr><td></td><td>HAT</td><td>25.6</td><td>0.1</td><td>14.6</td></tr><tr><td></td><td> No pretraining</td><td>18.2</td><td>0.0</td><td>10.5</td></tr><tr><td>NotMNIST</td><td>Leap</td><td>5.3</td><td>0.6</td><td>2.9</td></tr><tr><td></td><td>Finetuning</td><td>5.4</td><td>2.0</td><td>4.4</td></tr><tr><td></td><td>Progressive Netst</td><td>5.4</td><td>3.1</td><td>3.7</td></tr><tr><td></td><td>HAT</td><td>6.0</td><td>2.8</td><td>5.4</td></tr><tr><td></td><td> No pretraining</td><td>5.4</td><td>2.6</td><td>5.1</td></tr><tr><td>MNIST</td><td>Leap</td><td>0.7</td><td>0.1</td><td>0.6</td></tr><tr><td></td><td>Finetuning</td><td>0.9</td><td>0.1</td><td>0.8</td></tr><tr><td></td><td>Progressive Netst</td><td>0.8</td><td>0.0</td><td>0.7</td></tr><tr><td></td><td>HAT</td><td>0.8</td><td>0.3</td><td>1.2</td></tr><tr><td></td><td> No pretraining</td><td>0.9</td><td>0.2</td><td>1.0</td></tr><tr><td>Fashion MNIST</td><td>Leap</td><td>8.0</td><td>4.2</td><td>6.8</td></tr><tr><td></td><td>Finetuning</td><td>8.9</td><td>3.8</td><td>7.0</td></tr><tr><td></td><td>Progressive Netst</td><td>8.7</td><td>5.4</td><td>9.2</td></tr><tr><td></td><td>HAT</td><td>9.5</td><td>5.5</td><td>8.1</td></tr><tr><td></td><td>No pretraining</td><td>8.4</td><td>4.7</td><td>7.8</td></tr><tr><td>Cifar10</td><td>Leap</td><td>21.2</td><td>10.8</td><td>17.5</td></tr><tr><td></td><td>Finetuning</td><td>27.4</td><td>13.3</td><td>20.7</td></tr><tr><td></td><td>Progressive Netst</td><td>24.2</td><td>15.2</td><td>24.0</td></tr><tr><td></td><td>HAT</td><td>27.7</td><td>21.2</td><td>27.3</td></tr><tr><td></td><td> No pretraining</td><td>26.2</td><td>13.1</td><td>23.0</td></tr><tr><td>SVHN</td><td>Leap</td><td>8.4</td><td>5.6</td><td>7.5</td></tr><tr><td></td><td>Finetuning</td><td>10.9</td><td>6.1</td><td>10.5</td></tr><tr><td></td><td>Progressive Netst</td><td>10.1</td><td>6.3</td><td>13.8</td></tr><tr><td></td><td>HAT+</td><td>10.5</td><td>5.7</td><td>8.5</td></tr><tr><td></td><td> No pretraining</td><td>10.3</td><td>6.9</td><td>11.5</td></tr><tr><td>Cifar100</td><td>Leap</td><td>52.0</td><td>30.5</td><td>43.4</td></tr><tr><td></td><td>Finetuning</td><td>59.2</td><td>31.5</td><td>44.1</td></tr><tr><td></td><td>Progressive Nets‡</td><td>55.7</td><td>42.1</td><td>54.6</td></tr><tr><td></td><td>HATt</td><td>62.0</td><td>49.8</td><td>58.4</td></tr><tr><td></td><td>No pretraining</td><td>54.8</td><td>33.1</td><td>50.1</td></tr><tr><td>Traffic Signs</td><td>Leap</td><td>2.9</td><td>0.0</td><td>1.2</td></tr><tr><td></td><td>Finetuning</td><td>5.7</td><td>0.0</td><td>1.7</td></tr><tr><td></td><td>Progressive Netst</td><td>3.6</td><td>0.0</td><td>4.0</td></tr><tr><td></td><td>HAT‡</td><td>5.4</td><td>0.0</td><td>2.3</td></tr><tr><td></td><td>No pretraining</td><td>3.6</td><td>0.0</td><td>2.4</td></tr></table>
|
| 449 |
+
|
| 450 |
+
We meta-train for 1000 steps unless otherwise noted; on each task we train for 100 steps. Increasing the number of steps used for task training yields similar results, albeit at greater computational expense. For each character in an alphabet, we hold out 5 samples in order to create a task validation set.
|
| 451 |
+
|
| 452 |
+
Table 5: Summary of hyper-parameters for Multi-CV.“Meta” refers to the outer training loop, ‘task” refers to the inner training loop.
|
| 453 |
+
|
| 454 |
+
<table><tr><td></td><td>Leap</td><td>Finetuning</td><td>Progressive Nets</td><td>HAT</td><td>No pretraining</td></tr><tr><td>Meta training</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Learning rate</td><td>0.01</td><td></td><td></td><td></td><td></td></tr><tr><td>Training steps</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td><td></td></tr><tr><td>Batch size</td><td>10</td><td>10</td><td>10</td><td>10</td><td></td></tr><tr><td>Task training</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Learning rate</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td></td></tr><tr><td>Max epochs</td><td>1</td><td>1</td><td>1</td><td>1</td><td></td></tr><tr><td>Batch size</td><td>32</td><td>32</td><td>32</td><td>32</td><td></td></tr><tr><td>Task evaluation</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Learning rate</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Training epochs</td><td>100</td><td>100</td><td>100</td><td>100</td><td>100</td></tr><tr><td>Batch size</td><td>32</td><td>32</td><td>32</td><td>32</td><td>32</td></tr></table>
|
| 455 |
+
|
| 456 |
+
# E EXPERIMENT DETAILS: MULTI-CV
|
| 457 |
+
|
| 458 |
+
We allow different architectures between tasks by using different final linear layers for each task. We use the same convolutional encoder as in the Omniglot experiment (appendix D). Leap learns an initialization for the convolutional encoder; on each task, the final linear layer is always randomly initialized. We compare Leap against (a) a baseline with no pretraining, (b) multitask finetuning, (c) HAT (Serrà et al., 2018), and (d) Progressive Nets (Rusu et al., 2016). For HAT, we use the original formulation, but allow multiple task revisits (until convergence). For Progressive Nets, we allow lateral connections between all tasks and multiple task revisits (until convergence). Note that this makes Progressive Nets over 8 times larger in terms of learnable parameters than the other models. inproceedings We train using stochastic gradient descent with cosine annealing (Loshchilov & Hutter, 2017). During meta training, we sample a batch of 10 tasks at random from the pretraining set and train until the early stopping criterion is triggered or the maximum amount of epochs is reached (see table 5). We used the same interval for selecting learning rates as in the Omniglot experiment (appendix D). Only Leap benefited from using more than 1 epoch as the upper limit on task training steps during pretraining. In the case of Leap, the initialization is updated after all tasks in the meta batch has been trained to convergence; for other models, there is no distinction between initialization and task parameters. On a given task, training is stopped if the maximum number of epochs is reached (table 5) or if the validation error fails to improve over 10 consecutive gradient steps. Similarly, meta training is stopped once the mean validation error fails to improve over 10 consecutive meta training batches. We use Adam (Kingma & Ba, 2015) for the meta gradient update with a constant learning rate of 0.01. We use no dataset augmentation. MNIST images are zero padded to have $3 2 \times 3 2$ images; we use the same normalizations as Serrà et al. (2018).
|
| 459 |
+
|
| 460 |
+
# F EXPERIMENT DETAILS: ATARI
|
| 461 |
+
|
| 462 |
+
We use the same network as in Mnih et al. (2013), adopting it to actor-critic algorithms by estimating both value function and policy through linear layers connected to the final output of a shared convolutional network. Following standard practice, we use downsampled $8 4 \times 8 4 \times 3$ RGB images as input. Leap is applied with respect to the convolutional encoder (as final linear layers vary in size across environments). We use all environments with an action space of at most 10 as our pretraining pool, holding out Breakout and SpaceInvaders. During meta training, we sample a batch of 16 games at random from a pretraining pool of 27 games. On each game in the batch, a network is initialized using the shared initialization and trained independently for 5 million steps, accumulating the meta gradient across games on the fly. Consequently, in any given episode, the baseline and Leap differs only with respect to the initialization of the convolutional encoder. We trained Leap for 100 steps, equivalent to training 1600 agents for 5 million steps. The meta learned initialization was evaluated on the held-out games, a random selection of games seen during pretraining, and a random selection of games with action spaces larger than 10 (table 6). On each task, we use a batch size of 32, an unroll length of 5 and update the model parameters with RMSProp (using $\epsilon = 1 0 ^ { - 4 }$ , $\alpha = 0 . 9 9 )$ with a learning rate of $1 0 ^ { - 4 }$ . We set the entropy cost to 0.01 and clip the absolute value of the rewards to maximum 5.0. We use a discounting factor of 0.99.
|
| 463 |
+
|
| 464 |
+
Table 6: Evaluation environment characteristics. †Calculated on baseline (no pretraining) data.
|
| 465 |
+
|
| 466 |
+
<table><tr><td>Environment</td><td>Action Space</td><td>Mean Rewardt</td><td>Standard Deviationt</td><td>Pretraining Env</td></tr><tr><td>AirRaid</td><td>6</td><td>2538</td><td>624</td><td>Y</td></tr><tr><td>UpNDown</td><td>6</td><td>52417</td><td>2797</td><td>Y</td></tr><tr><td>WizardOfWor</td><td>10</td><td>2531</td><td>182</td><td>Y</td></tr><tr><td>Breakout</td><td>4</td><td>338</td><td>13</td><td>N</td></tr><tr><td>SpaceInvaders</td><td>6</td><td>1065</td><td>103</td><td>N</td></tr><tr><td>Asteroids</td><td>14</td><td>1760</td><td>139</td><td>N</td></tr><tr><td>Alien</td><td>18</td><td>1280</td><td>182</td><td>N</td></tr><tr><td>Gravitar</td><td>18</td><td>329</td><td>15</td><td>N</td></tr><tr><td>RoadRunner</td><td>18</td><td>29593</td><td>2890</td><td>N</td></tr></table>
|
| 467 |
+
|
| 468 |
+

|
| 469 |
+
Figure 7: Mean normalized episode scores on Atari games across training steps. Scores are reported as moving average over 500 episodes. Shaded regions depict two standard deviations across ten seeds. KungFuMaster, RoadRunner and Krull have action state spaces that are twice as large as the largest action state encountered during pretraining. Leap (orange) generally outperforms a random initialization, except for WizardOfWor, where a random initialization does better on average due to outlying runs under Leap’s initialization.
|
| 470 |
+
|
| 471 |
+

|
| 472 |
+
Figure 8: Mean episode scores on Atari games across training steps for different runs. Scores are reported as moving average over 500 episodes. Leap (orange) outperforms a random initialization by being less volatile.
|
md/train/LyjH88yV7F/LyjH88yV7F.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Learning Graph Models for Retrosynthesis Prediction
|
| 2 |
+
|
| 3 |
+
Vignesh Ram Somnath1
|
| 4 |
+
|
| 5 |
+
Charlotte Bunne1
|
| 6 |
+
|
| 7 |
+
Connor W. Coley2
|
| 8 |
+
|
| 9 |
+
Andreas Krause1 Regina Barzilay3
|
| 10 |
+
|
| 11 |
+
1Department of Computer Science, ETH 2Department of Chemical Engineering, MIT 3Computer Science and Artificial Intelligence Lab, MIT 1{vsomnath, bunnec, krausea}@ethz.ch, 2ccoley@mit.edu, 3regina@csail.mit.edu
|
| 12 |
+
|
| 13 |
+
# Abstract
|
| 14 |
+
|
| 15 |
+
Retrosynthesis prediction is a fundamental problem in organic synthesis, where the task is to identify precursor molecules that can be used to synthesize a target molecule. A key consideration in building neural models for this task is aligning model design with strategies adopted by chemists. Building on this viewpoint, this paper introduces a graph-based approach that capitalizes on the idea that the graph topology of precursor molecules is largely unaltered during a chemical reaction. The model first predicts the set of graph edits transforming the target into incomplete molecules called synthons. Next, the model learns to expand synthons into complete molecules by attaching relevant leaving groups. This decomposition simplifies the architecture, making its predictions more interpretable, and also amenable to manual correction. Our model achieves a top-1 accuracy of $5 3 . 7 \%$ , outperforming previous template-free and semi-template-based methods.
|
| 16 |
+
|
| 17 |
+
# 1 Introduction
|
| 18 |
+
|
| 19 |
+
Retrosynthesis prediction, first formalized by E. J. Corey [Corey, 1991] is a fundamental problem in organic synthesis that attempts to identify a series of chemical transformations for synthesizing a target molecule. In the single-step formulation, the task is to identify a set of reactant molecules given a target. Beyond simple reactions, many practical tasks involving complex organic molecules are difficult even for expert chemists. As a result, substantial experimental exploration is needed to cover for deficiencies of analytical approaches. This has motivated interest in computer-assisted retrosynthesis [Corey and Wipke, 1969], with a recent surge in machine learning methods [Chen et al., 2019, Coley et al., 2017b, Dai et al., 2019, Zheng et al., 2019, Genheden et al., 2020].
|
| 20 |
+
|
| 21 |
+
Computationally, the main challenge is how to explore the combinatorial space of reactions that can yield the target molecule. Largely, previous methods for retrosynthesis prediction can be divided into template-based [Coley et al., 2017b, Dai et al., 2019, Segler and Waller, 2017] and template-free [Chen et al., 2019, Zheng et al., 2019] approaches. Template-based methods match a target molecule against a large set of templates, which are molecular subgraph patterns that highlight changes during a chemical reaction. Despite their interpretability, these methods fail to generalize to new reactions. Template-free methods bypass templates by learning a direct mapping from the SMILES [Weininger, 1988] representations of the product to reactants. Despite their greater generalization potential, these methods generate reactant SMILES character by character, increasing generation complexity.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: Overview of Our Approach. a. Edit Prediction. We train a model to learn a distribution over possible graph edits. In this case, the correct edit corresponds to breaking the bond marked in red. Applying this edit produces two synthons. b. Synthon Completion. Another model is trained to pick candidate leaving groups (blue) for each synthon from a discrete vocabulary, which are then attached to produce the final reactants.
|
| 25 |
+
|
| 26 |
+
Another important consideration in building retrosynthesis models is aligning model design with strategies adopted by expert chemists. These strategies are influenced by fundamental properties of chemical reactions, independent of complexity level: (i.) the product atoms are always a subset of the reactant atoms1, and (ii.) the molecular graph topology is largely unaltered from products to reactants. For example, in the standard retrosynthesis dataset, only $6 . 3 \%$ of the atoms in the product undergo any change in connectivity.
|
| 27 |
+
|
| 28 |
+
This consideration has received more attention in recent semi-template-based methods [Shi et al., 2020, Yan et al., 2020], that generate reactants from a product in two stages: (i.) first identify intermediate molecules called synthons, (ii.) and then complete synthons into reactants by sequential generation of atoms or SMILES characters.. Our model GRAPHRETRO also uses a similar workflow. However, we avoid sequential generation for completing synthons by instead selecting subgraphs called leaving groups from a precomputed vocabulary. This vocabulary is constructed during preprocessing by extracting subgraphs that differ between a synthon and the corresponding reactant. The vocabulary has a small size (170 for USPTO-50k) indicating remarkable redundancy, while covering $9 9 . 7 \%$ of the test set. Operating at the level of these subgraphs greatly reduces the complexity of reactant generation, with improved empirical performance. This formulation also simplifies our architecture, and makes our predictions more transparent, interpretable and amenable to manual correction.
|
| 29 |
+
|
| 30 |
+
The benchmark dataset for evaluating retrosynthesis models is USPTO-50k [Schneider et al., 2016], which consists of 50000 reactions across 10 reaction classes. The dataset contains an unexpected shortcut towards predicting the edit, in that the product atom with atom-mapping 1 is part of the edit in $7 5 \%$ of the cases, allowing predictions that depend on the position of the atom to overestimate performance. We canonicalize the product SMILES and remap the existing dataset, thereby removing the shortcut. On this remapped dataset, GRAPHRETRO achieves a top-1 accuracy of $5 3 . 7 \%$ when the reaction class is not known, outperforming both template-free and semi-template-based methods.
|
| 31 |
+
|
| 32 |
+
# 2 Related Work
|
| 33 |
+
|
| 34 |
+
Retrosynthesis Prediction Existing machine learning methods for retrosynthesis prediction can be divided into template-based, template-free and recent semi-template-based approaches.
|
| 35 |
+
|
| 36 |
+
Template-Based: Templates are either hand-crafted by experts [Hartenfeller et al., 2011, Szymkuc´ et al., 2016], or extracted algorithmically from large databases Coley et al. [2017a], Law et al. [2009]. Exhaustively applying large template sets is expensive due to the involved subgraph matching procedure. Template-based methods therefore utilize different ways of prioritizing templates, by either learning a conditional distribution over the template set [Segler and Waller, 2017], ranking templates based on molecular similarities to precedent reactions [Coley et al., 2017b] or directly modelling the joint distribution of templates and reactants using logic variables [Dai et al., 2019]. Despite their interpretability, these methods fail to generalize outside their rule set.
|
| 37 |
+
|
| 38 |
+
Template-Free: Template-free methods [Liu et al., 2017, Zheng et al., 2019, Chen et al., 2019] learn a direct transformation from products to reactants using architectures from neural machine translation and a string based representation of molecules called SMILES [Weininger, 1988]. Linearizing molecules as strings does not utilize the inherently rich chemical structure. In addition, the reactant SMILES are generated from scratch, character by character. Attempts have been made to improve validity by adding a syntax correcter [Zheng et al., 2019] and a mixture model to improve diversity of suggestions [Chen et al., 2019], but the performance remains worse than [Dai et al., 2019] on the standard retrosynthesis dataset. Sun et al. [2021] formulate retrosynthesis using energy-based models, with additional parameterizations and loss terms to enforce the duality between forward (reaction prediction) and backward (retrosynthesis) prediction.
|
| 39 |
+
|
| 40 |
+
Semi-Template-Based: Our work is closely related to recently proposed semi-template-based methods [Shi et al., 2020, Yan et al., 2020], which first identify synthons and then expand synthons into reactants through sequential generation using either a graph generative model [Shi et al., 2020] or a Transformer [Yan et al., 2020]. To reduce the complexity of reactant generation, we instead complete synthons using subgraphs called leaving groups selected from a precomputed vocabulary. This allows us to view synthon completion as a classification problem instead of a generative one. We also utilize the dependency graph between possible edits, and update edit predictions using a message passing network (MPN) [Gilmer et al., 2017] on this graph. Both innovations together yield a $4 . 8 \%$ and $3 . 3 \%$ performance improvement respectively over previous semi-template-based methods.
|
| 41 |
+
|
| 42 |
+
Reaction Center Identification The reaction center covers a small number of participating atoms involved in the reaction. Our work is also related to models that predict reaction outcomes by learning to rank atom pairs based on their likelihood to be in the reaction center [Coley et al., 2019, Jin et al., 2017]. The task of identifying the reaction center is related to the step of deriving the synthons in our formulation. Our work departs from [Coley et al., 2019, Jin et al., 2017] as we utilize the property that new bond formations occur rarely $( \sim 0 . 1 \% )$ from products to synthons, allowing us to predict a score only for existing bonds and atoms and reduce prediction complexity from $O ( N ^ { \bar { 2 } } )$ to $O ( N )$ . We also utilize the dependency graph between possible edits, and update edit predictions using a MPN on this graph.
|
| 43 |
+
|
| 44 |
+
Utilizing Substructures Substructures have been utilized in various tasks from sentence generation by fusing phrases to molecule generation and optimization [Jin et al., 2018, 2020]. Our work is closely related to [Jin et al., 2020] which uses precomputed substructures as building blocks for property-conditioned molecule generation. However, instead of precomputing, synthons —analogous building blocks for reactants— are indirectly learnt during training.
|
| 45 |
+
|
| 46 |
+
# 3 Model Design
|
| 47 |
+
|
| 48 |
+
Our approach leverages the property that graph topology is largely unaltered from products to reactants. To achieve this, we first derive suitable building blocks from the product called synthons, and then complete them into valid reactants by adding specific functionalities called leaving groups. These derivations, called edits, are characterized by modifications to bonds or hydrogen counts on atoms. We first train a neural network to predict a score for possible edits (Section 3.1). The edit with the highest score is then applied to the product to obtain synthons. Since the number of unique leaving groups are small, we model leaving group selection as a classification problem over a precomputed vocabulary (Section 3.2). To produce candidate reactants, we attach the predicted leaving group to the corresponding synthon through chemically constrained rules. The overall process is outlined in Figure 1. Before describing the two modules, we introduce relevant preliminaries that set the background for the remainder of the paper.
|
| 49 |
+
|
| 50 |
+
Retrosynthesis Prediction A retrosynthesis pair $R$ is described by a pair of molecular graphs $( \mathcal { G } _ { p } , \mathcal { G } _ { r } )$ , where $\mathcal { G } _ { p }$ are the products and $\mathcal { G } _ { r }$ the reactants. A molecular graph is described as $\mathcal { G } = \mathbf { \bar { \rho } } ( \mathcal { V } , \mathcal { E } )$ with atoms $\nu$ as nodes and bonds $\mathcal { E }$ as edges. Prior work has focused on the single product case, while reactants can have multiple connected components, i.e. $\mathcal { G } _ { r } = \{ \mathcal { G } _ { r _ { c } } \} _ { c = 1 } ^ { C }$ . Retrosynthesis pairs are atom-mapped so that each product atom has a unique corresponding reactant atom. The retrosynthesis task then, is to infer $\{ \mathcal { G } _ { r _ { c } } \} _ { c = 1 } ^ { C }$ given $\mathcal { G } _ { p }$ .
|
| 51 |
+
|
| 52 |
+
Edits Edits consist of (i.) atom pairs $\left\{ \left( a _ { i } , a _ { j } \right) \right\}$ where the bond type changes from products to reactants, and (ii.) atoms $\left\{ { a } _ { i } \right\}$ where the number of hydrogens attached to the atom change from products to reactants. We denote the set of edits by $E$ . Since retrosynthesis pairs in the training set are atom-mapped, edits can be automatically identified by comparing the atoms and atom pairs in the product to their corresponding reactant counterparts.
|
| 53 |
+
|
| 54 |
+
Synthons and Leaving Groups Applying edits $E$ to the product $\mathcal { G } _ { p }$ results in incomplete molecules called synthons. Synthons are analogous to rationales or building blocks, which are expanded into valid reactants by adding specific functionalities called leaving groups that are responsible for its reactivity. We denote synthons by $\mathcal { G } _ { s }$ and leaving groups by $\mathcal { G } _ { l }$ . We further assume that synthons and leaving groups have the same number of connected components as the reactants, i.e $\mathcal { G } _ { s } \doteq \{ \mathcal { G } _ { s _ { c } } \} _ { c = 1 } ^ { C }$ and $\mathcal { G } _ { l } = \{ \mathcal { G } _ { l _ { c } } ^ { \star } \} _ { c = 1 } ^ { C }$ . This assumption holds for $9 9 . 9 7 \%$ reactions in the training set.
|
| 55 |
+
|
| 56 |
+
Formally, our model generates reactants by first predicting the set of edits $E$ that transform $\mathcal { G } _ { p }$ into $\mathcal { G } _ { s }$ , followed by predicting a leaving group $\mathcal { G } _ { l _ { c } }$ to attach to each synthon $\mathcal { G } _ { s _ { c } }$ . The model is defined as
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
P ( \mathcal G _ { r } | \mathcal G _ { p } ) = \sum _ { E , \mathcal G _ { l } } P ( E | \mathcal G _ { p } ) P ( \mathcal G _ { l } | \mathcal G _ { p } , \mathcal G _ { s } ) ,
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where $\mathcal { G } _ { s } , \mathcal { G } _ { r }$ are deterministic given $E , { \mathcal { G } } _ { l }$ , and $\mathcal { G } _ { p }$ .
|
| 63 |
+
|
| 64 |
+
# 3.1 Edit Prediction
|
| 65 |
+
|
| 66 |
+
For a given retrosynthesis pair $R = ( \mathcal G _ { p } , \mathcal G _ { r } )$ , we predict an edit score only for existing bonds and atoms, instead of every atom pair as in [Coley et al., 2019, Jin et al., 2017]. This choice is motivated by the low frequency $( \sim 0 . 1 \% )$ of new bond formations in the training set examples. Coupled with the sparsity of molecular graphs, this reduces the prediction complexity from $O ( N ^ { 2 } )$ to $O ( N )$ for a product with $N$ atoms. Our edit prediction model has variants tailored to single and multiple edit prediction. Since $9 5 \%$ of the training set consists of single edit examples, the remainder of this section describes the setup for single edit prediction. A detailed description of our multiple edit prediction model can be found in Appendix ??.
|
| 67 |
+
|
| 68 |
+
Each bond $( u , v )$ in $\mathcal { G } _ { p }$ is associated with a label $y _ { u v k } \in \{ 0 , 1 \}$ indicating whether its bond type $k$ has changed from the products to reactants. Each atom $u$ is associated with a label $y _ { u } \in \{ 0 , \bar { 1 } \}$ indicating a change in hydrogen count. We predict edit scores using representations that are learnt using a graph encoder.
|
| 69 |
+
|
| 70 |
+
Graph Encoder To obtain atom representations, we use a variant of the message passing network (MPN) described in [Gilmer et al., 2017]. Each atom $u$ has a feature vector $\mathbf { x } _ { u }$ indicating its atom type, degree and other properties. Each bond $( u , v )$ has a feature vector $\mathbf { x } _ { u v }$ indicating its aromaticity, bond type and ring membership. For simplicity, we denote the encoding process by $\mathrm { M P N } ( \cdot )$ and describe architectural details in Appendix ??. The MPN computes atom representations $\{ \mathbf { c } _ { u } | u \in \mathcal { G } \}$ via
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\{ \mathbf { c } _ { u } \} = \mathrm { M P N } ( \mathcal { G } , \{ \mathbf { x } _ { u } \} , \{ \mathbf { x } _ { u v } \} _ { v \in \mathcal { N } ( u ) } ) ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where $\mathcal { N } ( u )$ denotes the neighbors of atom $u$ . The graph representation $\mathbf { c } _ { \mathcal { G } }$ is an aggregation of atom representations, i.e. $\mathbf { c } _ { \mathcal { G } } = \dot { \sum _ { { u } \in \mathcal { V } } } \mathbf { c } _ { u }$ . When $\mathcal { G }$ has connected components $\left\{ { \mathcal { G } } _ { i } \right\}$ , we get a set of graph representations $\left\{ \mathbf { c } _ { \mathcal { G } _ { i } } \right\}$ . For a bond $( u , v )$ , we define its representation $\mathbf { c } _ { u v } = ( \operatorname { A B S } ( \mathbf { c } _ { u } , \mathbf { c } _ { v } ) | | \mathbf { c } _ { u } + \mathbf { c } _ { v } )$ , where ABS denotes absolute difference and $| |$ refers to concatenation. This ensures our representations are permutation invariant. These representations are then used to predict atom and bond edit scores using corresponding neural networks,
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\begin{array} { r } { \boldsymbol { s } _ { u } = \mathbf { u _ { a } } ^ { T } \boldsymbol { \tau } ( \mathbf { W _ { a } } \mathbf { c } _ { u } + b ) \quad } \\ { \boldsymbol { s } _ { u v k } = \mathbf { u _ { k } } ^ { T } \boldsymbol { \tau } ( \mathbf { W _ { k } } \mathbf { c } _ { u v } + b _ { k } ) , } \end{array}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $\tau ( \cdot )$ is the ReLU activation function.
|
| 83 |
+
|
| 84 |
+
Updating Bond Edit Scores Unlike a typical classification problem where the labels are independent, edits can have possible dependencies between each other. For example, bonds part of a stable system such as an aromatic ring have a greater tendency to remain unchanged (label 0). We attempt to leverage such dependencies to update initial edit scores. To this end, we build a graph with bonds $( u , v )$ as nodes, and introduce an edge between bonds sharing an atom. We use another $\mathrm { M P N } ( \cdot )$ on this graph to learn aggregated neighborhood messages $\mathbf { m } _ { u v }$ , and update the edit scores $s _ { u v k }$ in a manner similar to how LSTMs update representations,
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\begin{array} { r l } & { f _ { u v k } = \sigma ( \mathbf { W _ { k x } ^ { f } } \mathbf { x } _ { u v } + \mathbf { W _ { k m } ^ { f } } \mathbf { m } _ { u v } ) } \\ & { i _ { u v k } = \sigma ( \mathbf { W _ { k x } ^ { i } } \mathbf { x } _ { u v } + \mathbf { W _ { k m } ^ { i } } \mathbf { m } _ { u v } ) } \\ & { \tilde { m } _ { u v k } = \mathbf { u _ { m } } \tau ( \mathbf { W _ { k x } ^ { m } } \mathbf { x } _ { u v } + \mathbf { W _ { k m } ^ { m } } \mathbf { m } _ { u v } ) } \\ & { \tilde { s } _ { u v k } = f _ { u v k } \cdot s _ { u v k } + i _ { u v k } \cdot \tilde { m } _ { u v k } . } \end{array}
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
Training We train by minimizing the cross-entropy loss over possible bond and atom edits
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\mathcal { L } _ { e } = - \sum _ { ( \mathcal { G } _ { p } , E ) } \left( \sum _ { ( ( u , v ) , k ) \in E } y _ { u v k } \mathrm { l o g } ( \widetilde s _ { u v k } ) + \sum _ { u \in E } y _ { u } \mathrm { l o g } ( s _ { u } ) \right) .
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
The cross-entropy loss enforces the model to learn a distribution over possible edits instead of reasoning about each edit independently, as with the binary cross entropy loss used in [Jin et al., 2017, Coley et al., 2019].
|
| 97 |
+
|
| 98 |
+
# 3.2 Synthon Completion
|
| 99 |
+
|
| 100 |
+
Synthons are completed into valid reactants by adding specific functionalities called leaving groups. This involves two complementary tasks: (i.) selecting the appropriate leaving group, and (ii.) attaching the leaving group to the synthon. As ground truth leaving groups are not directly provided, we extract the leaving groups and construct a vocabulary $\mathcal { X }$ of unique leaving groups during preprocessing.
|
| 101 |
+
|
| 102 |
+
The vocabulary has a limited size ( $| \mathcal { X } | = 1 7 0$ for a standard dataset with 50, 000 examples, and 72000 synthons) indicating the redundancy of leaving groups used in accomplishing retrosynthetic transformations. This redundancy also allows us to formulate leaving group selection as a classification problem over $\mathcal { X }$ , while retaining the ability to generate diverse reactants using different combinations of leaving groups.
|
| 103 |
+
|
| 104 |
+
Vocabulary Construction Before constructing the vocabulary, we align connected components of synthon and reactant graphs by comparing atom mapping overlaps. Using aligned pairs $\mathcal { G } _ { s _ { c } } =$ $( \gamma _ { s _ { c } } , \mathcal { E } _ { s _ { c } } )$ and $\mathcal { G } _ { r _ { c } } = ( \nu _ { r _ { c } } , \mathcal { E } _ { r _ { c } } )$ as input, the leaving group vocabulary $\mathcal { X }$ is constructed by extracting subgraphs $\mathcal { G } _ { l _ { c } } = ( \nu _ { l _ { c } } , \mathcal { E } _ { l _ { c } } )$ such that $\smash { \gamma _ { l _ { c } } = \gamma _ { r _ { c } } \setminus \gamma _ { s _ { c } } }$ . Atoms $\left\{ { a } _ { i } \right\}$ in the leaving groups that attach to synthons are marked with a special symbol. We also add three tokens to $\mathcal { X }$ namely START, which indicates the start of synthon completion, END, which indicates that there is no leaving group to add and PAD, which is used to handle variable numbers of synthon components in a minibatch.
|
| 105 |
+
|
| 106 |
+
Leaving Group Selection For synthon component $c \leq C$ , where $C$ is the number of connected components in the synthon graph, we use three inputs for leaving group selection – the product representation $\mathbf { c } _ { \mathcal { G } _ { p } }$ , the synthon component representation $\mathbf { c } _ { \mathcal { G } _ { s _ { c } } }$ , and the leaving group representation for the previous synthon component, ${ \bf e } _ { l _ { c - 1 } }$ . The product and synthon representations are learnt using the $\mathrm { M P N } ( \cdot )$ . For each $x _ { i } \in { \mathcal { X } }$ , representations can be learnt by either training independent embedding vectors (ind) or by treating each $x _ { i }$ as a subgraph and using the $\mathrm { M P N } ( \cdot )$ (shared). In the shared setting, we use the same $\mathrm { M P N } ( \cdot )$ as the product and synthons.
|
| 107 |
+
|
| 108 |
+
The leaving group probabilities are then computed by combining $\mathbf { c } _ { \mathcal { G } _ { p } } , \mathbf { c } _ { \mathcal { G } _ { s _ { c } } }$ and $\mathbf { e } _ { l _ { c - 1 } }$ via a single layer neural network and softmax function
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\hat { q } _ { l _ { c } } = \mathrm { s o f t m a x } \left( \mathbf { U } \tau \left( \mathbf { W } _ { 1 } \mathbf { c } _ { \mathcal { G } _ { p } } + \mathbf { W } _ { 2 } \mathbf { c } _ { \mathcal { G } _ { s _ { c } } } + \mathbf { W } _ { 3 } \mathbf { e } _ { l _ { \left( c - 1 \right) } } \right) \right) ,
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
where $\hat { q } _ { l _ { c } }$ is distribution learnt over $\mathcal { X }$ . Using the representation of the previous leaving group ${ \bf e } _ { l _ { c - 1 } }$ allows the model to understand combinations of leaving groups that generate the desired product from the reactants. We also include the product representation $\mathbf { c } _ { \mathcal { G } _ { p } }$ as the synthon graphs are derived from the product graph.
|
| 115 |
+
|
| 116 |
+
Training For step $c$ , given the one hot encoding of the true leaving group $q _ { l _ { c } }$ , we minimize the cross-entropy loss
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\mathcal { L } _ { s } = \sum _ { c = 1 } ^ { C } \mathcal { L } ( \hat { q } _ { l _ { c } } , q _ { l _ { c } } ) .
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
Training utilizes teacher-forcing [Williams and Zipser, 1989] so that the model makes predictions given correct histories. During inference, at every step, we use the representation of leaving group from the previous step with the highest predicted probability.
|
| 123 |
+
|
| 124 |
+
Leaving Group Attachment Attaching leaving groups to synthons is a deterministic process and not learnt during training. The task involves identification of the type of bonds to add between attaching atoms in the leaving group (marked during vocabulary construction), and the atom(s) participating in the edit. These bonds can be inferred by applying the valency constraint, which determines the maximum number of neighbors for each atom. The attachment process does not modify any stereochemistry. Given synthons and leaving groups, the attachment process has a $100 \%$ accuracy. The detailed procedure is described in Appendix ??.
|
| 125 |
+
|
| 126 |
+
# 3.3 Inference
|
| 127 |
+
|
| 128 |
+
Inference is performed using beam search with a log-likelihood scoring function. For a beam width $n$ , we select $n$ edits with highest scores and apply them to the product to obtain $n$ synthons, where each synthon can consist of multiple connected components. The synthons form the nodes for beam search. Each node maintains a cumulative score by aggregating the log-likelihoods of the edit and predicted leaving groups. Leaving group inference starts with a connected component for each synthon, and selects $n$ leaving groups with highest log-likelihoods. From the $n ^ { 2 }$ possibilities, we select $n$ nodes with the highest cumulative scores. This process is repeated until all nodes have a leaving group predicted for each synthon component.
|
| 129 |
+
|
| 130 |
+
# 4 Evaluation
|
| 131 |
+
|
| 132 |
+
Evaluating retrosynthesis models is challenging as multiple sets of reactants can be generated from the same product. To deal with this, previous works [Coley et al., 2017b, Dai et al., 2019] evaluate the ability of the model to recover retrosynthetic strategies recorded in the dataset.
|
| 133 |
+
|
| 134 |
+
Data We use the benchmark dataset USPTO-50k [Schneider et al., 2016] for all our experiments. The dataset contains 50, 000 atom-mapped reactions across 10 reaction classes. We use the same dataset version and splits as provided by [Dai et al., 2019]. The USPTO-50k dataset contains a shortcut in that the product atom with atom-mapping 1 is part of the edit in $\sim 7 5 \%$ of the cases. If the product SMILES is not canonicalized, predictions utilizing operations that depend on the position of the atom or bond will be able to use the shortcut, and overestimate performance. We canonicalize the product SMILES, and reassign atom-mappings to the reactant atoms based on the canonical ordering, which removes the shortcut. Details on the remapping procedure can be found in Appendix ??.
|
| 135 |
+
|
| 136 |
+
Evaluation We use the top- $\mathbf { \nabla } \cdot n$ accuracy $( n = 1 , 3 , 5 , 1 0 )$ ) as our evaluation metric, defined as the fraction of examples where the recorded reactants are suggested by the model with rank $\leq n$ . Following prior work [Coley et al., 2017b, Zheng et al., 2019, Dai et al., 2019], we compute the accuracy by comparing the canonical SMILES of predicted reactants to the ground truth. Atom-mapping is excluded from this comparison, but stereochemistry, which describes the relative orientation of atoms in the molecule, is retained. The evaluation is carried out for two settings, with the reaction class being known or unknown.
|
| 137 |
+
|
| 138 |
+
Table 1: Top- $n$ exact match accuracy. Best values within each section are highlighted in bold.
|
| 139 |
+
|
| 140 |
+
<table><tr><td rowspan="3">Model</td><td colspan="8">Top-n Accuracy (%)</td></tr><tr><td colspan="4">Reaction class known</td><td colspan="4">Reaction class unknown</td></tr><tr><td>1</td><td>3</td><td>5</td><td>10</td><td>1</td><td>3</td><td>5</td><td>10</td></tr><tr><td colspan="9">Template-Based</td></tr><tr><td>RETROSIM [Coley et al.,2017b]</td><td>52.9</td><td>73.8</td><td>81.2</td><td>88.1</td><td>37.3</td><td>54.7</td><td>63.3</td><td>74.1</td></tr><tr><td>NEURALSYM [Segler and Waller,2017]</td><td>55.3</td><td>76.0</td><td>81.4</td><td>85.1</td><td>44.4</td><td>65.3</td><td>72.4</td><td>78.9</td></tr><tr><td>GLN [Dai et ai., 2019]</td><td>64.2</td><td>79.1</td><td>85.2</td><td>90.0</td><td>52.5</td><td>69.0</td><td>75.6</td><td>83.7</td></tr><tr><td>DUALTB [Sun et al.,2021]</td><td>67.7</td><td>84.8</td><td>88.9</td><td>92.0</td><td>55.2</td><td>74.6</td><td>80.5</td><td>86.9</td></tr><tr><td colspan="9">Template-Free</td></tr><tr><td>SCROP [Zheng et al.,2019]</td><td>59.0</td><td>74.8</td><td>78.1</td><td>81.1</td><td>43.7</td><td>60.0</td><td>65.2</td><td>68.7</td></tr><tr><td>LV-TRANSFORMER [Chen et al.,2019]</td><td>-</td><td>-</td><td>-</td><td>-</td><td>40.5</td><td>65.1</td><td>72.8</td><td>79.4</td></tr><tr><td>DUALTF [Sun et al., 2021]</td><td>65.7</td><td>81.9</td><td>84.7</td><td>85.9</td><td>53.6</td><td>70.7</td><td>74.6</td><td>77.0</td></tr><tr><td colspan="9">Semi-Template-Based</td></tr><tr><td>G2Gs [Shi et al.,2020]</td><td>61.0</td><td>81.3</td><td>86.0</td><td>88.7</td><td>48.9</td><td>67.6</td><td>72.5</td><td>75.5</td></tr><tr><td>RETROXPERT [Yan et al.,2020]</td><td>62.1</td><td>75.8</td><td>78.5</td><td>80.9</td><td>50.4</td><td>61.1</td><td>62.3</td><td>63.4</td></tr><tr><td>GRAPHRETRO (ours)</td><td>63.9</td><td>81.5</td><td>85.2</td><td>88.1</td><td>53.7</td><td>68.3</td><td>72.2</td><td>75.5</td></tr></table>
|
| 141 |
+
|
| 142 |
+
Baselines For evaluating overall performance, we compare GRAPHRETRO to nine baselines — four template-based, three template-free, and two semi-template-based methods. These include:
|
| 143 |
+
|
| 144 |
+
Template-Based: RETROSIM Coley et al. [2017b] ranks templates for a given target molecule by computing molecular similarities to precedent reactions. NEURALSYM [Segler and Waller, 2017] trains a model to rank templates given a target molecule. GLN [Dai et al., 2019] models the joint distribution of templates and reactants in a hierarchical fashion using logic variables. DUALTB [Sun et al., 2021] uses an energy-based model formulation for retrosynthesis, with additional parameterizations and loss terms to enforce the duality between forward (reaction prediction) and backward (retrosynthesis prediction). Inference is carried out using reactant candidates obtained by applying an extracted template set to the products.
|
| 145 |
+
|
| 146 |
+
Template-Free: SCROP [Zheng et al., 2019], LV-TRANSFORMER [Chen et al., 2019] and DUALTF [Sun et al., 2021] use the Transformer architecture [Vaswani et al., 2017] to output reactant SMILES given a product SMILES. To improve the validity of their suggestions, SCROP include a second Transformer that functions as a syntax correcter. LV-TRANSFORMER uses a latent variable mixture model to improve diversity of suggestions. DUALTF utilizes additional parameterizations and loss terms to enforce the duality between forward (reaction prediction) and backward (retrosynthesis prediction).
|
| 147 |
+
|
| 148 |
+
Semi-Template-Based: G2GS [Shi et al., 2020] and RETROXPERT [Yan et al., 2020] first identify synthons, and then expand the synthons into reactants by either sequential generation of atoms and bonds (G2Gs), or using the Transformer architecture (RETROXPERT). The training dataset for the Transformer in [Yan et al., 2020] is augmented with incorrectly predicted synthons with the goal of learning a correction mechanism.
|
| 149 |
+
|
| 150 |
+
Results for NEURALSYM are taken from [Dai et al., 2019]. The authors in [Yan et al., 2020] report their performance being affected by the dataset leakage2. Thus, we use the most recent results from their website on the canonicalized dataset. For remaining baselines, we directly use the values reported in their paper. For the synthon completion module, we use the ind configuration given its better empirical performance.
|
| 151 |
+
|
| 152 |
+
# 4.1 Overall Performance
|
| 153 |
+
|
| 154 |
+
Reaction class unknown As shown in Table 1, when the reaction class is unknown, GRAPHRETRO outperforms G2GS by $4 . 8 \%$ and and RETROXPERT by $3 . 3 \%$ in top-1 accuracy. Performance improvements are also seen for larger $n$ , except for $n = 5$ . Barring DUALTB, the top-1 accuracy is also better than other template-free and template-based methods. For larger $n$ , one reason for lower top- $n$ accuracies than most template-based methods is that templates already contain combinations of leaving group patterns. In contrast, our model learns to discover these during training. A second hypothesis to this end is that simply adding log-likelihood scores from edit prediction and synthon completion models may be suboptimal and bias the beam search in the direction of the more dominating term. We leave it to future work to investigate scoring functions that rank the attachment.
|
| 155 |
+
|
| 156 |
+
Reaction class known When the reaction class is known, GRAPHRETRO outperforms G2GS and RETROXPERT by a margin of $3 \%$ and $2 \%$ respectively in top-1 accuracy. GRAPHRETRO also outperforms all the template-free methods in top- $^ n$ accuracy. for GRAPHRETRO are also better than most template-based and template-free methods. When the reaction class is known, RETROSIM and GLN restrict template sets corresponding to the reaction class, thus improving performance. The increased edit prediction performance (Section 4.2) for GRAPHRETRO helps outweigh this factor, achieving comparable or better performance till $n = 5$ .
|
| 157 |
+
|
| 158 |
+
# 4.2 Individual Module Performance
|
| 159 |
+
|
| 160 |
+
To gain more insight into the working of GRAPHRETRO, we evaluate the top- $\boldsymbol { n }$ accuracy $\mathbf { \nabla } _ { n } =$ $1 , 2 , 3 , 5 )$ of edit prediction and synthon completion modules, along with corresponding ablation studies, with results shown in Table 2.
|
| 161 |
+
|
| 162 |
+
Edit Prediction For the edit prediction module, we compare the true edit(s) to top- $\boldsymbol { n }$ edits predicted by the model. We also consider two ablation studies, one where we directly use the initial edit scores without updating them, and the other where we predict edits using atom-pairs instead of existing bonds and atoms. Both design choices lead to improvements in performance, as shown in Table 2. We hypothesize that the larger improvement compared to edit prediction using atom-pairs is due to the easier optimization procedure, with lesser imbalance between labels 1 and 0.
|
| 163 |
+
|
| 164 |
+
Synthon Completion For evaluating the synthon completion module, we first apply the true edits to obtain synthons, and compare the true leaving groups to top- $\mathbf { \nabla } \cdot n$ leaving groups predicted by the model. We test the performance of both the ind and shared configurations. Both configurations perform similarly, and are able to identify $\sim 9 7 \%$ (close to its upper bound of $9 9 . 7 \%$ ) of the true leaving groups in its top-5 choices, when the reaction class is known. The top-1, 3 and 5 accuracies of the synthon completion for unknown reaction classes for G2Gs are $6 1 . 1 \%$ , $8 1 . 5 \%$ and $8 6 . 7 \%$ respectively, while ours are $7 5 . 6 \%$ , $9 2 . 5 \%$ and $9 6 . 1 \%$ , indicating a $10 \%$ performance improvement using a classification formulation over the generative one adopted by G2Gs.
|
| 165 |
+
|
| 166 |
+
Table 2: Performance Study of edit prediction and synthon completion modules
|
| 167 |
+
|
| 168 |
+
<table><tr><td rowspan="3"> Setting</td><td colspan="8">Top-n Accuracy (%)</td></tr><tr><td colspan="4">Reaction class known</td><td colspan="4">Reaction class unknown</td></tr><tr><td>1</td><td>2</td><td>3</td><td>5</td><td>1</td><td>2</td><td>3</td><td>5</td></tr><tr><td>Edit Prediction</td><td>84.6</td><td>92.2</td><td>93.7</td><td>94.5</td><td>70.8</td><td>85.1</td><td>89.5</td><td>92.7</td></tr><tr><td>- without edit score updates</td><td>84.3</td><td>92.1</td><td>93.7</td><td>94.5</td><td>70.1</td><td>84.8</td><td>89.4</td><td>92.6</td></tr><tr><td>- predicting on atom pairs</td><td>81.9</td><td>89.5</td><td>90.9</td><td>92.1</td><td>68.6</td><td>83.2</td><td>88.3</td><td>91.8</td></tr><tr><td>Synthon Completion (ind)</td><td>77.4</td><td>89.5</td><td>94.2</td><td>97.6</td><td>75.6</td><td>87.4</td><td>92.5</td><td>96.1</td></tr><tr><td>Synthon Completion (shared)</td><td>76.9</td><td>89.6</td><td>93.9</td><td>97.4</td><td>74.9</td><td>87.7</td><td>92.9</td><td>96.3</td></tr></table>
|
| 169 |
+
|
| 170 |
+
# 4.3 Example Predictions
|
| 171 |
+
|
| 172 |
+
In Figure 2, we visualize the model predictions and the ground truth for three cases. Figure 2a shows an example where the model identifies both the edits and leaving groups correctly. In Figure 2b, the correct edit is identified but the predicted leaving groups are incorrect. We hypothesize this is due to the fact that in the training set, leaving groups attaching to the carbonyl carbon $\scriptstyle ( \mathbf { C } = \mathbf { O } )$ are small (e.g. -OH, - $\mathrm { - N H _ { 2 } }$ , halides). The true leaving group in this example, however, is large. The model is unable to reason about this and predicts the small leaving group -I. In Figure 2c, the model identifies the edit and consequently the leaving group incorrectly. This highlights a limitation of our model. If the edit is predicted incorrectly, the model cannot suggest the true precursors.
|
| 173 |
+
|
| 174 |
+
# 4.4 Limitations
|
| 175 |
+
|
| 176 |
+
The simplified and interpretable construction of GRAPHRETRO comes with certain limitations. First, the overall performance of the model is limited by the performance of the edit prediction step. If the predicted edit is incorrect, the true reactants cannot be salvaged. This limitation is partly remedied by our model design, that allows for user intervention to correct the edit. Second, our method is reliant on atom-mapping for extracting edits and leaving groups. Extracting edits directly based on substructure matching currently suffer from false positives, and heuristics to correct for these result in correct edits in only ${ \sim } 9 0 \%$ of the cases. Third, our formulation assumes that we have as many synthons as reactants, which is violated in some reactions. We leave it to future work to extend the model to realize a single reactant from multiple synthons, and introduce more chemically meaningful edit correction mechanisms.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 2: Example Predictions. The true edit and incorrect edit (if any) are highlighted in green and red respectively. The true and predicted leaving groups are highlighted in blue. a. Correctly predicted example by the model. b. Correctly predicted edit but incorrectly predicted leaving groups. c. Incorrectly predicted edit and leaving group.
|
| 180 |
+
|
| 181 |
+
# 5 Conclusion
|
| 182 |
+
|
| 183 |
+
Previous methods for single-step retrosynthesis either restrict prediction to a template set, are insensitive to molecular graph structure or generate molecules from scratch. We address these shortcomings by introducing a graph-based semi-template-based model inspired by a chemist’s workflow, enhancing the interpretability of retrosynthesis models. Given a target molecule, we first identify synthetic building blocks (synthons) which are then realized into valid reactants, thus avoiding molecule generation from scratch. Our model outperforms previous semi-template-methods by significant margins on the benchmark dataset. Future work aims to extend the model to realize a single reactant from multiple synthons, and introduce more chemically meaningful components to improve the synergy between such tools for retrosynthesis prediction and a practitioner’s expertise.
|
| 184 |
+
|
| 185 |
+
# Acknowledgements
|
| 186 |
+
|
| 187 |
+
This research was supported by the Machine Learning for Pharmaceutical Discovery and Synthesis Consortium at MIT. V.R.S. was also supported by the Zeno Karl Schindler Foundation. C.B. was supported by the Swiss National Science Foundation under the National Center of Competence in Research (NCCR) Catalysis under grant agreement 51NF40 180544. We thank the Leonhard scientific computing cluster at ETH Zürich for providing computational resources.
|
| 188 |
+
|
| 189 |
+
# References
|
| 190 |
+
|
| 191 |
+
B. Chen, T. Shen, T. S. Jaakkola, and R. Barzilay. Learning to Make Generalizable and Diverse Predictions for Retrosynthesis. In Submission, 2019.
|
| 192 |
+
C. W. Coley, R. Barzilay, T. S. Jaakkola, W. H. Green, and K. F. Jensen. Prediction of Organic Reaction Outcomes Using Machine Learning. In ACS Central Science. ACS Publications, 2017a.
|
| 193 |
+
C. W. Coley, L. Rogers, W. H. Green, and K. F. Jensen. Computer-Assisted Retrosynthesis Based on Molecular Similarity. ACS Central Science, 3, 2017b.
|
| 194 |
+
C. W. Coley, W. Jin, L. Rogers, T. F. Jamison, T. S. Jaakkola, W. H. Green, R. Barzilay, and K. F. Jensen. A graph-convolutional neural network model for the prediction of chemical reactivity. Chemical Science, 10, 2019.
|
| 195 |
+
E. Corey and W. T. Wipke. Computer-assisted design of complex organic syntheses. Science, 166 (3902):178–192, 1969.
|
| 196 |
+
E. J. Corey. The Logic of Chemical Synthesis: Multistep Synthesis of Complex Carbogenic Molecules (Nobel Lecture). Angewandte Chemie International Edition, 30, 1991.
|
| 197 |
+
H. Dai, C. Li, C. Coley, B. Dai, and L. Song. Retrosynthesis Prediction with Conditional Graph Logic Network. In Advances in Neural Information Processing Systems (NeurIPS), volume 32, 2019.
|
| 198 |
+
S. Genheden, A. Thakkar, V. Chadimová, J.-L. Reymond, O. Engkvist, and E. Bjerrum. Aizynthfinder: a fast, robust and flexible open-source software for retrosynthetic planning. Journal of cheminformatics, 12(1):1–9, 2020.
|
| 199 |
+
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 (ICML), volume 70, 2017.
|
| 200 |
+
M. Hartenfeller, M. Eberle, P. Meier, C. Nieto-Oberhuber, K.-H. Altmann, G. Schneider, E. Jacoby, and S. Renner. A Collection of Robust Organic Synthesis Reactions for In Silico Molecule Design. In Journal of Chemical Information and Modeling, volume 51. ACS Publications, 2011.
|
| 201 |
+
W. Jin, C. Coley, R. Barzilay, and T. Jaakkola. Predicting Organic Reaction Outcomes with WeisfeilerLehman Network. In Advances in Neural Information Processing Systems (NeurIPS), volume 30, 2017.
|
| 202 |
+
W. Jin, R. Barzilay, and T. Jaakkola. Junction Tree Variational Autoencoder for Molecular Graph Generation. In International Conference on Machine Learning (ICML), volume 32, 2018.
|
| 203 |
+
W. Jin, R. Barzilay, and T. Jaakkola. Composing Molecules with Multiple Property Constraints. In International Conference on Machine Learning (ICML), 2020.
|
| 204 |
+
J. Law, Z. Zsoldos, A. Simon, D. Reid, Y. Liu, S. Y. Khew, A. P. Johnson, S. Major, R. A. Wade, and H. Y. Ando. Route Designer: A Retrosynthetic Analysis Tool Utilizing Automated Retrosynthetic Rule Generation. Journal of Chemical Information and Modeling, 49, 2009.
|
| 205 |
+
B. Liu, B. Ramsundar, P. Kawthekar, J. Shi, J. Gomes, Q. Luu Nguyen, S. Ho, J. Sloane, P. Wender, and V. Pande. Retrosynthetic Reaction Prediction Using Neural Sequence-to-Sequence Models. In ACS Central Science, volume 3. ACS Publications, 2017.
|
| 206 |
+
N. Schneider, N. Stiefl, and G. A. Landrum. What’s What: The (Nearly) Definitive Guide to Reaction Role Assignment. In Journal of Chemical Information and Modeling, volume 56. ACS Publications, 2016.
|
| 207 |
+
M. H. Segler and M. P. Waller. Neural-Symbolic Machine Learning for Retrosynthesis and Reaction Prediction. Chemistry–A European Journal, 23, 2017.
|
| 208 |
+
C. Shi, M. Xu, H. Guo, M. Zhang, and J. Tang. A graph to graphs framework for retrosynthesis prediction, 2020.
|
| 209 |
+
R. Sun, H. Dai, L. Li, S. Kearnes, and B. Dai. Energy-based view of retrosynthesis, 2021. URL https://openreview.net/forum?id $\equiv$ 0Hj3tFCSjUd.
|
| 210 |
+
S. Szymkuc, E. P. Gajewska, T. Klucznik, K. Molga, P. Dittwald, M. Startek, M. Bajczyk, and ´ B. A. Grzybowski. Computer-assisted synthetic planning: The end of the beginning. Angewandte Chemie International Edition, 55(20):5904–5937, 2016.
|
| 211 |
+
A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is All You Need. In Advances in Neural Information Processing Systems (NeurIPS), volume 30, 2017.
|
| 212 |
+
D. Weininger. SMILES, a Chemical Language and Information System. Journal of Chemical Information and Computer Sciences, 28, 1988.
|
| 213 |
+
R. J. Williams and D. Zipser. A Learning Algorithm for Continually Running Fully Recurrent Neural Networks. In Neural Computation, volume 1. MIT Press, 1989.
|
| 214 |
+
C. Yan, Q. Ding, P. Zhao, S. Zheng, J. YANG, Y. Yu, and J. Huang. Retroxpert: Decompose retrosynthesis prediction like a chemist. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 11248–11258. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ 819f46e52c25763a55cc642422644317-Paper.pdf.
|
| 215 |
+
S. Zheng, J. Rao, Z. Zhang, J. Xu, and Y. Yang. Predicting Retrosynthetic Reactions using SelfCorrected Transformer Neural Networks. In Journal of Chemical Information and Modeling. ACS Publications, 2019.
|
md/train/OAMrSPRRxJx/OAMrSPRRxJx.md
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Deep Policy Dynamic Programming for Vehicle Routing Problems
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Routing problems are a class of combinatorial problems with many practical
|
| 11 |
+
2 applications. Recently, end-to-end deep learning methods have been proposed
|
| 12 |
+
3 to learn approximate solution heuristics for such problems. In contrast, classical
|
| 13 |
+
4 dynamic programming (DP) algorithms guarantee optimal solutions, but scale
|
| 14 |
+
5 badly with the problem size. We propose Deep Policy Dynamic Programming
|
| 15 |
+
6 (DPDP), which aims to combine the strengths of learned neural heuristics with
|
| 16 |
+
7 those of DP algorithms. DPDP prioritizes and restricts the DP state space using
|
| 17 |
+
8 a policy derived from a deep neural network, which is trained to predict edges
|
| 18 |
+
9 from example solutions. We evaluate our framework on the travelling salesman
|
| 19 |
+
10 problem (TSP), the vehicle routing problem (VRP) and TSP with time windows
|
| 20 |
+
11 (TSPTW) and show that the neural policy improves the performance of (restricted)
|
| 21 |
+
12 DP algorithms, making them competitive to strong alternatives such as LKH, while
|
| 22 |
+
13 also outperforming most other ‘neural approaches’ for solving TSPs, VRPs and
|
| 23 |
+
14 TSPTWs with 100 nodes.
|
| 24 |
+
|
| 25 |
+
# 15 1 Introduction
|
| 26 |
+
|
| 27 |
+
16 Dynamic programming (DP) is a powerful framework for solving optimization problems by solving
|
| 28 |
+
17 smaller subproblems through the principle of optimality [3]. Famous examples are Dijkstra’s
|
| 29 |
+
18 algorithm [14] for the shortest route between two locations, and the classic Held-Karp algorithm for
|
| 30 |
+
19 the travelling salesman problem (TSP) [23, 4]. Despite their long history, dynamic programming
|
| 31 |
+
20 algorithms for vehicle routing problems (VRPs) have seen limited use in practice, primarily due to
|
| 32 |
+
21 their bad scaling performance. More recently, a line of research has attempted the use of machine
|
| 33 |
+
22 learning (especially deep learning) to automatically learn heuristics for solving routing problems
|
| 34 |
+
23 [57, 5, 41, 29, 7]. While the results are promising, most learned heuristics are not (yet) competitive
|
| 35 |
+
24 to ‘traditional’ algorithms such as LKH [24] and lack (asymptotic) guarantees on their performance.
|
| 36 |
+
25 In this paper, we propose Deep Policy Dynamic Programming (DPDP) as a framework for solving
|
| 37 |
+
26 vehicle routing problems. The key of DPDP is to combine the strengths of deep learning and DP,
|
| 38 |
+
27 by restricting the DP state space (the search space) using a policy derived from a neural network.
|
| 39 |
+
28 In Figure 1 it can be seen how the neural network indicates promising parts of the search space
|
| 40 |
+
29 (through a heatmap over the edges of the graph), which is then used by the DP algorithm to find a
|
| 41 |
+
30 good solution. DPDP is more powerful than some related ideas [62, 52, 61, 6, 34] as it combines
|
| 42 |
+
31 supervised training of a large neural network with just a single model evaluation at test time, to enable
|
| 43 |
+
32 running a large scale guided search using DP. The DP framework is flexible as it can model a variety
|
| 44 |
+
33 of realistic routing problems with difficult practical constraints [20]. We illustrate this by testing
|
| 45 |
+
34 DPDP on the TSP, the capacitated VRP and the TSP with (hard) time window constraints (TSPTW).
|
| 46 |
+
35 In more detail, the starting point of our proposed approach is a restricted dynamic programming
|
| 47 |
+
36 algorithm [20]. Such an algorithm heuristically reduces the search space by retaining only the $B$ most
|
| 48 |
+
37 promising solutions per iteration. The selection process is very important as it defines the part of the
|
| 49 |
+
38 DP state space considered and, thus, the quality of the solution found (see Fig. 2). Instead of manually
|
| 50 |
+
39 defining a selection criterion, DPDP defines it using a (sparse) heatmap of promising route segments
|
| 51 |
+
40 obtained by pre-processing the problem instance using a (deep) graph neural network (GNN) [26].
|
| 52 |
+
41 This approach is reminiscent of neural branching policies for branch-and-bound algorithms [19, 40].
|
| 53 |
+
42 In this work, we thus aim for a ‘neural boost’ of DP algorithms, by using a graph neural network
|
| 54 |
+
43 for scoring partial solutions. Prior work on ‘neural’ vehicle routing has focused on auto-regressive
|
| 55 |
+
44 models [57, 5, 13, 29], but they have high computational cost when combined with (any form of)
|
| 56 |
+
45 search, as the model needs to be evaluated for each partial solution considered. Instead, we use (for
|
| 57 |
+
46 TSP) and adapt (for VRP and TSPTW) a model to predict a heatmap indicating promising edges [26],
|
| 58 |
+
47 and define the score of a partial solution as the ‘heat’ of the edges it contains (plus an estimate of the
|
| 59 |
+
48 ‘heat-to-go’ or potential of the solution). As the neural network only needs to be evaluated once for
|
| 60 |
+
49 each instance, this enables a much larger search (defined by $B$ ), making a good trade-off between
|
| 61 |
+
50 quality and computational cost. Additionally, we can apply a threshold to the heatmap to define a
|
| 62 |
+
51 sparse graph on which to run the DP algorithm, reducing the runtime by eliminating many solutions.
|
| 63 |
+
52 Figure 2 illustrates the overall DPDP algorithm. In Section 4, we show that DPDP significantly
|
| 64 |
+
53 improves over ‘classic’ restricted DP algorithms (with the same $B$ ). Additionally, we show that
|
| 65 |
+
54 DPDP outperformes most other ‘neural’ approaches for TSP, VRP and TSPTW and is competitive
|
| 66 |
+
55 with the highly-optimized LKH solver [24] for VRP, while achieving similar results much faster for
|
| 67 |
+
56 TSP and TSPTW. For TSPTW, DPDP also outperforms the best open-source solver we could find
|
| 68 |
+
57 [10], illustrating the power of DPDP to handle difficult hard constraints (time windows).
|
| 69 |
+
59 DP has a long history as an exact solution method for routing problems [31, 50], e.g. for the TSP
|
| 70 |
+
60 with time windows [15] and precedence constraints [39], but typically limited to small problems only,
|
| 71 |
+
61 due to the curse of dimensionality. Restricted DP (with heuristic policies) has been used to address,
|
| 72 |
+
62 e.g., the time dependent TSP [37], and has been generalized into a flexible framework for VRPs with
|
| 73 |
+
63 different types of practical constraints [20]. DP approaches have also been shown to be useful in
|
| 74 |
+
64 settings with difficult practical issues such as time-dependent travel times and driving regulations [28]
|
| 75 |
+
65 or stochastic demands [42]. For a thorough investigation of modelling choices of DP for routing (and
|
| 76 |
+
66 scheduling), see [53]. For sparse graphs, alternative, but less flexible, formulations can be used [8].
|
| 77 |
+
67 Despite the flexibility, constructive DP methods have not gained much popularity compared to
|
| 78 |
+
68 heuristic search approaches such as Ruin and Recreate [47], Adaptive Large Neighborhood Search
|
| 79 |
+
69 [46], LKH [24] or FILO [1]. While highly effective, these methods are limited in their flexibility as
|
| 80 |
+
70 special operators need to be engineered for different types of problems. While restricted DP was
|
| 81 |
+
71 shown to have superior performance on realistic VRPs with many constraints [20], the performance
|
| 82 |
+
72 gap of around $10 \%$ for standard (benchmark) VRPs (with time windows) is too large to popularize
|
| 83 |
+
73 the restricted dynamic programming approach. We argue that the missing ingredient for restricted
|
| 84 |
+
74 dynamic programming is the availability of a strong but computationally cheap policy for selecting
|
| 85 |
+
75 which solutions should be considered, which is the motivation behind DPDP.
|
| 86 |
+
76 In the machine learning community, recent advances have significantly improved deep neural networks
|
| 87 |
+
77 (DNNs) to perform tasks such as image classification and machine translation [32]. After the first
|
| 88 |
+
78 deep learning model was trained (using example solutions) to construct TSP tours [57], many
|
| 89 |
+
79 improvements have been proposed, e.g. different training strategies such as reinforcement learning
|
| 90 |
+
80 (RL) [5, 27, 12, 30] and model architectures, which enabled the same idea to be used for other
|
| 91 |
+
81 routing problems [41, 29, 13, 45, 16, 60]. Most constructive neural methods are auto-regressive,
|
| 92 |
+
82 evaluating the model many times to predict one node at the time, but other works have considered
|
| 93 |
+
83 predicting a ‘heatmap’ of promising edges at once [43, 26, 17], which allows a tour to be constructed
|
| 94 |
+
84 (using sampling or beam search) without further evaluating the model. An alternative direction is
|
| 95 |
+
85 ‘learning to search’, where a neural network is used to guide a search procedure such as local search
|
| 96 |
+
86 [7, 35, 18, 59, 25]. Some works have attempted scaling to larger instances beyond 100 nodes, which
|
| 97 |
+
87 remains challenging [36, 17]. The combination of machine learning with DP has been proposed in
|
| 98 |
+
88 limited settings [62, 52, 61]. Most related to our approach, a DP algorithm for TSPTW, guided by an
|
| 99 |
+
89 RL agent, was implemented using an existing solver [6] and a neural network predicting edges has
|
| 100 |
+
90 been combined with tree search [34] and local search for maximum independent set (MIS). For a
|
| 101 |
+
91 wider view on machine learning for routing problems and combinatorial optimization, see [38, 54].
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 1: Heatmap predictions (red) and solutions (colored) by DPDP (VRP depot edges omitted).
|
| 105 |
+
|
| 106 |
+

|
| 107 |
+
Figure 2: Deep Policy Dynamic Programming for the TSP. A GNN creates a (sparse) heatmap indicating promising edges, after which a tour is constructed using forward dynamic programming. In each step, at most $B$ solutions are expanded according to the heatmap policy, restricting the size of the search space. Partial solutions are dominated by shorter (lower cost) solutions with the same DP state: the same nodes visited (marked grey) and current node (indicated by dashed rectangles).
|
| 108 |
+
|
| 109 |
+
# 92 3 Deep Policy Dynamic Programming
|
| 110 |
+
|
| 111 |
+
93 DPDP uses an existing graph neural network [26] (which we modify for VRP and TSPTW) to predict
|
| 112 |
+
94 a heatmap of promising edges, which is used to derive the policy for scoring partial solutions in
|
| 113 |
+
95 the DP algorithm. The DP algorithm starts with a beam of a single initial (empty) solution. It then
|
| 114 |
+
96 proceeds by iterating the following steps: (1) all solutions on the beam are expanded, (2) dominated
|
| 115 |
+
97 solutions are removed for each $D P$ state, (3) the $B$ best solutions according to the scoring policy
|
| 116 |
+
98 define the beam for the next iteration. These steps are illustrated in Fig. 2. The objective function is
|
| 117 |
+
99 used to select the best solution from the final beam. The resulting algorithm is a beam search over the
|
| 118 |
+
100 DP state space (which is not a ‘standard beam search’ over the solution space!) and we call $B$ the
|
| 119 |
+
101 beam size. DPDP is asymptotically optimal as using $B = n \cdot 2 ^ { n }$ for a TSP with $n$ nodes guarantees
|
| 120 |
+
102 optimal results, but choosing smaller $B$ allows to trade performance for computational cost.
|
| 121 |
+
103 DPDP is a generic framework that can be applied to different problems, by defining the following
|
| 122 |
+
104 ingredients: (1) the state variables to track while constructing solutions, (2) the initial solution,
|
| 123 |
+
105 (3) feasible actions to expand solutions, (4) rules to define dominated solutions and (5) a scoring
|
| 124 |
+
106 policy for selecting the $B$ solutions to keep. A solution is always (uniquely) defined as a sequence of
|
| 125 |
+
107 actions, which allows the DP algorithm to construct the final solution by backtracking. In the next
|
| 126 |
+
108 sections, we define these ingredients for the TSP, VRP and TSPTW.
|
| 127 |
+
10 We implement DPDP for Euclidean TSPs with $n$ nodes on a (sparse) graph, where the cost for edge
|
| 128 |
+
11 $( i , j )$ is given by $c _ { i j }$ , the Euclidean distance between the coordinates of nodes $i$ and $j$ .
|
| 129 |
+
112 For each partial solution, defined by a sequence of actions $^ { a }$ , the state variables are $\displaystyle \cos t ( \pmb { a } )$ , the
|
| 130 |
+
113 total cost (distance), current $( a )$ , the current node, and visited $( a )$ , the set of visited nodes (including
|
| 131 |
+
114 the start node). Without loss of generality, we let 0 be the start node, so we initialize the beam at step
|
| 132 |
+
115 $t = 0$ with the empty initial solution with $\cos ( { \pmb a } ) = 0$ , current $( { \pmb a } ) = 0$ and $\mathrm { v i s i t e d } ( a ) = \{ 0 \}$ . At
|
| 133 |
+
116 step $t$ , the action $\bar { a } _ { t } \in \{ 0 , . . . , n - 1 \}$ indicates the next node to visit, and is a feasible action for a
|
| 134 |
+
117 partial solution $\pmb { a } = ( a _ { 0 } , . . . , a _ { t - 1 } )$ if $( a _ { t - 1 } , a _ { t } )$ is an edge in the graph and $a _ { t } \not \in { \mathrm { v i s i t e d } } ( a )$ , or, when
|
| 135 |
+
118 all are visited, if $a _ { t } = 0$ to return to the start node. When expanding the solution to $\pmb { a } ^ { \prime } = ( a _ { 0 } , . . . , a _ { t } )$ ,
|
| 136 |
+
119 we can compute the state variables incrementally as:
|
| 137 |
+
|
| 138 |
+
$$
|
| 139 |
+
\begin{array} { r } { \mathrm { c o s t } ( a ^ { \prime } ) = \mathrm { c o s t } ( a ) + { c } _ { \mathrm { c u r r e n t } ( a ) , a _ { t } } , \quad \mathrm { c u r r e n t } ( a ^ { \prime } ) = a _ { t } , \quad \mathrm { v i s i t e d } ( a ^ { \prime } ) = \mathrm { v i s i t e d } ( a ) \cup \{ a _ { t } \} . } \end{array}
|
| 140 |
+
$$
|
| 141 |
+
|
| 142 |
+
120 A (partial) solution $\textbf { \em a }$ is a dominated solution if there exists a (dominating) solution $\mathbf { \delta } \mathbf { a } ^ { * }$ such
|
| 143 |
+
121 that visited $( { \pmb a } ^ { * } ) = \mathrm { v i s i t e d } ( { \pmb a } )$ , current $( a ^ { * } ) = \operatorname { c u r r e n t } ( a )$ and $\mathrm { c o s t } ( { \pmb a } ^ { * } ) < \mathrm { c o s t } ( { \pmb a } )$ . The tuple
|
| 144 |
+
122 (visited $( a )$ , current $( a )$ ) we refer to as the $D P$ state, so removing all dominated partial solutions,
|
| 145 |
+
123 we keep exactly one minimum-cost solution for each unique DP state1. Since a solution can only
|
| 146 |
+
124 dominate other solutions with the same set of visited nodes, we only need to remove dominated
|
| 147 |
+
125 solutions from sets of solutions with the same number of actions. Therefore, we can efficiently
|
| 148 |
+
126 execute the DP algorithm in iterations, where at step $t$ all solutions have (after $t$ actions) $t + 1$ visited
|
| 149 |
+
127 nodes (including the start node), keeping the memory need at $O ( B )$ states (with $B$ the beam size).
|
| 150 |
+
128 We define the scoring policy using a pretrained model [26], which takes as input node coordinates
|
| 151 |
+
129 and edge distances to predict a raw ‘heatmap’ value $\hat { h } _ { i j } \in ( 0 , 1 )$ for each edge $( i , j )$ . The model was
|
| 152 |
+
130 trained to predict optimal solutions, so $\hat { h } _ { i j }$ can be seen as the probability that edge $( i , j )$ is in the
|
| 153 |
+
131 optimal tour. We force the heatmap to be symmetric thus we define $h _ { i j } = \operatorname* { m a x } \{ \hat { h } _ { i j } , \hat { h } _ { j i } \}$ . The policy
|
| 154 |
+
132 is defined using the heatmap values, in such a way to select the (partial) solutions with the largest
|
| 155 |
+
133 total heat, while also taking into account the (heat) potential for the unvisited nodes. The policy thus
|
| 156 |
+
134 selects the $B$ solutions which have the highest score, defined as $\operatorname { s c o r e } ( { a } ) = \operatorname { h e a t } ( { a } ) + \operatorname { p o t e n t i a l } ( { a } )$ ,
|
| 157 |
+
135 with $\begin{array} { r } { \mathrm { h e a t } ( { \pmb a } ) = \sum _ { i = 1 } ^ { t - 1 } h _ { a _ { i - 1 } , a _ { i } } } \end{array}$ , i.e. the sum of the heat of the edges, which can be computed
|
| 158 |
+
136 incrementally when expanding a solution. The potential is added as an estimate of the ‘heat-to
|
| 159 |
+
137 go’ (similar to the heuristic in $A ^ { * }$ search) for the remaining nodes, and avoids the ‘greedy pitfall’
|
| 160 |
+
138 of selecting the best edges while skipping over nearby nodes, which would prevent good edges
|
| 161 |
+
139 from being used later. It is defined as potentia $\begin{array} { r } { \mathsf { l } ( \pmb { a } ) = \bar { \mathrm { p o t e n t i a l } } _ { 0 } ( \pmb { a } ) + \sum _ { i \notin \mathrm { v i s i t e d } ( \pmb { a } ) } } \end{array}$ potential ${ \bf \nabla } _ { \mathrm { { i } } } ( { \bf a } )$
|
| 162 |
+
140 with potentiali(a) = wi Pj6∈visited(a) , where $w _ { i }$ is the node potential weight given by
|
| 163 |
+
141 $\begin{array} { r } { w _ { i } = ( \operatorname* { m a x } _ { j } h _ { j i } ) \cdot ( 1 - 0 . 1 ( \frac { c _ { i 0 } } { \operatorname* { m a x } _ { j } c _ { j 0 } } - \overline { { 0 . 5 } } ) ) } \end{array}$ . By normalizing the heatmap values for incoming
|
| 164 |
+
142 edges, the (remaining) potential for node $i$ is initially equal to $w _ { i }$ but decreases as good edges
|
| 165 |
+
143 become infeasible due to neighbours being visited. The node potential weight $w _ { i }$ is equal to the
|
| 166 |
+
144 maximum incoming edge heatmap value (an upper bound to the heat contributed by node $i$ ), which
|
| 167 |
+
145 gets multiplied by a factor 0.95 to 1.05 to give a higher weight to nodes closer to the start node, which
|
| 168 |
+
146 we found helps to encourage the algorithm to keep edges that enable to return to the start node. The
|
| 169 |
+
147 overall heat $^ +$ potential function identifies promising partial solutions and is computationally cheap.
|
| 170 |
+
|
| 171 |
+
# 3.2 Vehicle Routing Problem
|
| 172 |
+
|
| 173 |
+
For the VRP, we add a special depot node to the graph, indicated by DEP. Each node $i$ has a demand $d _ { i }$ , and the goal is to find multiple routes, which have a limited capacity denoted by CAPACITY.
|
| 174 |
+
|
| 175 |
+
Additionally to the TSP state variables $\displaystyle \cos t ( a )$ , $\mathrm { c u r r e n t } ( a )$ and visited $( a )$ , we keep track of capacity $( a )$ , which is the remaining capacity in the current route/vehicle. A solution starts at the depot, so we initialize the beam at step $t = 0$ with the empty initial solution with $\mathrm { c o s t } ( \pmb { a } ) = 0$ , ${ \mathrm { c u r r e n t } } ( { \pmb a } ) = { \mathrm { D E P } } , { \mathrm { v i s i t e d } } ( { \pmb a } ) = \emptyset$ and capacity $( a ) =$ CAPACITY. For the VRP, we do not consider visiting the depot as a separate action. Instead, we define $2 n$ actions, where $a _ { t } \in \{ 0 , . . . , 2 n - 1 \}$ . The actions $0 , . . . , n - 1$ indicate a direct move from the current node to node $a _ { t }$ , whereas the actions
|
| 176 |
+
|
| 177 |
+
157 $n , . . . , 2 n - 1$ indicate a move to node $a _ { t } - n$ via the depot. Feasible actions are those that move
|
| 178 |
+
158 to unvisited nodes via edges in the graph and obey the following constraints. For the first action
|
| 179 |
+
159 $a _ { 0 }$ there is no choice and we constrain (for convenience of implementation) $a _ { 0 } \in \{ n , . . . , 2 n - 1 \}$ .
|
| 180 |
+
160 A direct move $( a _ { t } < n )$ is only feasible if $d _ { a _ { t } } \leq \mathrm { c a p a c i t y } ( { \pmb a } )$ and updates the state similar to TSP
|
| 181 |
+
161 but reduces remaining capacity by $d _ { a _ { t } }$ . A move via the depot is always feasible (respecting the
|
| 182 |
+
162 163 graph edges and assuming demand, but incurs the ‘via $d _ { i } \leq \mathrm { C A P A C I T Y } \forall i )$ $c _ { i j } ^ { \tt D E P } = c _ { i , \tt D E P } + c _ { \tt D E P , , j }$ e vehicle CAPACITY before subtracting. When all nodes are visited, we allow a
|
| 183 |
+
164 special action to return to the depot. This somewhat unusual way of representing a CVRP solution
|
| 184 |
+
165 has desirable properties similar to the TSP formulation: at step $t$ we have exactly $t$ nodes visited, and
|
| 185 |
+
166 we can run the DP in iterations, removing dominated solutions at each step $t$ .
|
| 186 |
+
167 For VRP, a partial solution $^ { a }$ is a dominated solution dominated by $\mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \overline { { \delta \delta } } \mathbf { \delta } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm \mathrm { ~ } \mathrm { ~ } \mathrm \delta \mathrm { ~ } \mathrm { ~ } \delta \mathrm \mathrm { ~ } \delta \mathrm \mathrm { ~ } \delta \mathrm \mathrm { ~ } \delta \mathrm \mathrm \delta \mathrm \mathrm { ~ ~ } \delta \delta \mathrm \delta \mathrm \mathrm \delta \mathrm \delta \mathrm \mathrm \delta \mathrm \delta \delta \mathrm \delta \delta \mathrm \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta $ if v $\operatorname { i s i t e d } ( { \pmb a } ^ { * } ) = \operatorname { v i s i t e d } ( { \pmb a } )$
|
| 187 |
+
168 and current $( a ^ { * } ) = \mathrm { c u r r e n t } ( a )$ (i.e. $\mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } ( \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } ) \delta \mathbf { \delta } ( \delta \mathbf { \delta } ) \delta \mathbf { \delta } ( \delta \mathbf { \delta } ) \delta \delta \mathbf { \delta \delta } ( \delta \mathbf { \delta } ) \delta \delta ( \delta \mathbf { \delta } \mathrm { \delta \delta } ) \delta \delta \delta ( \delta \delta \mathbf { \delta } \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta$ corresponds to the same DP state) and $\mathrm { c o s t } ( { \pmb a } ^ { * } ) \leq \mathrm { c o s t } ( { \pmb a } )$
|
| 188 |
+
169 and capacity $( a ^ { * } ) \geq \mathrm { c a p a c i t y } ( a )$ , with at least one of the two inequalities being strict. This means
|
| 189 |
+
170 that for each DP state, given by the set of visited nodes and the current node, we do not only keep
|
| 190 |
+
171 the (single) solution with lowest cost (as in the TSP algorithm), but keep the complete set of pareto
|
| 191 |
+
172 efficient solutions in terms of cost and remaining vehicle capacity. This is because a higher cost
|
| 192 |
+
173 partial solution may still be preferred if it has more remaining vehicle capacity, and vice versa.
|
| 193 |
+
174 For the VRP scoring policy, we modify the model [26] to include the depot node and demands. The
|
| 194 |
+
175 special depot node gets a separate learned initial embedding parameter, and we add additional edge
|
| 195 |
+
176 types for connections to the depot, to mark the depot as being special. Additionally, each node gets
|
| 196 |
+
177 an extra input (next to its coordinates) corresponding to $d _ { i }$ /CAPACITY (where we set $d _ { \tt D E P } = 0 _ { , }$ ).
|
| 197 |
+
178 Apart from this, the model remains exactly the same2. The model is trained on example solutions
|
| 198 |
+
179 from LKH [24] (see Section 4.2), which are not optimal, but still provide a useful training signal.
|
| 199 |
+
180 Compared to TSP, the definition of the heat is slightly changed to accommodate for the ‘via-depot
|
| 200 |
+
181 actions’ and is best defined incrementally using the ‘via-depot heat’ $h _ { i j } ^ { \tt D E P } = h _ { i , \tt D E P } \cdot h _ { \tt D E P , \it j } \cdot \bar { 0 } . 1 .$
|
| 201 |
+
182 where multiplication is used to keep heat values interpretable as probabilities and in the range $( 0 , 1 )$ .
|
| 202 |
+
183 The additional penalty factor of 0.1 for visiting the depot encourages the algorithm to minimize the
|
| 203 |
+
184 number of vehicles/routes. The initial heat is 0 and when expanding a solution $\textbf { \em a }$ to $\mathbf { { a } ^ { \prime } }$ using action
|
| 204 |
+
185 $a _ { t }$ , the heat is incremented with either $h _ { \mathrm { c u r r e n t } ( \mathbf { a } ) , a _ { t } }$ (if $a _ { t } < n )$ or hDEPcurrent(a),at−n (if at ≥ n). The
|
| 205 |
+
186 potential is defined similarly to TSP, replacing the start node 0 by DEP.
|
| 206 |
+
|
| 207 |
+
# 3.3 Travelling Salesman Problem with Time Windows
|
| 208 |
+
|
| 209 |
+
188 For the TSPTW, we also have a special depot $/$ start node 0, and each node $i$ has a time window
|
| 210 |
+
189 defined by $( l _ { i } , u _ { i } )$ in which the node should be visited, assuming travel time is equal to cost/distance.
|
| 211 |
+
190 It is allowed to wait if arrival at a node is before $l _ { i }$ , but arrival cannot be after $u _ { i }$ (i.e. the constraint is
|
| 212 |
+
191 hard). We consider the objective to be minimizing total cost, but minimizing total time (or makespan)
|
| 213 |
+
192 only requires training on different example solutions. Due to the hard constraints, TSPTW is typically
|
| 214 |
+
193 considered more challenging to solve than plain TSP, for which every solution is feasible.
|
| 215 |
+
|
| 216 |
+
The state variables and initial solution are equal to TSP except that we add $\mathrm { t i m e } ( a )$ which is initially $0 ( = l _ { 0 } )$ . Feasible actions $a _ { t } \in \{ 0 , . . . , n - 1 \}$ are those that move to unvisited nodes via edges in the graph such that the arrival time is no later than $u _ { a _ { t } }$ and do not directly eliminate the possibility to visit other nodes in time3. Expanding a solution $\textbf { \em a }$ to $\mathbf { { \boldsymbol { a } } } ^ { \prime }$ using action $a _ { t }$ updates the time as $\mathrm { t i m e } ( { \pmb a } ^ { \prime } ) = \mathrm { m a x } \{ \mathrm { t i m e } ( { \pmb a } ) + c _ { \mathrm { c u r r e n t } ( { \pmb a } ) , { \pmb a } _ { t } } , \bar { l } _ { { \pmb a } _ { t } } \}$ .
|
| 217 |
+
|
| 218 |
+
For each DP state, we keep all efficient solutions in terms of cost and time, so a partial solution $\textbf { \em a }$ is a dominated solution dominated by $\mathbf { \delta } \mathbf { \mathbf { \vec { a } } } ^ { * }$ if $\mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \mathbf { \delta } \overline { { \delta \delta } } \mathbf { \delta } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm { ~ } \mathrm \mathrm { ~ } \mathrm { ~ } \mathrm \delta \mathrm { ~ } \mathrm { ~ } \delta \mathrm \mathrm { ~ } \delta \mathrm \mathrm { ~ } \delta \mathrm \mathrm { ~ } \delta \mathrm \mathrm \delta \mathrm \mathrm { ~ ~ } \delta \delta \mathrm \delta \mathrm \mathrm \delta \mathrm \delta \mathrm \mathrm \delta \mathrm \delta \delta \mathrm \delta \delta \mathrm \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta \delta $ has the same DP state $( \mathrm { v i s i t e d } ( { \pmb a } ^ { * } ) = \mathrm { v i s i t e d } ( { \pmb a } )$ and current $( { \pmb a } ^ { * } ) = \mathrm { c u r r e n t } ( { \pmb a } ) )$ and is strictly better in terms of cost and time, i.e. $\mathrm { c o s t } ( { \pmb a } ^ { * } ) \leq \mathrm { c o s t } ( { \pmb a } )$ and $\mathrm { t i m e } ( a ^ { * } ) \leq \mathrm { t i m e } ( a )$ , with at least one of the two inequalities being strict.
|
| 219 |
+
|
| 220 |
+
The model [26] for the scoring policy is adapted to include the time windows $( l _ { i } , u _ { i } )$ as node features (in the same unit as coordinates and costs), and we use a special embedding for the depot similar to VRP. Due to the time dimension, a TSPTW solution is directed, and edge $( i , j )$ may be good whereas $( j , i )$ may be not, so we adapt the model to enable predictions $h _ { i j } \neq h _ { j i }$ (see details in Appendix B). We generated example training solutions using (heuristic) DP with a large beam size, which was faster than using LKH. Given the heat predictions, the score (heat $^ +$ potential) is exactly as for TSP.
|
| 221 |
+
|
| 222 |
+
As described, the DP algorithm can take into account a sparse graph to define feasible expansions. As our problems are defined on sets of nodes rather than graphs, the use of a sparse graph is an artificial design choice, which allows to significantly reduce the runtime but may sacrifice the possibility to find good or optimal tours. We propose two different strategies for defining the sparse graph on which to run the DP: thresholding the heatmap values $h _ { i j }$ and using the K-nearest neighbour (KNN) graph. By default, we use a (low) heatmap threshold of $\mathrm { { 1 0 ^ { - 5 } } }$ , which rules out most of the edges as the model confidently predicts (close to) 0 for most edges. This is a secondary way to leverage the neural network (independent of the scoring policy), which can be seen as a form of learned problem reduction [49]. For symmetric problems (TSP and VRP), we add KNN edges in both directions. For the VRP, we additionally connect each node to the depot (and vice versa) to ensure feasibility.
|
| 223 |
+
|
| 224 |
+
# 20 3.5 Implementation $\pmb { \& }$ hyperparameters
|
| 225 |
+
|
| 226 |
+
We implement DPDP using PyTorch [44] to leverage batched computation on the GPU. For details, see Appendix A. Our code is publicly available. 4 DPDP has very few hyperparameters, but the heatmap threshold of $1 0 ^ { - 5 }$ and details like the functional form of e.g. the scoring policy are ‘educated guesses’ or manually tuned on a few validation instances and can likely be improved. The runtime is influenced by implementation choices which were manually selected using a few validation instances.
|
| 227 |
+
|
| 228 |
+
# 4 Experiments
|
| 229 |
+
|
| 230 |
+
# 4.1 Travelling Salesman Problem
|
| 231 |
+
|
| 232 |
+
In Table 1 we report our main results for DPDP with beam sizes of 10K (10 thousand) and 100K, for the TSP with 100 nodes on a commonly used test set [29]. We report results using Concorde [2], LKH [24] and Gurobi [22], as well as recent results of the strongest methods using neural networks (‘neural approaches’) from literature. Running times for solving 10000 instances after training should be taken as rough indications as some are on different machines, typically with 1 GPU or a many-core CPU (8 - 32). The costs indicated with \* are not directly comparable due to slight dataset differences [17]. Times for generating heatmaps (if applicable) is reported separately (as the first term) from the running time for MCTS [17] or DP. DPDP achieves close to optimal results, strictly outperforming the neural baselines achieving better results in less time (except POMO [30], see Section 4.2).
|
| 233 |
+
|
| 234 |
+
Table 1: Mean cost, gap and total time to solve 10000 TSP/VRP instances after training.
|
| 235 |
+
|
| 236 |
+
<table><tr><td>PROBLEM</td><td colspan="3">TSP100</td><td colspan="3">VRP100</td></tr><tr><td>METHOD</td><td>COST</td><td>GAP</td><td>TIME</td><td>COST</td><td>GAP</td><td>TIME</td></tr><tr><td>CONCORDE[2]</td><td>7.765</td><td>0.000 %</td><td>6M</td><td></td><td></td><td></td></tr><tr><td>HYBRID GENETIC SEARCH [56,55] GUROBI[22]</td><td>7.776</td><td></td><td>31M</td><td>15.563</td><td>0.000 %</td><td>6H11M</td></tr><tr><td>LKH [24]</td><td>7.765</td><td>0.151 % 0.000%</td><td>42M</td><td>15.647</td><td>0.536 %</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>12H57M</td></tr><tr><td>GNN HEATMAP +BEAM SEARCH[26] LEARNING 2-OPT HEURISTICS [9]</td><td>7.87</td><td>1.39 %</td><td>40M</td><td></td><td></td><td></td></tr><tr><td></td><td>7.83</td><td>0.87%</td><td>41M</td><td></td><td></td><td></td></tr><tr><td>MERGED GNNHEATMAP+MCTS[17]</td><td>7.764*</td><td>0.04%</td><td>4M + 11M</td><td></td><td></td><td></td></tr><tr><td>ATTENTION MODEL + SAMPLING [29]</td><td>7.94</td><td>2.26%</td><td>1H</td><td>16.23</td><td>4.28 %</td><td>2H</td></tr><tr><td>STEP-WISE ATTENTION MODEL [60]</td><td>8.01</td><td>3.20%</td><td>29s</td><td>16.49</td><td>5.96 %</td><td>39s</td></tr><tr><td>LEARNING IMPROV. HEURISTICS [59]</td><td>7.87</td><td>1.42 %</td><td>2H</td><td>16.03</td><td>3.00 %</td><td>5H</td></tr><tr><td>ATTENTION MODEL +POMO [30]</td><td>7.77</td><td>0.14 %</td><td>1M</td><td>15.76</td><td>1.26 %</td><td>2M</td></tr><tr><td>NEUREWRITER [7]</td><td></td><td></td><td></td><td>16.10</td><td>3.45 %</td><td>1H</td></tr><tr><td>DYNAMIC ATTN.MODEL + 2-OPT [45]</td><td></td><td></td><td></td><td>16.27</td><td>4.54 %</td><td>6H</td></tr><tr><td>NEUR.LRG.NEIGHB.SEARCH[25]</td><td></td><td></td><td></td><td>15.99</td><td>2.74 %</td><td>1H</td></tr><tr><td>LEARN TO IMPROVE [35]</td><td></td><td></td><td></td><td>15.57*</td><td>1</td><td>4000H</td></tr><tr><td>DPDP10K</td><td>7.765</td><td>0.009 %</td><td>10M + 16M</td><td>15.830</td><td>1.713 %</td><td>10M+50M</td></tr><tr><td>DPDP100K</td><td>7.765</td><td>0.004%</td><td>10M+2H35M</td><td>15.694</td><td>0.843%</td><td>10M+5H48M</td></tr><tr><td>DPDP1M</td><td></td><td></td><td></td><td>15.627</td><td>0.409 %</td><td>10M + 48H27M</td></tr></table>
|
| 237 |
+
|
| 238 |
+
Table 2: Mean cost, gap and total time to solve 10000 realistic [51] VRP100 instances after training.
|
| 239 |
+
|
| 240 |
+
<table><tr><td>METHOD</td><td>CoST</td><td>GAP</td><td>TIME (1 GPU OR 16 CPUs)</td><td>TIME(4 GPUs OR 32 CPUs)</td></tr><tr><td>HGS [56,55]</td><td>18050</td><td>0.000 %</td><td>7H53M</td><td>3H56M</td></tr><tr><td>LKH [24]</td><td>18133</td><td>0.507 %</td><td>25H32M</td><td>12H46M</td></tr><tr><td>DPDP 10K</td><td>18414</td><td>2.018 %</td><td>10M+50M</td><td>2M+13m</td></tr><tr><td>DPDP100K</td><td>18253</td><td>1.127 %</td><td>10M+5H48M</td><td>2M+1H27M</td></tr><tr><td>DPDP1M</td><td>18168</td><td>0.659 %</td><td>10M+48H27M</td><td>2M+12H7M</td></tr></table>
|
| 241 |
+
|
| 242 |
+
# 237 4.2 Vehicle Routing Problem
|
| 243 |
+
|
| 244 |
+
238 For the VRP, we train the model using 1 million instances of 100 nodes, generated according to the
|
| 245 |
+
239 distribution described by [41] and solved using one run of LKH [24]. We train using a batch size of
|
| 246 |
+
240 48 and a learning rate of $1 0 ^ { - 3 }$ (selected as the result of manual trials to best use our GPUs), for (at
|
| 247 |
+
241 most) 1500 epochs of 500 training steps (following [26]) from which we select the saved checkpoint
|
| 248 |
+
242 with the lowest validation loss. We use the validation and test sets by [29].
|
| 249 |
+
243 Table 1 shows the results compared to a recent implementation of Hybrid Genetic Search $( \mathrm { H G S } ) ^ { 5 }$ ,
|
| 250 |
+
244 a SOTA heuristic VRP solver [56, 55]. HGS is faster and improves around $0 . 5 \%$ over LKH, which
|
| 251 |
+
245 is typically considered the baseline in related work. We present the results for LKH, as well as the
|
| 252 |
+
246 strongest neural approaches and DPDP with beam sizes up to 1 million. Some results used 2000
|
| 253 |
+
247 (different) instances [35] and cannot be directly compared6. DPDP outperforms all other neural
|
| 254 |
+
248 baselines, except POMO [30], which delivers good results very quickly by exploiting symmetries in
|
| 255 |
+
249 the problem. However, as it cannot (easily) improve further with additional runtime, we consider this
|
| 256 |
+
250 contribution orthogonal to DPDP. DPDP is competitive to LKH (see also Section 4.4).
|
| 257 |
+
251 More realistic instances We also train the model and run experiments with instances with 100
|
| 258 |
+
252 nodes from a more realistic and challenging data distribution [51]. This distribution, commonly used
|
| 259 |
+
253 in the routing community, has greater variability, in terms of node clustering and demand distributions.
|
| 260 |
+
254 LKH failed to solve two of the test instances, which we found out is because LKH by default uses
|
| 261 |
+
255 a fixed number of routes equal to a lower bound, given by $\left\lceil \frac { \sum _ { i = 0 } ^ { n - 1 } d _ { i } } { \mathrm { C A P A C I T Y } } \right\rceil$ , which may be infeasible7.
|
| 262 |
+
256 Therefore we solve these instances by rerunning LKH with an unlimited number of allowed routes
|
| 263 |
+
257 (which in general gives worse results, see Section 4.4).
|
| 264 |
+
258 DPDP was run on a machine with 4 GPUs, but we also report (estimated) runtimes for 1 GPU
|
| 265 |
+
259 (1080Ti), and we compare against 16 or 32 CPUs for HGS and LKH. In Table 2 it can be seen that
|
| 266 |
+
260 the difference with LKH is, as expected, slightly larger than for the simpler dataset, but still below
|
| 267 |
+
261 $1 \%$ for beam sizes of 100K-1M. We also observed a higher validation loss, so it may be possible to
|
| 268 |
+
262 improve results using more training data. Nevertheless, finding solutions within $1 \%$ of the specialized
|
| 269 |
+
263 SOTA HGS algorithm, and even closer to LKH, is impressive for these challenging instances, and we
|
| 270 |
+
264 consider the runtime (for solving 10K instances) acceptable, especially when using multiple GPUs.
|
| 271 |
+
|
| 272 |
+
# 65 4.3 TSP with Time Windows
|
| 273 |
+
|
| 274 |
+
For the TSP with hard time window constraints, we use the data distribution by [6] and use their set of 100 test instances with 100 nodes. These were generated with small time windows, resulting in a small feasible search space, such that even with very small beam sizes, our DP implementation solves these instances optimally, eliminating the need for a policy. Therefore, we also consider a more difficult distribution similar to [10], which has larger time windows which are more difficult as the feasible search space is larger8 [15]. For details, see Appendix B. For both distributions, we generate training data and train the model exactly as we did for the VRP.
|
| 275 |
+
|
| 276 |
+
Table 3: Mean cost, gap and total time to solve TSPTW100 instances after training.
|
| 277 |
+
|
| 278 |
+
<table><tr><td rowspan="2">PROBLEM METHOD</td><td colspan="4">SMALL TIME WINDOWS [6](100 INST.)</td><td colspan="4">LARGE TIME WINDOWS [1O] (1OK INST.)</td></tr><tr><td>COST</td><td>GAP</td><td>FAIL</td><td>TIME</td><td>COST</td><td>GAP</td><td>FAIL</td><td>TIME</td></tr><tr><td>GVNS 30x [10]</td><td>5129.58</td><td>0.000 %</td><td></td><td>7s</td><td>2432.112</td><td>0.000 %</td><td></td><td>37M15s</td></tr><tr><td>GVNS 1x [10]</td><td>5129.58</td><td>0.000%</td><td></td><td><1s</td><td>2457.974</td><td>1.063 %</td><td></td><td>1M4s</td></tr><tr><td>LKH1x [24]</td><td>5130.32</td><td>0.014 %</td><td>1.00 %</td><td>5M48s</td><td>2431.404</td><td>-0.029 %</td><td></td><td>34H58M</td></tr><tr><td>BAB-DQN*[6]</td><td>5130.51</td><td>0.018 %</td><td></td><td>25H</td><td></td><td></td><td></td><td></td></tr><tr><td>ILDS-DQN*[6]</td><td>5130.45</td><td>0.017%</td><td></td><td>25H</td><td></td><td></td><td></td><td></td></tr><tr><td>DPDP 10K</td><td>5129.58</td><td>0.000 %</td><td></td><td>6s + 1s</td><td>2431.143</td><td>-0.040 %</td><td></td><td>10M +8M7S</td></tr><tr><td>DPDP 100K</td><td>5129.58</td><td>0.000%</td><td></td><td>6s +1s</td><td>2430.880</td><td>-0.051 %</td><td></td><td>10M + 1H16M</td></tr></table>
|
| 279 |
+
|
| 280 |
+
273 Table 3 shows the results for both data distributions, which are reported in terms of the difference
|
| 281 |
+
274 to General Variable Neighbourhood Search (GVNS) [10], the best open-source solver for TSPTW
|
| 282 |
+
275 we could find9, using 30 runs. For the small time window setting, both GVNS and DPDP find
|
| 283 |
+
276 optimal solutions for all 100 instances in just 7 seconds (in total, either on 16 CPUs or a single GPU).
|
| 284 |
+
277 LKH fails to solve one instance, but finds close to optimal solutions, but around 50 times slower.
|
| 285 |
+
278 $\mathrm { B a B - D Q N ^ { * } }$ and ILDS- $\mathrm { D Q N ^ { * } }$ [6], methods combining an existing solver with an RL trained neural
|
| 286 |
+
279 policy, take around 15 minutes per instance (orders of magnitudes slower) to solve most instances to
|
| 287 |
+
280 optimality. Due to complex set-up, we were unable to run BaB-DQN\* and ILDS-DQN\* ourselves for
|
| 288 |
+
281 the setting with larger time windows. In this setting, we find DPDP outperforms both LKH (where
|
| 289 |
+
282 DPDP is orders of magnitude faster) and GVNS, in both speed and solution quality. This illustrates
|
| 290 |
+
283 that DPDP, due to its nature, is especially well suited to handle constrained problems.
|
| 291 |
+
|
| 292 |
+
# 4.4 Ablations
|
| 293 |
+
|
| 294 |
+
Scoring policy To evaluate the value of different components of DPDP’s GNN Heat $^ +$ Potential scoring policy, we compare against other variants. GNN Heat is the version without the potential, whereas Cost Heat $^ +$ Potential and Cost Heat are variants that use a ‘heuristic’ $\begin{array} { r } { \hat { h } _ { i j } = \frac { c _ { i j } } { \operatorname* { m a x } _ { k } { c _ { i k } } } } \end{array}$ instead of the GNN. Cost directly uses the current cost of the solution, and can be seen as ‘classic’ restricted DP. Finally, BS GNN Heat $^ +$ Potential uses beam search without dynamic programming, i.e. without removing dominated solutions. To evaluate only the scoring policy, each variant uses the fully connected graph $( \mathrm { k n n } = n - 1 )$ ). Figure 3a shows the value of DPDP’s potential function, although even without it results are still significantly better than ‘classic’ heuristic DP variants using cost-based scoring policies. Also, it is clear that using DP significantly improves over a standard beam search (by removing dominated solutions). Lastly, the figure illustrates how the time for generating the heatmap using the neural network, despite its significant value, only makes up a small portion of the total runtime.
|
| 295 |
+
|
| 296 |
+
(a) Different scoring policies, as well as ‘pure’ beam search, for beam sizes 1, 10, 100, 1000, 10K, 100K.
|
| 297 |
+
|
| 298 |
+
(b) Beam sizes 10K, 25K, 50K, 100K, 250K, 500K, 1M, 2.5M compared against LKH(U) with 1, 2, 5 and 10 runs.
|
| 299 |
+
|
| 300 |
+

|
| 301 |
+
(c) Sparsities with heatmap thresholds 0.9, 0.5, 0.2, 0.1, $1 0 ^ { \overset { \cdot } { - } 2 }$ , $1 0 ^ { - 3 }$ , $1 0 ^ { - 4 }$ , $1 0 ^ { - 5 }$ and $\mathbf { k n n } = 5$ , 10, 20, 50, 99. Beam size $1 0 0 \mathrm { K }$ .
|
| 302 |
+
Figure 3: DPDP ablations on 100 validation instances of VRP with 100 nodes.
|
| 303 |
+
|
| 304 |
+
297 Beam size DPDP allows to trade off the performance vs. the runtime using the beam size $B$ (and to
|
| 305 |
+
298 some extent the graph sparsity, see Section 4.4). We illustrate this trade-off in Figure 3b, where we
|
| 306 |
+
299 evaluate DPDP on 100 validation instances for VRP, with different beam sizes from 10K to $2 . 5 \mathbf { M }$ .
|
| 307 |
+
300 We also report the trade-off curve for the LKH(U), which is the strongest baseline that can also
|
| 308 |
+
301 solve different problems. We vary the runtime using 1, 2, 5 and 10 runs (returning the best solution).
|
| 309 |
+
302 LKHU(nlimited) is the version which allows an unlimited number of routes (see Section 4.2). It is
|
| 310 |
+
303 hard to compare GPU vs CPU, so we report (estimated) runtimes for different hardware, i.e. 1 or 4
|
| 311 |
+
304 GPUs (with 3 CPUs per GPU) and 16 or 32 CPUs. We report the difference (i.e. the gap) with HGS,
|
| 312 |
+
305 analog to how results are reported in Table 1. We emphasize that in most related work (e.g. [29]), the
|
| 313 |
+
306 strongest baseline considered is one run of LKH, so we compare against a much stronger baseline.
|
| 314 |
+
307 Also, our goal is not to outperform HGS (which is SOTA and specific to VRP) or LKH, but to show
|
| 315 |
+
308 DPDP has reasonable performance, while being a flexible framework for other (routing) problems.
|
| 316 |
+
309 Graph sparsity We test the two graph sparsification strategies described in Section 3.4 as another
|
| 317 |
+
310 way to trade off performance and runtime of DPDP. In Figure 3c, we experiment with different
|
| 318 |
+
311 heatmap thresholds from $1 0 ^ { - 5 }$ to 0.9 and different values for KNN from 5 to 99 (fully connected).
|
| 319 |
+
312 The heatmap threshold strategy clearly outperforms the KNN strategy as it yields the same results
|
| 320 |
+
313 using sparser graphs (and lower runtimes). This illustrates that the heatmap threshold strategy is more
|
| 321 |
+
314 informed than the KNN strategy, confirming the value of the neural network predictions.
|
| 322 |
+
|
| 323 |
+
# 15 5 Discussion
|
| 324 |
+
|
| 325 |
+
In this paper we introduced Deep Policy Dynamic Programming, which combines machine learning and dynamic programming for solving vehicle routing problems. The method yields close to optimal results for TSPs with 100 nodes and is competitive to the highly optimized LKH [24] solver for VRPs with 100 nodes. On the TSP with time windows, DPDP also outperforms LKH, being significanlty faster, as well as GVNS [10], the best open source solver we could find. Given that DPDP was not specifically designed for TSPTW, and still has possibilities for improvement, we consider this an impressive and promising achievement.
|
| 326 |
+
|
| 327 |
+
The constructive nature of DPDP (combined with search) allows to efficiently address hard constraints such as time windows, which are typically considered challenging in neural combinatorial optimization [5, 29] and are also difficult for local search heuristics (as they need to maintain feasibility while adapting a solution). Given our results on TSP, VRP and TSPTW, and the flexibility of DP as a framework, we think DPDP has great potential for solving many more variants of routing problems, and possibly even other problems that can be formulated using DP (e.g. job shop scheduling [21]). We hope that our work brings machine learning research for combinatorial optimization closer to the operations research (especially vehicle routing) community, by combining machine learning with DP and evaluating the resulting new framework on different data distributions used by different communities [41, 51, 6, 10].
|
| 328 |
+
|
| 329 |
+
333 Scope, limitations & future work Deep learning for combinatorial optimization is a recent re
|
| 330 |
+
334 search direction, which could significantly impact the way practical optimization problems get solved
|
| 331 |
+
335 in the future. Currently, however, it is still hard to beat most SOTA problem specific solvers from the
|
| 332 |
+
336 OR community. Despite our success for TSPTW, DPDP is not yet a practical alternative in general,
|
| 333 |
+
337 but we do consider our results as highly encouraging for further research. We belief such research
|
| 334 |
+
338 could yield significant further improvement by addressing key current limitations: (1) the scalability
|
| 335 |
+
339 to larger instances, (2) the dependency on example solutions and (3) the heuristic nature of the scoring
|
| 336 |
+
340 function. First, while 100 nodes is not far from the size of common benchmarks ( $1 0 0 - 1 0 0 0$ for VRP
|
| 337 |
+
341 [51] and $2 0 - 2 0 0$ for TSPTW [10]), scaling is a challenge, mainly due to the ‘fully-connected’ $O ( n ^ { 2 } )$
|
| 338 |
+
342 graph neural network. Future work could reduce this complexity following e.g. [33]. The dependency
|
| 339 |
+
343 on example solutions from an existing solver also becomes more prominent for larger instances,
|
| 340 |
+
344 but could potentially be removed by ‘bootstrapping’ using DP itself as we, in some sense, have
|
| 341 |
+
345 done for TSPTW (see Section 3.3). Future work could iterate this process to train the model ‘tabula
|
| 342 |
+
346 rasa’ (without example solutions), where DP could be seen analogous to MCTS in AlphaZero [48].
|
| 343 |
+
347 Lastly, the heat $^ +$ potential score function is a well-motivated but heuristic function that was manually
|
| 344 |
+
348 designed as a function of the predicted heatmap. While it worked well for the three problems we
|
| 345 |
+
349 considered, it may need suitable adaption for other problems. Training this function end-to-end
|
| 346 |
+
350 [11, 58], while keeping a low computational footprint, would be an interesting topic for future work.
|
| 347 |
+
|
| 348 |
+
References
|
| 349 |
+
[1] Luca Accorsi and Daniele Vigo. A fast and scalable heuristic for the solution of large-scale capacitated vehicle routing problems. Technical report, Tech. rep., University of Bologna, 2020.
|
| 350 |
+
[2] David Applegate, Robert Bixby, Vasek Chvatal, and William Cook. Concorde TSP solver, 2006.
|
| 351 |
+
[3] Richard Bellman. On the theory of dynamic programming. Proceedings of the National Academy of Sciences of the United States of America, 38(8):716, 1952.
|
| 352 |
+
[4] Richard Bellman. Dynamic programming treatment of the travelling salesman problem. Journal of the ACM (JACM), 9(1):61–63, 1962.
|
| 353 |
+
[5] Irwan Bello, Hieu Pham, Quoc V Le, Mohammad Norouzi, and Samy Bengio. Neural combinatorial optimization with reinforcement learning. arXiv preprint arXiv:1611.09940, 2016.
|
| 354 |
+
[6] Quentin Cappart, Thierry Moisan, Louis-Martin Rousseau, Isabeau Prémont-Schwarz, and Andre Cire. Combining reinforcement learning and constraint programming for combinatorial optimization. arXiv preprint arXiv:2006.01610, 2020.
|
| 355 |
+
[7] Xinyun Chen and Yuandong Tian. Learning to perform local rewriting for combinatorial optimization. In Advances in Neural Information Processing Systems, volume 32, pages 6281–6292, 2019.
|
| 356 |
+
[8] William Cook and Paul Seymour. Tour merging via branch-decomposition. INFORMS Journal on Computing, 15(3):233–248, 2003.
|
| 357 |
+
[9] Paulo Roberto de O da Costa, Jason Rhuggenaath, Yingqian Zhang, and Alp Akcay. Learning 2- opt heuristics for the traveling salesman problem via deep reinforcement learning. Proceedings of Machine Learning Research, 1:17, 2020.
|
| 358 |
+
[10] Rodrigo Ferreira Da Silva and Sebastián Urrutia. A general vns heuristic for the traveling salesman problem with time windows. Discrete Optimization, 7(4):203–211, 2010.
|
| 359 |
+
[11] Hal Daumé III and Daniel Marcu. Learning as search optimization: Approximate large margin methods for structured prediction. In Proceedings of the 22nd international conference on Machine learning, pages 169–176, 2005.
|
| 360 |
+
[12] Arthur Delarue, Ross Anderson, and Christian Tjandraatmadja. Reinforcement learning with combinatorial actions: An application to vehicle routing. Advances in Neural Information Processing Systems, 33, 2020.
|
| 361 |
+
[13] Michel Deudon, Pierre Cournut, Alexandre Lacoste, Yossiri Adulyasak, and Louis-Martin Rousseau. Learning heuristics for the TSP by policy gradient. In International Conference on the Integration of Constraint Programming, Artificial Intelligence, and Operations Research, pages 170–181. Springer, 2018.
|
| 362 |
+
[14] Edsger W Dijkstra. A note on two problems in connexion with graphs. Numerische mathematik, 1(1):269–271, 1959.
|
| 363 |
+
[15] Yvan Dumas, Jacques Desrosiers, Eric Gelinas, and Marius M Solomon. An optimal algorithm for the traveling salesman problem with time windows. Operations research, 43(2):367–371, 1995.
|
| 364 |
+
[16] Jonas K Falkner and Lars Schmidt-Thieme. Learning to solve vehicle routing problems with time windows through joint attention. arXiv preprint arXiv:2006.09100, 2020.
|
| 365 |
+
[17] Zhang-Hua Fu, Kai-Bin Qiu, and Hongyuan Zha. Generalize a small pre-trained model to arbitrarily large tsp instances. arXiv preprint arXiv:2012.10658, 2020.
|
| 366 |
+
[18] Lei Gao, Mingxiang Chen, Qichang Chen, Ganzhong Luo, Nuoyi Zhu, and Zhixin Liu. Learn to design the heuristics for vehicle routing problem. arXiv preprint arXiv:2002.08539, 2020.
|
| 367 |
+
[19] Maxime Gasse, Didier Chetelat, Nicola Ferroni, Laurent Charlin, and Andrea Lodi. Exact combinatorial optimization with graph convolutional neural networks. In Advances in Neural Information Processing Systems. [20] Joaquim Gromicho, Jelke J van Hoorn, Adrianus Leendert Kok, and Johannes MJ Schutten. Restricted dynamic programming: a flexible framework for solving realistic vrps. Computers & operations research, 39(5):902–909, 2012.
|
| 368 |
+
01 [21] Joaquim AS Gromicho, Jelke J Van Hoorn, Francisco Saldanha-da Gama, and Gerrit T Timmer. Solving the job-shop scheduling problem optimally by dynamic programming. Computers & Operations Research, 39(12):2968–2977, 2012.
|
| 369 |
+
04 [22] Gurobi Optimization, LLC. Gurobi, 2018.
|
| 370 |
+
05 [23] Michael Held and Richard M Karp. A dynamic programming approach to sequencing problems. Journal of the Society for Industrial and Applied Mathematics, 10(1):196–210, 1962. [24] Keld Helsgaun. An extension of the Lin-Kernighan-Helsgaun TSP solver for constrained traveling salesman and vehicle routing problems: Technical report. 2017. [25] André Hottung and Kevin Tierney. Neural large neighborhood search for the capacitated vehicle routing problem. arXiv preprint arXiv:1911.09539, 2019. [26] Chaitanya K Joshi, Thomas Laurent, and Xavier Bresson. An efficient graph convolutional network technique for the travelling salesman problem. arXiv preprint arXiv:1906.01227, 2019. [27] Chaitanya K Joshi, Thomas Laurent, and Xavier Bresson. On learning paradigms for the travelling salesman problem. arXiv preprint arXiv:1910.07210, 2019. [28] AL Kok, Elias W Hans, Johannes MJ Schutten, and Willem HM Zijm. A dynamic programming heuristic for vehicle routing with time-dependent travel times and required breaks. Flexible services and manufacturing journal, 22(1-2):83–108, 2010. [29] Wouter Kool, Herke van Hoof, and Max Welling. Attention, learn to solve routing problems! In International Conference on Learning Representations, 2019. [30] Yeong-Dae Kwon, Jinho Choo, Byoungjip Kim, Iljoo Yoon, Youngjune Gwon, and Seungjai Min. Pomo: Policy optimization with multiple optima for reinforcement learning. Advances in Neural Information Processing Systems, 33, 2020.
|
| 371 |
+
23 [31] Gilbert Laporte. The vehicle routing problem: An overview of exact and approximate algorithms. European journal of operational research, 59(3):345–358, 1992. [32] Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436, 2015. [33] Juho Lee, Yoonho Lee, Jungtaek Kim, Adam Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In International Conference on Machine Learning, pages 3744–3753. PMLR, 2019. [34] Zhuwen Li, Qifeng Chen, and Vladlen Koltun. Combinatorial optimization with graph convolutional networks and guided tree search. Advances in Neural Information Processing Systems, page 539, 2018.
|
| 372 |
+
33 [35] Hao Lu, Xingwen Zhang, and Shuang Yang. A learning-based iterative method for solving vehicle routing problems. In International Conference on Learning Representations, 2020. [36] Qiang Ma, Suwen Ge, Danyang He, Darshan Thaker, and Iddo Drori. Combinatorial optimization by graph pointer networks and hierarchical reinforcement learning. arXiv preprint arXiv:1911.04936, 2019. [37] Chryssi Malandraki and Robert B Dial. A restricted dynamic programming heuristic algorithm for the time dependent traveling salesman problem. European Journal of Operational Research, 90(1):45–55, 1996.
|
| 373 |
+
41 [38] Nina Mazyavkina, Sergey Sviridov, Sergei Ivanov, and Evgeny Burnaev. Reinforcement learning for combinatorial optimization: A survey. arXiv preprint arXiv:2003.03600, 2020.
|
| 374 |
+
[39] Aristide Mingozzi, Lucio Bianco, and Salvatore Ricciardelli. Dynamic programming strategies for the traveling salesman problem with time window and precedence constraints. Operations research, 45(3):365–377, 1997.
|
| 375 |
+
[40] Vinod Nair, Sergey Bartunov, Felix Gimeno, Ingrid von Glehn, Pawel Lichocki, Ivan Lobov, Brendan O’Donoghue, Nicolas Sonnerat, Christian Tjandraatmadja, Pengming Wang, et al. Solving mixed integer programs using neural networks. arXiv preprint arXiv:2012.13349, 2020.
|
| 376 |
+
[41] MohammadReza Nazari, Afshin Oroojlooy, Lawrence Snyder, and Martin Takac. Reinforcement learning for solving the vehicle routing problem. In Advances in Neural Information Processing Systems, pages 9860–9870, 2018.
|
| 377 |
+
[42] Clara Novoa and Robert Storer. An approximate dynamic programming approach for the vehicle routing problem with stochastic demands. European Journal of Operational Research, 196(2):509–515, 2009.
|
| 378 |
+
[43] Alex Nowak, Soledad Villar, Afonso S Bandeira, and Joan Bruna. A note on learning algorithms for quadratic assignment with graph neural networks. arXiv preprint arXiv:1706.07450, 2017.
|
| 379 |
+
[44] Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
|
| 380 |
+
[45] Bo Peng, Jiahai Wang, and Zizhen Zhang. A deep reinforcement learning algorithm using dynamic attention model for vehicle routing problems. In International Symposium on Intelligence Computation and Applications, pages 636–650. Springer, 2019.
|
| 381 |
+
[46] Stefan Ropke and David Pisinger. An adaptive large neighborhood search heuristic for the pickup and delivery problem with time windows. Transportation science, 40(4):455–472, 2006.
|
| 382 |
+
[47] Gerhard Schrimpf, Johannes Schneider, Hermann Stamm-Wilbrandt, and Gunter Dueck. Record breaking optimization results using the ruin and recreate principle. Journal of Computational Physics, 159(2):139–171, 2000.
|
| 383 |
+
[48] David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. A general reinforcement learning algorithm that masters chess, shogi, and go through self-play. Science, 362(6419):1140–1144, 2018.
|
| 384 |
+
[49] Yuan Sun, Andreas Ernst, Xiaodong Li, and Jake Weiner. Generalization of machine learning for problem reduction: a case study on travelling salesman problems. OR Spectrum, pages 1–27, 2020.
|
| 385 |
+
[50] Paolo Toth and Daniele Vigo. Vehicle routing: problems, methods, and applications. SIAM, 2014.
|
| 386 |
+
[51] Eduardo Uchoa, Diego Pecin, Artur Pessoa, Marcus Poggi, Thibaut Vidal, and Anand Subramanian. New benchmark instances for the capacitated vehicle routing problem. European Journal of Operational Research, 257(3):845–858, 2017.
|
| 387 |
+
[52] Wouter van Heeswijk and Han La Poutré. Approximate dynamic programming with neural networks in linear discrete action spaces. arXiv preprint arXiv:1902.09855, 2019.
|
| 388 |
+
[53] Jelke J. van Hoorn. Dynamic Programming for Routing and Scheduling. PhD thesis, 2016.
|
| 389 |
+
[54] Natalia Vesselinova, Rebecca Steinert, Daniel F Perez-Ramirez, and Magnus Boman. Learning combinatorial optimization on graphs: A survey with applications to networking. IEEE Access, 8:120388–120416, 2020.
|
| 390 |
+
[55] Thibaut Vidal. Hybrid genetic search for the cvrp: Open-source implementation and swap\* neighborhood. arXiv preprint arXiv:2012.10384, 2020.
|
| 391 |
+
[56] Thibaut Vidal, Teodor Gabriel Crainic, Michel Gendreau, Nadia Lahrichi, and Walter Rei. A hybrid genetic algorithm for multidepot and periodic vehicle routing problems. Operations Research, 60(3):611–624, 2012.
|
| 392 |
+
[57] Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pages 2692–2700, 2015.
|
| 393 |
+
[58] Sam Wiseman and Alexander M Rush. Sequence-to-sequence learning as beam-search optimization. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1296–1306, 2016.
|
| 394 |
+
[59] Yaoxin Wu, Wen Song, Zhiguang Cao, Jie Zhang, and Andrew Lim. Learning improvement heuristics for solving routing problems. arXiv preprint arXiv:1912.05784, 2019.
|
| 395 |
+
[60] Liang Xin, Wen Song, Zhiguang Cao, and Jie Zhang. Step-wise deep learning models for solving routing problems. IEEE Transactions on Industrial Informatics, 2020.
|
| 396 |
+
[61] Shenghe Xu, Shivendra S Panwar, Murali Kodialam, and TV Lakshman. Deep neural network approximated dynamic programming for combinatorial optimization. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 1684–1691, 2020.
|
| 397 |
+
[62] Feidiao Yang, Tiancheng Jin, Tie-Yan Liu, Xiaoming Sun, and Jialin Zhang. Boosting dynamic programming with neural networks for solving np-hard problems. In Asian Conference on Machine Learning, pages 726–739. PMLR, 2018.
|
| 398 |
+
|
| 399 |
+
1. For all authors...
|
| 400 |
+
|
| 401 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 402 |
+
(b) Did you describe the limitations of your work? [Yes] Scaling and scoring policy, see discussion
|
| 403 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No] We do not see any issues
|
| 404 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 405 |
+
|
| 406 |
+
2. If you are including theoretical results...
|
| 407 |
+
|
| 408 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] For claim that DPDP is asymptotically optimal, the DP description defines the set of assumptions and we note the beam size for which this holds.
|
| 409 |
+
(b) Did you include complete proofs of all theoretical results? [No] Optimality and complexity of full DP for TSP is already known [23, 4] (we do not claim this is a new result, we just mention it)
|
| 410 |
+
|
| 411 |
+
3. If you ran experiments...
|
| 412 |
+
|
| 413 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Code will be available upon release
|
| 414 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We did a fair job to include all the information necessary to reproduce the experiments
|
| 415 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] For training the model, we used a standard supervised learning setup and we found training to be stable across different problems and data distributions. Due to high computational costs, we did not do multiple runs, which we consider conservative as likely results can be improved by further experiments and training with multiple seeds. As for evaluation of the algorithms on random instances, we use a large test set of 10.000 instances. As we use the same instances for our own implemented baselines, the statistical significance in such a ‘paired’ setting is much higher than would be suggested by error bars. For results directly reported from other papers, the margin is large enough with 10000 instances or we avoid strong claims. With our code, we plan to release all solutions for all test instances for the methods we evaluated ourselves.
|
| 416 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] While not explicitly, the total computational requirement for generating training data, which requires the most compute, can be derived from solving 1M instances and the time reported for solving 10K instances in Table 1. This is a number of days (around 4) on a cluster with 10 32-core machines, per problem.
|
| 417 |
+
|
| 418 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 419 |
+
|
| 420 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 421 |
+
(b) Did you mention the license of the assets? [No] This can be found in the original repositories
|
| 422 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Will be provided with the released code as URL
|
| 423 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] Data is public or provided in personal communication, consent for publication was given
|
| 424 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 425 |
+
|
| 426 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 427 |
+
|
| 428 |
+
560 (a) Did you include the full text of instructions given to participants and screenshots, if
|
| 429 |
+
561 applicable? [N/A]
|
| 430 |
+
562 (b) Did you describe any potential participant risks, with links to Institutional Review
|
| 431 |
+
563 Board (IRB) approvals, if applicable? [N/A]
|
| 432 |
+
564 (c) Did you include the estimated hourly wage paid to participants and the total amount
|
| 433 |
+
565 spent on participant compensation? [N/A]
|
md/train/OG18MI5TRL/OG18MI5TRL.md
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
|
| 2 |
+
|
| 3 |
+
nze Xie1 Wenhai Wang2 Zhiding $\mathbf { Y } \mathbf { u } ^ { 3 * }$ Anima Anandkumar3,4 Jose M. Alvarez3 Ping Luo1 1The University of Hong Kong 2Nanjing University 3NVIDIA 4Caltech
|
| 4 |
+
|
| 5 |
+
xieenze@hku.hk, wangwenhai362@163.com, {zhidingy,josea,aanandkumar}@nvidia.com, pluo@cs.hku.hk
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
We present SegFormer, a simple, efficient yet powerful semantic segmentation framework which unifies Transformers with lightweight multilayer perceptron (MLP) decoders. SegFormer has two appealing features: 1) SegFormer comprises a novel hierarchically structured Transformer encoder which outputs multiscale features. It does not need positional encoding, thereby avoiding the interpolation of positional codes which leads to decreased performance when the testing resolution differs from training. 2) SegFormer avoids complex decoders. The proposed MLP decoder aggregates information from different layers, and thus combining both local attention and global attention to render powerful representations. We show that this simple and lightweight design is the key to efficient segmentation on Transformers. We scale our approach up to obtain a series of models from SegFormer-B0 to SegFormer-B5, reaching significantly better performance and efficiency than previous counterparts. For example, SegFormer-B4 achieves $5 0 . 3 \%$ mIoU on ADE20K with 64M parameters, being $5 \times$ smaller and $2 . 2 \%$ better than the previous best method. Our best model, SegFormer-B5, achieves $8 4 . 0 \%$ mIoU on Cityscapes validation set and shows excellent zero-shot robustness on Cityscapes-C. Code is available at: github.com/NVlabs/SegFormer.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Semantic segmentation is a fundamental task in computer vision and enables many downstream applications. It is related to image classification since it produces per-pixel category prediction instead of image-level prediction. This relationship is pointed out and systematically studied in a seminal work [1], where the authors used fully convolutional networks (FCNs) for semantic segmentation tasks. Since then, FCN has inspired many follow-up works and has become a predominant design choice for dense prediction.
|
| 14 |
+
|
| 15 |
+
Since there is a strong relation between classification and semantic segmentation, many stateof-the-art semantic segmentation frameworks are variants of popular architectures for image classification on ImageNet. Therefore, designing backbone architectures has remained an active area
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Performance vs. model efficiency on ADE20K. SegFormer achieves a new state-of-the-art $5 1 . 0 \%$ mIoU while being significantly more efficient than previous methods.
|
| 19 |
+
|
| 20 |
+
in semantic segmentation. Indeed, starting from early methods using VGGs [1, 2], to the latest methods with significantly deeper and more powerful backbones [3], the evolution of backbones has dramatically pushed the performance boundary of semantic segmentation. Besides backbone architectures, another line of work formulates semantic segmentation as a structured prediction problem, and focuses on designing modules and operators, which can effectively capture contextual information. A representative example in this area is dilated convolution [4, 5], which increases the receptive field by “inflating” the kernel with holes.
|
| 21 |
+
|
| 22 |
+
Witnessing the great success in natural language processing (NLP), there has been a recent surge of interest to introduce Transformers to vision tasks. Dosovitskiy et al. [6] proposed vision Transformer (ViT) for image classification. Following the Transformer design in NLP, the authors split an image into multiple linearly embedded patches and feed them into a standard Transformer with positional embeddings (PE), leading to an impressive performance on ImageNet. In semantic segmentation, Zheng et al. [7] proposed SETR to demonstrate the feasibility of using Transformers in this task.
|
| 23 |
+
|
| 24 |
+
SETR adopts ViT as a backbone and incorporates several CNN decoders to enlarge feature resolution. Despite the good performance, ViT has two important limitations: 1) ViT outputs single-scale lowresolution features instead of multi-scale ones, and 2) it has very high computational cost on large images. To address these limitations, Wang et al. [8] proposed a pyramid vision Transformer (PVT), a natural extension of ViT with pyramid structures for dense prediction. PVT shows considerable improvements over the ResNet counterpart on object detection and semantic segmentation. However, together with other emerging methods such as Swin Transformer [9] and Twins [10], these methods mainly consider the design of the Transformer encoder, neglecting the contribution of the decoder for further improvements.
|
| 25 |
+
|
| 26 |
+
This paper introduces SegFormer, a cutting-edge Transformer framework for semantic segmentation that jointly considers efficiency, accuracy, and robustness. In contrast to previous methods, our framework redesigns both the encoder and the decoder. The key novelties of our approach are:
|
| 27 |
+
|
| 28 |
+
• A novel positional-encoding-free and hierarchical Transformer encoder.
|
| 29 |
+
• A lightweight All-MLP decoder design that yields a powerful representation without complex and computationally demanding modules.
|
| 30 |
+
• As shown in Figure 1, SegFormer sets new a state-of-the-art in terms of efficiency, accuracy and robustness in three publicly available semantic segmentation datasets.
|
| 31 |
+
|
| 32 |
+
First, the proposed encoder avoids interpolating positional codes when performing inference on images with resolutions different from the training one. As a result, our encoder can easily adapt to arbitrary test resolutions without impacting the performance. In addition, the hierarchical part enables the encoder to generate both high-resolution fine features and low-resolution coarse features, this is in contrast to ViT that can only produce single low-resolution feature maps with fixed resolutions. Second, we propose a lightweight MLP decoder where the key idea is to take advantage of the Transformer-induced features where the attentions of lower layers tend to stay local, whereas the ones of the highest layers are highly non-local. By aggregating the information from different layers, the MLP decoder combines both local and global attention. As a result, we obtain a simple and straightforward decoder that renders powerful representations.
|
| 33 |
+
|
| 34 |
+
We demonstrate the advantages of SegFormer in terms of model size, run-time, and accuracy on three publicly available datasets: ADE20K, Cityscapes, and COCO-Stuff. On Citysapces, our lightweight model, SegFormer-B0, without accelerated implementations such as TensorRT, yields $7 1 . 9 \%$ mIoU at 48 FPS, which, compared to ICNet [11], represents a relative improvement of $60 \%$ and $4 . 2 \%$ i n latency and performance, respectively. Our largest model, SegFormer-B5, yields $8 4 . 0 \%$ mIoU, which represents a relative $1 . 8 \%$ mIoU improvement while being $5 \times$ faster than SETR [7]. On ADE20K, this model sets a new state-of-the-art of $5 1 . 8 \%$ mIoU while being $4 \times$ smaller than SETR. Moreover, our approach is significantly more robust to common corruptions and perturbations than existing methods, therefore being suitable for safety-critical applications. Code will be publicly available.
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 2: The proposed SegFormer framework consists of two main modules: A hierarchical Transformer encoder to extract coarse and fine features; and a lightweight All-MLP decoder to directly fuse these multi-level features and predict the semantic segmentation mask. “FFN” indicates feed-forward network.
|
| 38 |
+
|
| 39 |
+
# 2 Related Work
|
| 40 |
+
|
| 41 |
+
Semantic Segmentation. Semantic segmentation can be seen as an extension of image classification from image level to pixel level. In the deep learning era [12–14], FCN [1] is the fundamental work of semantic segmentation, which is a fully convolution network that performs pixel-to-pixel classification in an end-to-end manner. After that, researchers focused on improving FCN from different aspects such as: enlarging the receptive field [15–17, 5, 2, 4, 18]; refining the contextual information [19– 27]; introducing boundary information [28–35]; designing various attention modules [36–44]; or using AutoML technologies [45–49]. These methods significantly improve semantic segmentation performance at the expense of introducing many empirical modules, making the resulting framework computationally demanding and complicated. More recent methods have proved the effectiveness of Transformer-based architectures for semantic segmentation [7, 44]. However, these methods are still computationally demanding.
|
| 42 |
+
|
| 43 |
+
Transformer backbones. ViT [6] is the first work to prove that a pure Transformer can achieve state-of-the-art performance in image classification. ViT treats each image as a sequence of tokens and then feeds them to multiple Transformer layers to make the classification. Subsequently, DeiT [50] further explores a data-efficient training strategy and a distillation approach for ViT. More recent methods such as T2T ViT [51], CPVT [52], TNT [53], CrossViT [54] and LocalViT [55] introduce tailored changes to ViT to further improve image classification performance.
|
| 44 |
+
|
| 45 |
+
Beyond classification, PVT [8] is the first work to introduce a pyramid structure in Transformer, demonstrating the potential of a pure Transformer backbone compared to CNN counterparts in dense prediction tasks. After that, methods such as Swin [9], CvT [56], CoaT [57], LeViT [58] and Twins [10] enhance the local continuity of features and remove fixed size position embedding to improve the performance of Transformers in dense prediction tasks.
|
| 46 |
+
|
| 47 |
+
Transformers for specific tasks. DETR [50] is the first to use Transformers for end-to-end object detection framework without non-maximum suppression (NMS). Other works have also used Transformers in tasks such as tracking [59, 60], super-resolution [61], re-id [62], colorization [63], retrieval [64] and multi-modal learning [65, 66]. For semantic segmentation, SETR [7] adopts ViT [6] as a backbone to extract features, achieving impressive performance. However, these Transformer-based methods have very low efficiency and, thus, difficult to deploy in real-time applications.
|
| 48 |
+
|
| 49 |
+
# 3 Method
|
| 50 |
+
|
| 51 |
+
As depicted in Figure 2, SegFormer consists of two main modules: (1) a hierarchical Transformer encoder; and (2) a lightweight All-MLP decoder to predict the final mask. Given an image with size $H \times W \times 3$ , we first divide it into patches of size $4 \times 4$ . Unlike ViT which uses $1 6 \times 1 6$ , using fine-grained patches favors semantic segmentation. Second, we use these patches as input to the hierarchical Transformer encoder to get multi-level features with resolution {1/4, 1/8, 1/16, 1/32} of the original image. We then pass these multi-level features to the All-MLP decoder to predict the segmentation mask with a $\begin{array} { r } { \frac { H } { 4 } \times \frac { W } { 4 } \times N _ { c l s } } \end{array}$ resolution, where $N _ { c l s }$ is the number of categories. In the remainder of this section, we first detail the proposed encoder and decoder designs and then summarize the main differences of our approach compared to SETR.
|
| 52 |
+
|
| 53 |
+
# 3.1 Hierarchical Transformer Encoder
|
| 54 |
+
|
| 55 |
+
We design a series of Mix Transformer encoders (MiT), MiT-B0 to MiT-B5, with the same architecture but different sizes. On top of the hierarchical architecture and efficient self-attention module in PVT [8], we further propose several novel features including overlapped patch merging and positional-encoding-free design which will be shown to greatly benefit the segmentation tasks.
|
| 56 |
+
|
| 57 |
+
Hierarchical Feature Representation. Unlike ViT [6], our encoder generates multi-level multi-scale features given an input image. These features provide both high-resolution coarse features and lowresolution fine-grained features that boost the performance of semantic segmentation. Specifically, givemap n input image with siwith a resolution of $H \times W \times 3$ perform, where to o, and a hierarchical fis larger than ure . $F _ { i }$ $\begin{array} { r } { \frac { H } { 2 ^ { i + 1 } } \times \frac { W } { 2 ^ { i + 1 } } \times C _ { i } } \end{array}$ $i \in \{ 1 , 2 , 3 , 4 \}$ $C _ { i + 1 }$ $C _ { i }$
|
| 58 |
+
|
| 59 |
+
Efficient Self-Attention. A major bottleneck of the above hierarchical feature representation is the quadratic self-attention complexity with long sequence inputs from higher resolution features. Recall that in the original multi-head self-attention, each of the heads $Q , K , V$ have the same dimensions $N \times C$ , where $N = H \times W$ is the length of the sequence, the self-attention is estimated as:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\mathrm { A t t e n t i o n } ( Q , K , V ) = \mathrm { S o f t m a x } ( \frac { Q K ^ { \mathsf { T } } } { \sqrt { d _ { h e a d } } } ) V .
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
We instead adopt the sequence reduction process introduced in [8]. This process uses a reduction ratio $R$ to reduce the length of the sequence of as follows:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\begin{array} { l } { { \displaystyle \hat { K } = \mathrm { R e s h a p e } ( \frac { N } { R } , C \cdot R ) ( K ) } } \\ { { \displaystyle K = \mathrm { L i n e a r } ( C \cdot R , C ) ( \hat { K } ) , } } \end{array}
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $K$ is the sequence to be reduced, Reshape $\begin{array} { r } { \big ( \frac { N } { R } , C \cdot R ) ( K ) } \end{array}$ refers to reshape $K$ to the one with shape of NR $\begin{array} { r } { \frac { N } { R } \times ( C \cdot R ) } \end{array}$ , and Linear $( C _ { i n } , C _ { o u t } ) ( \cdot )$ refers to a linear layer taking a $C _ { i n }$ -dimensional tensor as input and generating a $C _ { o u t }$ -dimensional tensor as output. Therefore, the new $K$ has dimensions $\begin{array} { r } { \frac { N } { R } \times C } \end{array}$ . As a result, the complexity of the self-attention mechanism is reduced from $O ( N ^ { 2 } )$ to $O ( \textstyle { \frac { N ^ { 2 } } { R } } )$ . In our experiments, we set $R$ to [64, 16, 4, 1] from stage-1 to stage-4.
|
| 72 |
+
|
| 73 |
+
Overlapped Patch Merging. Given an image patch, the patch merging process used in ViT, unifies a $N \times N \times 3$ patch into a $1 \times 1 \times C$ vector. This can easily be extended to unify a $2 \times 2 \times C _ { i }$ feature path into a $1 \times 1 \times C _ { i + 1 }$ vector to obtain hierarchical feature maps. Using this, we can shrink our hierarchical features from other feature map in the hierar $F _ { 1 }$ . $\begin{array} { r } { \frac { H } { 4 } \times \frac { W } { 4 } \times C _ { 1 } ) } \end{array}$ to s i $F _ { 2 }$ a $\begin{array} { r } { ( \frac { H } { 8 } \times \frac { W } { 8 } \times C _ { 2 } ) } \end{array}$ , and then iterate for anycombine non-overlapping image or feature patches. Therefore, it fails to preserve the local continuity around those patches. Instead, we use an overlapping patch merging process. To this end, we define $K , S ,$ , and $P$ , where $K$ is the patch size, $S$ is the stride between two adjacent patches, and $P$ is the padding size. In our experiments, we set $K = 7$ , $S = 4$ , $P = 3$ ,and $K = 3$ , $S = 2$ , $P = 1$ to perform overlapping patch merging to produces features with the same size as the non-overlapping process. Similar to the original patch embedding in ViT [6], this operation can be implemented by “nn.Conv2D” in PyTorch.
|
| 74 |
+
|
| 75 |
+
Positional-Encoding-Free Design. The resolution of the PE in ViT is fixed. One thus needs to interpolate the PE when the test resolution differs from training. This leads to the drop of accuracy, which is undesirable since the resolution mismatch is common in semantic segmentation. We instead introduce Mix-FFN where we consider the effect of zero padding to the leak location information [67] by directly using a $3 \times 3$ Conv in the feed-forward network (FFN). Mix-FFN is formulated as:
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\begin{array} { r } { { \bf x } _ { o u t } = \bf M L P ( \mathrm { G E L U } ( \mathrm { C o n v } _ { 3 \times 3 } ( \mathbf { M L P } ( \mathbf { x } _ { i n } ) ) ) ) + x _ { i n } , } \end{array}
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where ${ \bf x } _ { i n }$ is the feature from the self-attention module. Mix-FFN mixes a $3 \times 3$ convolution and an MLP into each FFN. In our experiments, we will show that a $3 \times 3$ convolution is sufficient to provide positional information for Transformers. In particular, we use depth-wise convolutions for reducing the number of parameters and improving efficiency.
|
| 82 |
+
|
| 83 |
+
It should be mentioned that CPVT [52] also alleviates this issue by using a $3 \times 3$ Conv to generate conditional PE at different resolutions and then add it to the feature map. Our work conceptually goes one step further as we argue that adding PE to feature map is not necessary in semantic segmentation. Another recent work CvT [56] introduced $3 \times 3$ Convs to model the spatial relationship among tokens. Despite the converging design, our work differs in both motivation and application as we aim to totally remove PEs to handle the training/testing resolution mismatch issue in semantic segmentation. Our intuition started from [67] whereas the same intuition was not discussed in CvT.
|
| 84 |
+
|
| 85 |
+
# 3.2 Lightweight All-MLP Decoder
|
| 86 |
+
|
| 87 |
+
SegFormer incorporates a lightweight decoder consisting only of MLP layers and this avoiding the hand-crafted and computationally demanding components typically used in other methods. The key to enabling such a simple decoder is that our hierarchical Transformer encoder has a larger effective receptive field (ERF) than traditional CNN encoders.
|
| 88 |
+
|
| 89 |
+
The proposed All-MLP decoder consists of four main steps. First, multi-level features $F _ { i }$ from the MiT encoder go through an MLP layer to unify the channel dimension. Then, in a second step, features are up-sampled to 1/4th and concatenated together. Third, a MLP layer is adopted to fuse the concatenated features $F$ . Finally, another MLP layer takes the fused feature to predict the segmentation mask $M$ with a $\begin{array} { r } { \frac { H } { 4 } \times \frac { W } { 4 } \times N _ { c l s } } \end{array}$ resolution, where $N _ { c l s }$ is the number of categories. This lets us formulate the decoder as:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\begin{array} { r l } & { \hat { F } _ { i } = \mathrm { L i n e a r } ( C _ { i } , C ) ( F _ { i } ) , \forall i } \\ & { \hat { F } _ { i } = \mathrm { U p s a m p l e } ( \cfrac { W } { 4 } \times \cfrac { W } { 4 } ) ( \hat { F } _ { i } ) , \forall i } \\ & { F = \mathrm { L i n e a r } ( 4 C , C ) ( \mathrm { C o n c a t } ( \hat { F } _ { i } ) ) , \forall i } \\ & { M = \mathrm { L i n e a r } ( C , N _ { c l s } ) ( F ) , } \end{array}
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where M refers to the predicted mask, and Linear $( C _ { i n } , C _ { o u t } ) ( \cdot )$ refers to a linear layer with $C _ { i n }$ and $C _ { o u t }$ as input and output vector dimensions respectively.
|
| 96 |
+
|
| 97 |
+
Effective Receptive Field Analysis. For semantic segmentation, maintaining large receptive field to include context information has been a central issue [5, 17, 18]. Here, we use effective receptive field (ERF) [68] as a toolkit to visualize and interpret why our MLP decoder design is so effective on Transformers. In Figure 3, we visualize ERFs of the four encoder stages and the decoder heads for both DeepLabv $^ { 3 + }$ and SegFormer. We can make the following observations:
|
| 98 |
+
|
| 99 |
+

|
| 100 |
+
Figure 3: Effective Receptive Field (ERF) on Cityscapes (average over 100 images). Top row: Deeplabv $^ { 3 + }$ . Bottom row: SegFormer. ERFs of the four stages and the decoder heads of both architectures are visualized. Best viewed with zoom in.
|
| 101 |
+
|
| 102 |
+
• The ERF of DeepLabv $^ { 3 + }$ is relatively small even at Stage-4, the deepest stage. • SegFormer’s encoder naturally produces local attentions which resemble convolutions at lower stages, while able to output highly non-local attentions that effectively capture contexts at Stage-4. • As shown with the zoom-in patches in Figure 3, the ERF of the MLP head (blue box) differs from Stage-4 (red box) with a significant stronger local attention besides the non-local attention.
|
| 103 |
+
|
| 104 |
+
The limited receptive field in CNN requires one to resort to context modules such as ASPP [16] that enlarge the receptive field but inevitably become heavy. Our decoder design benefits from the non-local attention in Transformers and leads to a larger receptive field without being complex. The same decoder design, however, does not work well on CNN backbones since the overall receptive field is upper bounded by the limited one at Stage-4, and we will verify this later in Table 1d,
|
| 105 |
+
|
| 106 |
+
More importantly, our decoder design essentially takes advantage of a Transformer induced feature that produces both highly local and non-local attention at the same time. By unifying them, our MLP decoder renders complementary and powerful representations by adding few parameters. This is another key reason that motivated our design. Taking the non-local attention from Stage-4 alone is not enough to produce good results, as will be verified in Table 1d.
|
| 107 |
+
|
| 108 |
+
# 3.3 Relationship to SETR.
|
| 109 |
+
|
| 110 |
+
SegFormer contains multiple more efficient and powerful designs compared with SETR [7]:
|
| 111 |
+
|
| 112 |
+
• We only use ImageNet-1K for pre-training. ViT in SETR is pre-trained on larger ImageNet-22K.
|
| 113 |
+
• SegFormer’s encoder has a hierarchical architecture, which is smaller than ViT and can capture both high-resolution coarse and low-resolution fine features. In contrast, SETR’s ViT encoder can only generate single low-resolution feature map.
|
| 114 |
+
• We remove Positional Embedding in encoder, while SETR uses fixed shape Positional Embedding which decreases the accuracy when the resolution at inference differs from the training ones.
|
| 115 |
+
• Our MLP decoder is more compact and less computationally demanding than the one in SETR. This leads to a negligible computational overhead. In contrast, SETR requires heavy decoders with multiple $3 \times 3$ convolutions.
|
| 116 |
+
|
| 117 |
+
# 4 Experiments
|
| 118 |
+
|
| 119 |
+
# 4.1 Experimental Settings
|
| 120 |
+
|
| 121 |
+
Datasets: We used four public datasets: Cityscapes [69], ADE20K [70], and COCO-Stuff [71]. ADE20K is a dataset covering 150 fine-grained semantic concepts consisting of 20210 images. Cityscapes is a driving dataset for semantic segmentation consisting of 5000 fine-annotated high resolution images with 19 categories. COCO-Stuff covers 172 labels and consists of 164k images: 118k for training, $5 \mathrm { k }$ for validation, $2 0 \mathrm { k }$ for test-dev and $2 0 \mathrm { k }$ for the test-challenge.
|
| 122 |
+
|
| 123 |
+
Implementation details: We used the mmsegmentation2 codebase and train on a server with 8 Tesla V100. We pre-train the encoder on the Imagenet-1K dataset and randomly initialize the decoder. During training, we applied data augmentation through random resize with ratio 0.5-2.0, random horizontal flipping, and random cropping to $5 1 2 \times 5 1 2$ , $1 0 2 4 \times 1 0 2 4$ , $5 1 2 \times 5 1 2$ for ADE20K, Cityscapes and COCO-Stuff. Following [9] we set crop size to $6 4 0 \times 6 4 0$ on ADE20K for our largest model B5. We trained the models using AdamW optimizer for 160K iterations on ADE20K, Cityscapes, and 80K iterations on COCO-Stuff. Exceptionally, for the ablation studies, we trained the models for 40K iterations. We used a batch size of 16 for ADE20K, COCO-Stuff and a batch size of 8 for Cityscapes. The learning rate was set to an initial value of 0.00006 and then used a “poly” LR schedule with factor 1.0 by default. For simplicity, we did not adopt widely-used tricks such as OHEM, auxiliary losses or class balance loss. During evaluation, we rescale the short side of the image to training cropping size and keep the aspect ratio for ADE20K and COCO-Stuff. For Cityscapes, we do inference using sliding window test by cropping $1 0 2 4 \times 1 0 2 4$ windows. We report semantic segmentation performance using mean Intersection over Union (mIoU).
|
| 124 |
+
|
| 125 |
+
# 4.2 Ablation Studies
|
| 126 |
+
|
| 127 |
+
Influence of the size of model. We first analyze the effect of increasing the size of the encoder on the performance and model efficiency. Figure 1 shows the performance vs. model efficiency for ADE20K as a function of the encoder size and, Table 1a summarizes the results for the three datasets. The first thing to observe here is the size of the decoder compared to the encoder. As shown, for the lightweight model, the decoder has only 0.4M parameters. For MiT-B5 encoder, the decoder only takes up to $4 \%$ of the total number of parameters in the model. In terms of performance, we can observe that, overall, increasing the size of the encoder yields consistent improvements on all the datasets. Our lightweight model, SegFormer-B0, is compact and efficient while maintaining a competitive performance, showing that our method is very convenient for real-time applications. On the other hand, our SegFormer-B5, the largest model, achieves state-of-the-art results on all three datasets, showing the potential of our Transformer encoder.
|
| 128 |
+
|
| 129 |
+
Table 1: Ablation studies related to model size, encoder and decoder design. (a) Accuracy, parameters and flops as a function of the model size on the three datasets. “SS” and “MS” means single/multi-scal
|
| 130 |
+
|
| 131 |
+
<table><tr><td rowspan="2">Encoder Model Size</td><td colspan="2">Params</td><td colspan="2">ADE20K</td><td colspan="2">Cityscapes</td><td colspan="2">COCO-Stuff</td></tr><tr><td>Encoder</td><td>Decoder</td><td>Flops</td><td>mIoU(SS/MS) ↑</td><td>Flops↓</td><td>mIoU(SS/MS) ↑</td><td>Flops↓</td><td>mIoU(SS) ↑</td></tr><tr><td>MiT-B0</td><td>3.4</td><td>0.4</td><td>8.4</td><td>37.4 /38.0</td><td>125.5</td><td>76.2 /78.1</td><td>8.4</td><td>35.6</td></tr><tr><td>MiT-B1</td><td>13.1</td><td>0.6</td><td>15.9</td><td>42.2/43.1</td><td>243.7</td><td>78.5 /80.0</td><td>15.9</td><td>40.2</td></tr><tr><td>MiT-B2</td><td>24.2</td><td>3.3</td><td>62.4</td><td>46.5 /47.5</td><td>717.1</td><td>81.0 /82.2</td><td>62.4</td><td>44.6</td></tr><tr><td>MiT-B3</td><td>44.0</td><td>3.3</td><td>79.0</td><td>49.4 / 50.0</td><td>962.9</td><td>81.7 /83.3</td><td>79.0</td><td>45.5</td></tr><tr><td>MiT-B4</td><td>60.8</td><td>3.3</td><td>95.7</td><td>50.3 / 51.1</td><td>1240.6</td><td>82.3 /83.9</td><td>95.7</td><td>46.5</td></tr><tr><td>MiT-B5</td><td>81.4</td><td>3.3</td><td>183.3</td><td>51.0 / 51.8</td><td>1460.4</td><td>82.4/84.0</td><td>111.6</td><td>46.7</td></tr></table>
|
| 132 |
+
|
| 133 |
+
(b) Accuracy as a function of the MLP dimension $C$ in the decoder on ADE20K.
|
| 134 |
+
|
| 135 |
+
<table><tr><td>C</td><td>Flops↓</td><td>Params↓</td><td>mIoU个</td></tr><tr><td>256</td><td>25.7</td><td>24.7</td><td>44.9</td></tr><tr><td>512</td><td>39.8</td><td>25.8</td><td>45.0</td></tr><tr><td>768</td><td>62.4</td><td>27.5</td><td>45.4</td></tr><tr><td>1024</td><td>93.6</td><td>29.6</td><td>45.2</td></tr><tr><td>2048</td><td>304.4</td><td>43.4</td><td>45.6</td></tr></table>
|
| 136 |
+
|
| 137 |
+
(c) Mix-FFN vs. positional encoding (PE) for different test resolution on Cityscapes.
|
| 138 |
+
|
| 139 |
+
<table><tr><td>Inf Res</td><td>Enc Type</td><td>mIoU↑</td></tr><tr><td>768×768</td><td>PE</td><td>77.3</td></tr><tr><td>1024×2048</td><td>PE</td><td>74.0</td></tr><tr><td>768×768</td><td>Mix-FFN</td><td>80.5</td></tr><tr><td>1024×2048</td><td>Mix-FFN</td><td>79.8</td></tr></table>
|
| 140 |
+
|
| 141 |
+
(d) Accuracy on ADE20K of CNN and Transformer encoder with MLP decoder. “S4” means stage-4 feature.
|
| 142 |
+
|
| 143 |
+
<table><tr><td>Encoder</td><td>Flops ↓</td><td>Params ↓</td><td>mIoU↑</td></tr><tr><td>ResNet50 (S1-4)</td><td>69.2</td><td>29.0</td><td>34.7</td></tr><tr><td>ResNet101 (S1-4)</td><td>88.7</td><td>47.9</td><td>38.7</td></tr><tr><td>ResNeXt101 (S1-4)</td><td>127.5</td><td>86.8</td><td>39.8</td></tr><tr><td>MiT-B2 (S4)</td><td>22.3</td><td>24.7</td><td>43.1</td></tr><tr><td>MiT-B2 (S1-4)</td><td>62.4</td><td>27.7</td><td>45.4</td></tr><tr><td>MiT-B3 (S1-4)</td><td>79.0</td><td>47.3</td><td>48.6</td></tr></table>
|
| 144 |
+
|
| 145 |
+
Table 2: Comparison to state of the art methods on ADE20K and Cityscapes. SegFormer has significant advantages on #Params (M), #Flops, #Speed and #Accuracy. Note that for SegFormer-B0 we scale the short side of image to {1024, 768, 640, 512} to get speed-accuracy tradeoffs.
|
| 146 |
+
|
| 147 |
+
<table><tr><td rowspan="2"></td><td rowspan="2">Method</td><td rowspan="2">Encoder</td><td rowspan="2">Params↓</td><td colspan="3">ADE20K</td><td colspan="3">Cityscapes</td></tr><tr><td>Flops↓</td><td>FPS↑</td><td>mIoU↑</td><td>Flops↓</td><td>FPS↑</td><td>mIoU↑</td></tr><tr><td rowspan="9">Pigalr</td><td rowspan="2">FCN[1] ICNet [11]</td><td>MobileNetV2</td><td>9.8</td><td>39.6</td><td>64.4</td><td>19.7</td><td>317.1</td><td>14.2</td><td>61.5</td></tr><tr><td></td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>30.3</td><td>67.7</td></tr><tr><td>PSPNet [15]</td><td>MobileNetV2</td><td>13.7</td><td>52.9</td><td>57.7</td><td>29.6</td><td>423.4</td><td>11.2</td><td>70.2</td></tr><tr><td>DeepLabV3+[18]</td><td>MobileNetV2</td><td>15.4</td><td>69.4</td><td>43.1</td><td>34.0</td><td>555.4</td><td>8.4</td><td>75.2</td></tr><tr><td rowspan="5">SegFormer (Ours)</td><td rowspan="5">MiT-BO</td><td rowspan="5"></td><td>8.4 -</td><td>50.5</td><td>37.4</td><td>125.5</td><td>15.2</td><td>76.2</td></tr><tr><td>3.8</td><td>-</td><td>-</td><td>51.7</td><td>26.3</td><td>75.3</td></tr><tr><td></td><td>-</td><td>-</td><td>31.5</td><td>37.1</td><td>73.7</td></tr><tr><td>-</td><td>-</td><td>1</td><td>17.7</td><td>47.6</td><td>71.9</td></tr><tr><td>68.6</td><td>14.8</td><td>41.4</td><td>2203.3</td><td>1.2</td><td>76.6</td></tr><tr><td rowspan="9">Nnr arrirr</td><td>EncNet [22]</td><td>ResNet-101 ResNet-101</td><td>55.1</td><td>275.7 218.8</td><td>14.9</td><td>44.7</td><td>1748.0</td><td>1.3</td><td>76.9</td></tr><tr><td>PSPNet [15]</td><td>ResNet-101</td><td>68.1</td><td>256.4</td><td>15.3</td><td>44.4</td><td>2048.9</td><td>1.2</td><td>78.5</td></tr><tr><td>CCNet [39]</td><td>ResNet-101</td><td>68.9</td><td>278.4</td><td>14.1</td><td>45.2</td><td>2224.8</td><td>1.0</td><td>80.2</td></tr><tr><td>DeeplabV3+ [18]</td><td>ResNet-101</td><td>62.7</td><td>255.1</td><td>14.1</td><td>44.1</td><td>2032.3</td><td>1.2</td><td>80.9</td></tr><tr><td>OCRNet [21]</td><td>HRNet-W48</td><td>70.5</td><td>164.8</td><td>17.0</td><td>45.6</td><td>1296.8</td><td>4.2</td><td>81.1</td></tr><tr><td>GSCNN [33]</td><td>WideResNet38</td><td>-</td><td>1</td><td>-</td><td>-</td><td>-</td><td>1</td><td>80.8</td></tr><tr><td>Axial-DeepLab [72]</td><td>AxialResNet-XL</td><td></td><td>-</td><td>-</td><td>1</td><td>2446.8</td><td>-</td><td>81.1</td></tr><tr><td>Dynamic Routing [73] Auto-Deeplab [48]</td><td>Dynamic-L33-PSP</td><td></td><td>=</td><td>=</td><td>- 44.0</td><td>270.0</td><td>-</td><td>80.7 80.3</td></tr><tr><td>SETR[7]</td><td>NAS-F48-ASPP</td><td>-</td><td>-</td><td>- 5.4</td><td>50.2</td><td>695.0</td><td>1 0.5</td><td></td></tr><tr><td></td><td>ViT-Large</td><td>318.3</td><td>-</td><td></td><td></td><td></td><td>-</td><td></td><td>82.2</td></tr><tr><td>SegFormer(Ours)</td><td></td><td>MiT-B4</td><td>64.1</td><td>95.7</td><td>15.4</td><td>51.1</td><td>1240.6</td><td>3.0</td><td>83.8</td></tr><tr><td>SegFormer (Ours)</td><td></td><td>MiT-B5</td><td>84.7</td><td>183.3</td><td>9.8</td><td>51.8</td><td>1447.6</td><td>2.5</td><td>84.0</td></tr></table>
|
| 148 |
+
|
| 149 |
+
Influence of $C$ , the MLP decoder channel dimension. We now analyze the influence of the channel dimension $C$ in the MLP decoder, see Section 3.2. In Table 1b we show performance, flops, and parameters as a function of this dimension. We can observe that setting $C \ : = \ : 2 5 6$ provides a very competitive performance and computational cost. The performance increases as $C$ increases; however, it leads to larger and less efficient models. Interestingly, this performance plateaus for channel dimensions wider than 768. Given these results, we choose $C = 2 5 6$ for our real-time models SegFormer-B0, B1 and $C = 7 6 8$ for the rest.
|
| 150 |
+
|
| 151 |
+
Mix-FFN vs. Positional Encoder (PE). In this experiment, we analyze the effect of removing the positional encoding in the Transformer encoder in favor of using the proposed Mix-FFN. To this end, we train Transformer encoders with a positional encoding (PE) and the proposed Mix-FFN and perform inference on Cityscapes with two different image resolutions: $7 6 8 \times 7 6 8$ using a sliding window, and $1 0 2 4 \times 2 0 4 8$ using the whole image.
|
| 152 |
+
|
| 153 |
+
Table 1c shows the results for this experiment. As shown, for a given resolution, our approach using Mix-FFN clearly outperforms using a positional encoding. Moreover, our approach is less sensitive to differences in the test resolution: the accuracy drops $3 . 3 \%$ when using a positional encoding with a lower resolution. In contrast, when we use the proposed Mix-FFN the performance drop is reduced to only $0 . 7 \%$ . From these results, we can conclude using the proposed Mix-FFN produces better and more robust encoders than those using positional encoding.
|
| 154 |
+
|
| 155 |
+
Effective receptive field evaluation. In Section 3.2, we argued that our MLP decoder benefits from Transformers having a larger effective receptive field compared to other CNN models. To quantify this effect, in this experiment, we compare the performance of our MLP-decoder when used with CNN-based encoders such as ResNet or ResNeXt. As shown in Table 1d, coupling our MLP-decoder with a CNN-based encoder yields a significantly lower accuracy compared to coupling it with the proposed Transformer encoder. Intuitively, as a CNN has a smaller receptive field than the Transformer (see the analysis in Section 3.2), the MLP-decoder is not enough for global reasoning. In contrast, coupling our Transformer encoder with the MLP decoder leads to the best performance. Moreover, for Transformer encoder, it is necessary to combine low-level local features and high-level non-local features instead of only high-level feature.
|
| 156 |
+
|
| 157 |
+
Influence of difference encoders. We select 2 representative Transformer encoders, ViT [6] and Swin [9] and compare with our MiT encoder. As shown in Table 3, with same decoder, e.g.MLP decoder, MiT-B2 is $3 . 1 \%$ higher than Swin-T with similar encoder parameters. Moreover, MiT-B5 has much fewer encoder parameters than ViT-large, but is $3+ \%$ mIoU higher than ViT-large. These experiments shows our MiT encoder is better than Swin and ViT for semantic segmentataion.
|
| 158 |
+
|
| 159 |
+
Influence of difference decoders. We also test MiT encoder with different decoders. As shown
|
| 160 |
+
|
| 161 |
+
Table 3: Ablation study of different Transformer encoders and different decoders. All the model are trained on ADE20K with 160K iterations.
|
| 162 |
+
|
| 163 |
+
<table><tr><td>Encoder</td><td>Decoder</td><td>mIoU</td><td>FPS</td><td>Decoder GFlops</td><td>Decoder Params (M)</td></tr><tr><td>MiT-B2</td><td>UperNet (Swin)</td><td>46.5</td><td>14.2</td><td>210.7</td><td>29.7</td></tr><tr><td>MiT-B2</td><td>MLA (SETR)</td><td>46.2</td><td>9.5</td><td>87.7</td><td>4.2</td></tr><tr><td>MiT-B2</td><td>MLP(Ours)</td><td>46.5</td><td>21.4</td><td>42.1</td><td>3.3</td></tr><tr><td>MiT-B5</td><td>UperNet (Swin)</td><td>50.7</td><td>5.3</td><td>210.7</td><td>29.7</td></tr><tr><td>MiT-B5</td><td>MLA (SETR)</td><td>50.9</td><td>3.8</td><td>87.7</td><td>4.2</td></tr><tr><td>MiT-B5</td><td>MLP(Ours)</td><td>51.0</td><td>9.8</td><td>42.1</td><td>3.3</td></tr><tr><td>Swin-T</td><td>MLP(Ours)</td><td>43.4</td><td>20.6</td><td>42.8</td><td>3.6</td></tr><tr><td>Swin-T</td><td>UperNet (Swin)</td><td>44.5</td><td>15.4</td><td>211.3</td><td>31.4</td></tr><tr><td>ViT-L</td><td>MLP(Ours)</td><td>47.7</td><td>4.7</td><td>0.6</td><td>0.6</td></tr><tr><td>ViT-L</td><td>MLA (SETR)</td><td>47.7</td><td>4.6</td><td>1.8</td><td>3.7</td></tr></table>
|
| 164 |
+
|
| 165 |
+
in Table 3, the mIoUs are similar with different decoders while the proposed MLP decoder has the least parameters and is only $1 / 8$ of the UperNet decoder in Swin. The MLP decoder is thus an important design towards efficient segmentation.
|
| 166 |
+
|
| 167 |
+
# 4.3 Comparison to state of the art methods
|
| 168 |
+
|
| 169 |
+
We now compare our results with existing approaches on the ADE20K [70] and Cityscapes [69].
|
| 170 |
+
More experiments about COCO-Stuff [71] are in appendix.
|
| 171 |
+
|
| 172 |
+
ADE20K and Cityscapes: Table 2 summarizes our results including parameters, FLOPS, latency, and accuracy for ADE20K and Cityscapes. In the top part of the table, we report real-time approaches where we include state-of-the-art methods and our results using the MiT-B0 lightweight encoder. In the bottom part, we focus on performance and report the results of our approach and related works using stronger encoders.
|
| 173 |
+
|
| 174 |
+
On ADE20K, SegFormer-B0 yields $3 7 . 4 \%$ mIoU using only $3 . 8 \mathbf { M }$ parameters and 8.4G FLOPs, outperforming all other real-time counterparts in terms of parameters, flops, and latency. For instance, compared to Deeplab ${ \mathrm { V } } 3 +$ (MobileNetV2), SegFormer-B0 is 7.4 FPS, which is faster and keeps $3 . 4 \%$ better mIoU.
|
| 175 |
+
|
| 176 |
+
Moreover, SegFormer-B5 outperforms all other approaches, including the previous best SETR, and establishes a new state-of-the-art of $5 1 . 8 \%$ , which is $1 . 6 \%$ mIoU better than SETR while being significantly more efficient.
|
| 177 |
+
|
| 178 |
+
Table 4: Comparison to state of the art methods on Cityscapes test set. IM-1K, IM-22K, Coarse and MV refer to the ImageNet-1K, ImageNet-22K, Cityscapes coarse set and Mapillary Vistas.
|
| 179 |
+
|
| 180 |
+
<table><tr><td>Method</td><td>Encoder</td><td>Extra Data</td><td>mIoU</td></tr><tr><td>PSPNet [15]</td><td>ResNet-101</td><td>IM-1K</td><td>78.4</td></tr><tr><td>PSANet [41]</td><td>ResNet-101</td><td>IM-1K</td><td>80.1</td></tr><tr><td>CCNet [39]</td><td>ResNet-101</td><td>IM-1K</td><td>81.9</td></tr><tr><td>OCNet[19]</td><td>ResNet-101</td><td>IM-1K</td><td>80.1</td></tr><tr><td>Axial-DeepLab [72]</td><td>AxiaiResNet-XL</td><td>IM-1K</td><td>79.9</td></tr><tr><td>SETR[7]</td><td>ViT</td><td>IM-22K</td><td>81.0</td></tr><tr><td>SETR [7]</td><td>ViT</td><td>IM-22K,Coarse</td><td>81.6</td></tr><tr><td>SegFormer</td><td>MiT-B5</td><td>IM-1K</td><td>82.2</td></tr><tr><td>SegFormer</td><td>MiT-B5</td><td>IM-1K,MV</td><td>83.1</td></tr></table>
|
| 181 |
+
|
| 182 |
+
As also shown in Table 2, our results also hold on Cityscapes. SegFormer-B0 yields 15.2 FPS and $7 6 . 2 \%$ mIoU (the shorter side of input image being 1024), which represents a $1 . 3 \%$ mIoU improvement and a $2 \times$ speedup compared to Deeplab ${ \mathrm { V } } 3 +$ . Moreover, with the shorter side of input image being 512, SegFormer-B0 runs at 47.6 FPS and yields $7 1 . 9 \%$ mIoU, which is $1 7 . 3 \mathrm { F P S }$ faster and $4 . 2 \%$ better than ICNet. SegFormer-B5 archives the best IoU of $8 4 . 0 \%$ , outperforming all existing methods by at least $1 . 8 \%$ mIoU, and it runs $5 \times$ faster and $4 \times$ smaller than SETR [7]. On Cityscapes test set, we follow the common setting [18] and merge the validation images to the train set and report results using Imagenet-1K pre-training and also using Mapillary Vistas [74]. As reported in Table 4, using only Cityscapes fine data and Imagenet-1K pre-training, our method achieves $8 2 . 2 \%$ mIoU outperforming all other methods including SETR, which uses ImageNet-22K pre-training and the additional Cityscapes coarse data. Using Mapillary pre-training, our sets a new state-of-the-art result of $8 3 . 1 \%$ mIoU.
|
| 183 |
+
|
| 184 |
+
# 4.4 Robustness to natural corruptions
|
| 185 |
+
|
| 186 |
+
Model robustness is important for many safety-critical tasks such as autonomous driving [75]. In this experiment, we evaluate the robustness of SegFormer to common corruptions and perturbations. To this end, we follow [75] and generate Cityscapes-C, which expands the Cityscapes validation set with 16 types of algorithmically generated corruptions from noise, blur, weather and digital categories. We compare our method to Deeplab ${ \mathrm { V } } 3 +$ and other methods as reported in [75]. We also compare with SETR with DeiT Transformer backbone. The results for this experiment are summarized in Table 5.
|
| 187 |
+
|
| 188 |
+
Our method significantly outperforms previous CNN-based methods, yielding a relative improvement of up to $58 8 \%$ on Gaussian Noise and up to $29 5 \%$ on snow weather. SegFormer also outperforms SETR in general except for one corruption (snow). The results indicate the strong robustness of SegFormer, which we envision to benefit safety-critical applications where robustness is important.
|
| 189 |
+
|
| 190 |
+
Table 5: Main results on Cityscapes-C. $\mathrm { \Delta } ^ { \circ } \mathrm { D L v } 3 + \mathrm { \Delta } ^ { \circ }$ , “MBv2”, “R” and “X” refer to DeepLabv $^ { 3 + }$ , MobileNetv2, ResNet and Xception. The mIoUs of compared methods are reported from [75].
|
| 191 |
+
|
| 192 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Clean</td><td colspan="4">Blur</td><td colspan="4">Noise</td><td colspan="4">Digital</td><td colspan="4">Weather</td></tr><tr><td>Motion Defoc Glass Gauss</td><td></td><td></td><td></td><td>Gauss</td><td>Impul Shot Speck Bright Contr Satur JPEG</td><td></td><td></td><td></td><td></td><td></td><td></td><td>Snow</td><td>Spatt Fog</td><td></td><td>Frost</td></tr><tr><td>DLv3+ (MBv2)</td><td>72.0</td><td>53.5</td><td>49.0</td><td>45.3</td><td>49.1</td><td>6.4</td><td>7.0</td><td>6.6</td><td>16.6</td><td>51.7</td><td>46.7</td><td>32.4</td><td>27.2</td><td>13.7</td><td>38.9</td><td>47.4</td><td>17.3</td></tr><tr><td>DLv3+ (R50)</td><td>76.6</td><td>58.5</td><td>56.6</td><td>47.2</td><td>57.7</td><td>6.5</td><td>7.2</td><td>10.0</td><td>31.1</td><td>58.2</td><td>54.7</td><td>41.3</td><td>27.4</td><td>12.0</td><td>42.0</td><td>)55.9</td><td>22.8</td></tr><tr><td>DLv3+ (R101)</td><td>77.1</td><td>59.1</td><td>56.3</td><td>47.7</td><td>57.3</td><td>13.2</td><td>13.9</td><td>16.3</td><td>36.9</td><td>59.2</td><td>54.5</td><td>41.5</td><td>37.4</td><td>11.9</td><td>47.8</td><td>55.1</td><td>22.7</td></tr><tr><td>DLv3+ (X41)</td><td>77.8</td><td>61.6</td><td>54.9</td><td>51.0</td><td>54.7</td><td>17.0</td><td>17.3</td><td>21.6</td><td>43.7</td><td>63.6</td><td>56.9</td><td>51.7</td><td>38.5</td><td>18.2</td><td>46.6</td><td>57.6</td><td>20.6</td></tr><tr><td>DLv3+ (X65)</td><td>78.4</td><td>63.9</td><td>59.1</td><td>52.8</td><td>59.2</td><td>15.0</td><td>10.6</td><td>19.8</td><td>42.4</td><td>65.9</td><td>59.1</td><td>46.1</td><td>31.4</td><td>19.3</td><td>50.7</td><td>63.6</td><td>23.8</td></tr><tr><td>DLv3+ (X71)</td><td>78.6</td><td>64.1</td><td>60.9</td><td>52.0</td><td>60.4</td><td>14.9</td><td>10.8</td><td>19.4</td><td>41.2</td><td>68.0</td><td>58.7</td><td>47.1</td><td>40.2</td><td>18.8</td><td>50.4</td><td>64.1</td><td>20.2</td></tr><tr><td>ICNet</td><td>65.9</td><td>45.8</td><td>44.6</td><td>47.4</td><td>44.7</td><td>8.4</td><td>8.4</td><td>10.6</td><td>27.9</td><td>41.0</td><td>33.1</td><td>27.5</td><td>34.0</td><td>6.3</td><td>30.5</td><td>27.3</td><td>11.0</td></tr><tr><td>FCN8s</td><td>66.7</td><td>42.7</td><td>31.1</td><td>37.0</td><td>34.1</td><td>6.7</td><td>5.7</td><td>7.8</td><td>24.9</td><td>53.3</td><td>39.0</td><td>36.0</td><td>21.2</td><td>11.3</td><td>31.6</td><td>37.6</td><td>19.7</td></tr><tr><td>DilatedNet</td><td>68.6</td><td>44.4</td><td>36.3</td><td>32.5</td><td>38.4</td><td>15.6</td><td>14.0</td><td>18.4</td><td>32.7</td><td>52.7</td><td>32.6</td><td>38.1</td><td>29.1</td><td>12.5</td><td>32.3</td><td>34.7</td><td>19.2</td></tr><tr><td>ResNet-38</td><td>77.5</td><td>54.6</td><td>45.1</td><td>43.3</td><td>47.2</td><td>13.7</td><td>16.0</td><td>18.2</td><td>38.3</td><td>60.0</td><td>50.6</td><td>46.9</td><td>14.7</td><td>13.5</td><td>45.9</td><td>52.9</td><td>22.2</td></tr><tr><td>PSPNet</td><td>78.8</td><td>59.8</td><td>53.2</td><td>44.4</td><td>53.9</td><td>11.0</td><td>15.4</td><td>15.4</td><td>34.2</td><td>60.4</td><td>51.8</td><td>30.6</td><td>21.4</td><td>8.4</td><td>42.7</td><td>34.4</td><td>16.2</td></tr><tr><td>GSCNN</td><td>80.9</td><td>58.9</td><td>58.4</td><td>41.9</td><td>60.1</td><td>5.5</td><td>2.6</td><td>6.8</td><td>24.7</td><td>75.9</td><td>61.9</td><td>70.7</td><td>12.0</td><td>12.4</td><td>47.3</td><td>67.9</td><td>32.6</td></tr><tr><td>SETR-DeiT</td><td>78.9</td><td>64.9</td><td>65.1</td><td>59.1</td><td>65.3</td><td>54.7</td><td>60.5</td><td>51.9</td><td>69.4</td><td>74.9</td><td>69.6</td><td>74.9</td><td>58.5</td><td>44.3</td><td>64.8</td><td>68.2</td><td>39.1</td></tr><tr><td>SegFormer-B5</td><td>82.4</td><td>69.1</td><td>68.6</td><td>64.1</td><td>69.8</td><td>57.8</td><td>63.4</td><td>52.3</td><td>72.8</td><td>81.0</td><td>77.7</td><td>80.1</td><td>58.8</td><td>40.7</td><td>68.4</td><td>78.5</td><td>49.9</td></tr></table>
|
| 193 |
+
|
| 194 |
+
# 5 Conclusion
|
| 195 |
+
|
| 196 |
+
In this paper, we present SegFormer, a simple, clean yet powerful semantic segmentation method which contains a positional-encoding-free, hierarchical Transformer encoder and a lightweight AllMLP decoder. It avoids common complex designs in previous methods, leading to both high efficiency and performance. SegFormer not only achieves new state of the art results on common datasets, but also shows strong zero-shot robustness. We hope our method can serve as a solid baseline for semantic segmentation and motivate further research. One potential limitation is that even our lightest model may still be too heavy for some edge devices. Thus mixed-precision training, pruning, hardware-friendly attention designs and energy consumption are important parts of our future work.
|
| 197 |
+
|
| 198 |
+
# Broader Impact
|
| 199 |
+
|
| 200 |
+
Efficiency, accuracy, and robustness are important aspects of AI models. Our work pushes the boundary of semantic segmentation models in these three aspects. We envision that the work will benefit a wide range of safety-critical applications, such as autonomous driving and robot navigation. The proposed method improves the “in-the-wild” robustness of these applications, ultimately leading to better safety. Despite such improvement, we fully understand this work is by no means perfect and there are still many challenges towards reliable real world application. Our models may be subject to biases and other possible undesired mistakes, depending on how they are trained in reality. Our model may also be used for surveillance similar to other AI recognition methods, even though it is not mainly designed for surveillance applications.
|
| 201 |
+
|
| 202 |
+
# Acknowledgments and Disclosure of Funding
|
| 203 |
+
|
| 204 |
+
We thank Ding Liang, Zhe Chen and Yaojun Liu for insightful discussion without which this paper would not be possible. Ping Luo is supported by the General Research Fund of Hong Kong No.27208720.
|
| 205 |
+
|
| 206 |
+
# References
|
| 207 |
+
|
| 208 |
+
[1] Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015. 1, 2, 3, 7 [2] Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Semantic image segmentation with deep convolutional nets and fully connected CRFs. In ICLR, 2015. 2, 3
|
| 209 |
+
[3] Hang Zhang, Chongruo Wu, Zhongyue Zhang, Yi Zhu, Haibin Lin, Zhi Zhang, Yue Sun, Tong He, Jonas Mueller, R Manmatha, et al. ResNest: Split-attention networks. arXiv, 2020. 2
|
| 210 |
+
[4] Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs. TPAMI, 2017. 2, 3
|
| 211 |
+
[5] Fisher Yu and Vladlen Koltun. Multi-scale context aggregation by dilated convolutions. In ICLR, 2016. 2, 3, 5
|
| 212 |
+
[6] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv, 2020. 2, 3, 4, 8
|
| 213 |
+
[7] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. CVPR, 2021. 2, 3, 6, 7, 8, 9
|
| 214 |
+
[8] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv, 2021. 2, 3, 4
|
| 215 |
+
[9] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv, 2021. 2, 3, 6, 8
|
| 216 |
+
[10] Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Twins: Revisiting spatial attention design in vision transformers. arXiv, 2021. 2, 3
|
| 217 |
+
[11] Hengshuang Zhao, Xiaojuan Qi, Xiaoyong Shen, Jianping Shi, and Jiaya Jia. Icnet for real-time semantic segmentation on high-resolution images. In ECCV, 2018. 2, 7
|
| 218 |
+
[12] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 3
|
| 219 |
+
[13] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. NeurIPS, 2012.
|
| 220 |
+
[14] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv, 2014. 3
|
| 221 |
+
[15] Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. Pyramid scene parsing network. In CVPR, 2017. 3, 7, 8
|
| 222 |
+
[16] Maoke Yang, Kun Yu, Chi Zhang, Zhiwei Li, and Kuiyuan Yang. Denseaspp for semantic segmentation in street scenes. In CVPR, 2018. 5
|
| 223 |
+
[17] Chao Peng, Xiangyu Zhang, Gang Yu, Guiming Luo, and Jian Sun. Large kernel matters–improve semantic segmentation by global convolutional network. In CVPR, 2017. 3, 5
|
| 224 |
+
[18] Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In ECCV, 2018. 3, 5, 7, 9
|
| 225 |
+
[19] Yuhui Yuan and Jingdong Wang. Ocnet: Object context network for scene parsing. arXiv, 2018. 3, 8
|
| 226 |
+
[20] Changqian Yu, Jingbo Wang, Changxin Gao, Gang Yu, Chunhua Shen, and Nong Sang. Context prior for scene segmentation. In CVPR, 2020.
|
| 227 |
+
[21] Yuhui Yuan, Xilin Chen, and Jingdong Wang. Object-contextual representations for semantic segmentation. arXiv, 2019. 7
|
| 228 |
+
[22] Hang Zhang, Kristin Dana, Jianping Shi, Zhongyue Zhang, Xiaogang Wang, Ambrish Tyagi, and Amit Agrawal. Context encoding for semantic segmentation. In CVPR, 2018. 7
|
| 229 |
+
[23] Yizhou Zhou, Xiaoyan Sun, Zheng-Jun Zha, and Wenjun Zeng. Context-reinforced semantic segmentation. In CVPR, 2019.
|
| 230 |
+
[24] Guosheng Lin, Anton Milan, Chunhua Shen, and Ian Reid. Refinenet: Multi-path refinement networks for high-resolution semantic segmentation. In CVPR, 2017.
|
| 231 |
+
[25] Rudra PK Poudel, Ujwal Bonde, Stephan Liwicki, and Christopher Zach. Contextnet: Exploring context and detail for semantic segmentation in real-time. arXiv, 2018.
|
| 232 |
+
[26] Tianyi Wu, Sheng Tang, Rui Zhang, and Yongdong Zhang. Cgnet: A light-weight context guided network for semantic segmentation. arXiv, 2018.
|
| 233 |
+
[27] Junjun He, Zhongying Deng, Lei Zhou, Yali Wang, and Yu Qiao. Adaptive pyramid context network for semantic segmentation. In CVPR, 2019. 3
|
| 234 |
+
[28] Henghui Ding, Xudong Jiang, Ai Qun Liu, Nadia Magnenat Thalmann, and Gang Wang. Boundary-aware feature propagation for scene segmentation. In ICCV, 2019. 3
|
| 235 |
+
[29] Gedas Bertasius, Jianbo Shi, and Lorenzo Torresani. Semantic segmentation with boundary neural fields. In CVPR, 2016.
|
| 236 |
+
[30] Xiangtai Li, Xia Li, Li Zhang, Guangliang Cheng, Jianping Shi, Zhouchen Lin, Shaohua Tan, and Yunhai Tong. Improving semantic segmentation via decoupled body and edge supervision. arxiv, 2020.
|
| 237 |
+
[31] Yuhui Yuan, Jingyi Xie, Xilin Chen, and Jingdong Wang. Segfix: Model-agnostic boundary refinement for segmentation. In ECCV, 2020.
|
| 238 |
+
[32] Mingmin Zhen, Jinglu Wang, Lei Zhou, Shiwei Li, Tianwei Shen, Jiaxiang Shang, Tian Fang, and Long Quan. Joint semantic segmentation and boundary detection using iterative pyramid contexts. In CVPR, 2020.
|
| 239 |
+
[33] Towaki Takikawa, David Acuna, Varun Jampani, and Sanja Fidler. Gated-scnn: Gated shape cnns for semantic segmentation. In ICCV, 2019. 7
|
| 240 |
+
[34] Changqian Yu, Jingbo Wang, Chao Peng, Changxin Gao, Gang Yu, and Nong Sang. Learning a discriminative feature network for semantic segmentation. In CVPR, 2018.
|
| 241 |
+
[35] Liang-Chieh Chen, Jonathan T Barron, George Papandreou, Kevin Murphy, and Alan L Yuille. Semantic image segmentation with task-specific edge detection using cnns and a discriminatively trained domain transform. In CVPR, 2016. 3
|
| 242 |
+
[36] Jun Fu, Jing Liu, Haijie Tian, Yong Li, Yongjun Bao, Zhiwei Fang, and Hanqing Lu. Dual attention network for scene segmentation. In CVPR, 2019. 3
|
| 243 |
+
[37] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018.
|
| 244 |
+
[38] Zilong Zhong, Zhong Qiu Lin, Rene Bidart, Xiaodan Hu, Ibrahim Ben Daya, Zhifeng Li, Wei-Shi Zheng, Jonathan Li, and Alexander Wong. Squeeze-and-attention networks for semantic segmentation. In CVPR, 2020.
|
| 245 |
+
[39] Zilong Huang, Xinggang Wang, Lichao Huang, Chang Huang, Yunchao Wei, and Wenyu Liu. Ccnet: Criss-cross attention for semantic segmentation. In ICCV, 2019. 7, 8
|
| 246 |
+
[40] Hanchao Li, Pengfei Xiong, Jie An, and Lingxue Wang. Pyramid attention network for semantic segmentation. arXiv, 2018.
|
| 247 |
+
[41] Hengshuang Zhao, Yi Zhang, Shu Liu, Jianping Shi, Chen Change Loy, Dahua Lin, and Jiaya Jia. Psanet: Point-wise spatial attention network for scene parsing. In ECCV, 2018. 8
|
| 248 |
+
[42] Xia Li, Zhisheng Zhong, Jianlong Wu, Yibo Yang, Zhouchen Lin, and Hong Liu. Expectation-maximization attention networks for semantic segmentation. In ICCV, 2019.
|
| 249 |
+
[43] Yue Cao, Jiarui Xu, Stephen Lin, Fangyun Wei, and Han Hu. Gcnet: Non-local networks meet squeezeexcitation networks and beyond. In ICCVW, 2019.
|
| 250 |
+
[44] Enze Xie, Wenjia Wang, Wenhai Wang, Peize Sun, Hang Xu, Ding Liang, and Ping Luo. Segmenting transparent object in the wild with transformer. IJCAI, 2021. 3
|
| 251 |
+
[45] Albert Shaw, Daniel Hunter, Forrest Landola, and Sammy Sidhu. Squeezenas: Fast neural architecture search for faster semantic segmentation. In ICCVW, 2019. 3
|
| 252 |
+
[46] Wuyang Chen, Xinyu Gong, Xianming Liu, Qian Zhang, Yuan Li, and Zhangyang Wang. Fasterseg: Searching for faster real-time semantic segmentation. arXiv, 2019.
|
| 253 |
+
[47] Yanwei Li, Lin Song, Yukang Chen, Zeming Li, Xiangyu Zhang, Xingang Wang, and Jian Sun. Learning dynamic routing for semantic segmentation. In CVPR, 2020.
|
| 254 |
+
[48] Chenxi Liu, Liang-Chieh Chen, Florian Schroff, Hartwig Adam, Wei Hua, Alan L Yuille, and Li Fei-Fei. Auto-deeplab: Hierarchical neural architecture search for semantic image segmentation. In CPVR, 2019. 7
|
| 255 |
+
[49] Vladimir Nekrasov, Hao Chen, Chunhua Shen, and Ian Reid. Fast neural architecture search of compact semantic segmentation models via auxiliary cells. In CVPR, 2019. 3
|
| 256 |
+
[50] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-End object detection with transformers. In ECCV, 2020. 3
|
| 257 |
+
[51] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv, 2021. 3
|
| 258 |
+
[52] Xiangxiang Chu, Zhi Tian, Bo Zhang, Xinlong Wang, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Conditional positional encodings for vision transformers. arXiv, 2021. 3, 5
|
| 259 |
+
[53] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. arXiv, 2021. 3
|
| 260 |
+
[54] Chun-Fu Chen, Quanfu Fan, and Rameswar Panda. Crossvit: Cross-attention multi-scale vision transformer for image classification. arXiv, 2021. 3
|
| 261 |
+
[55] Yawei Li, Kai Zhang, Jiezhang Cao, Radu Timofte, and Luc Van Gool. Localvit: Bringing locality to vision transformers. arXiv, 2021. 3
|
| 262 |
+
[56] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv, 2021. 3, 5
|
| 263 |
+
[57] Weijian Xu, Yifan Xu, Tyler Chang, and Zhuowen Tu. Co-scale conv-attentional image transformers. arXiv, 2021. 3
|
| 264 |
+
[58] Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Hervé Jégou, and Matthijs Douze. Levit: a vision transformer in convnet’s clothing for faster inference. arXiv, 2021. 3
|
| 265 |
+
[59] Peize Sun, Yi Jiang, Rufeng Zhang, Enze Xie, Jinkun Cao, Xinting Hu, Tao Kong, Zehuan Yuan, Changhu Wang, and Ping Luo. Transtrack: Multiple-object tracking with transformer. arXiv, 2020. 3
|
| 266 |
+
[60] Tim Meinhardt, Alexander Kirillov, Laura Leal-Taixe, and Christoph Feichtenhofer. Trackformer: Multiobject tracking with transformers. arXiv, 2021. 3
|
| 267 |
+
[61] Hanting Chen, Yunhe Wang, Tianyu Guo, Chang Xu, Yiping Deng, Zhenhua Liu, Siwei Ma, Chunjing Xu, Chao Xu, and Wen Gao. Pre-trained image processing transformer. arXiv, 2020. 3
|
| 268 |
+
[62] Shuting He, Hao Luo, Pichao Wang, Fan Wang, Hao Li, and Wei Jiang. Transreid: Transformer-based object re-identification. arXiv, 2021. 3
|
| 269 |
+
[63] Manoj Kumar, Dirk Weissenborn, and Nal Kalchbrenner. Colorization transformer. arXiv, 2021. 3
|
| 270 |
+
[64] Alaaeldin El-Nouby, Natalia Neverova, Ivan Laptev, and Hervé Jégou. Training vision transformers for image retrieval. arXiv, 2021. 3
|
| 271 |
+
[65] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. arXiv, 2021. 3
|
| 272 |
+
[66] Ronghang Hu and Amanpreet Singh. Transformer is all you need: Multimodal multitask learning with a unified transformer. arXiv, 2021. 3
|
| 273 |
+
[67] Md Amirul Islam, Sen Jia, and Neil DB Bruce. How much position information do convolutional neural networks encode? arXiv, 2020. 4, 5
|
| 274 |
+
[68] Wenjie Luo, Yujia Li, Raquel Urtasun, and Richard Zemel. Understanding the effective receptive field in deep convolutional neural networks. arXiv, 2017. 5
|
| 275 |
+
[69] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In CVPR, 2016. 6, 8
|
| 276 |
+
[70] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In CVPR, 2017. 6, 8
|
| 277 |
+
[71] Holger Caesar, Jasper Uijlings, and Vittorio Ferrari. Coco-stuff: Thing and stuff classes in context. In CVPR, 2018. 6, 8
|
| 278 |
+
[72] Huiyu Wang, Yukun Zhu, Bradley Green, Hartwig Adam, Alan L. Yuille, and Liang-Chieh Chen. Axialdeeplab: Stand-alone axial-attention for panoptic segmentation. In ECCV, 2020. 7, 8
|
| 279 |
+
[73] Yanwei Li, Lin Song, Yukang Chen, Zeming Li, Xiangyu Zhang, Xingang Wang, and Jian Sun. Learning dynamic routing for semantic segmentation. In CVPR, 2020.
|
| 280 |
+
[74] Gerhard Neuhold, Tobias Ollmann, Samuel Rota Bulò, and Peter Kontschieder. The mapillary vistas dataset for semantic understanding of street scenes. In ICCV, 2017. 9
|
| 281 |
+
[75] Christoph Kamann and Carsten Rother. Benchmarking the robustness of semantic segmentation models. In CVPR, 2020. 9
|
| 282 |
+
|
| 283 |
+
# Checklist
|
| 284 |
+
|
| 285 |
+
1. For all authors...
|
| 286 |
+
|
| 287 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 288 |
+
(b) Did you describe the limitations of your work? [Yes] Please Section 5.
|
| 289 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] Please see Broader Impact.
|
| 290 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 291 |
+
|
| 292 |
+
2. If you are including theoretical results...
|
| 293 |
+
|
| 294 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
|
| 295 |
+
|
| 296 |
+
3. If you ran experiments...
|
| 297 |
+
|
| 298 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
|
| 299 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 300 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We observed quite stable mIoU results for semantic segmentation models.
|
| 301 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
|
| 302 |
+
|
| 303 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 304 |
+
|
| 305 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] Please see Section 4.
|
| 306 |
+
(b) Did you mention the license of the assets? [Yes] The data used in our work is open source and can be used for adademic research.
|
| 307 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We provide our code for this work in the supplemental material.
|
| 308 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] The data used in our work is open source and can be used for adademic research.
|
| 309 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] The data does not contain personally identifiable information or offensive content.
|
| 310 |
+
|
| 311 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 312 |
+
|
| 313 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 314 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 315 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/QRBvLayFXI/QRBvLayFXI.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Revisiting the Calibration of Modern Neural Networks
|
| 2 |
+
|
| 3 |
+
# Matthias Minderer Josip Djolonga Rob Romijnders Frances Hubis Xiaohua Zhai Neil Houlsby Dustin Tran Mario Lucic
|
| 4 |
+
|
| 5 |
+
Google Research, Brain Team {mjlm, lucic}@google.com
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Accurate estimation of predictive uncertainty (model calibration) is essential for the safe application of neural networks. Many instances of miscalibration in modern neural networks have been reported, suggesting a trend that newer, more accurate models produce poorly calibrated predictions. Here, we revisit this question for recent state-of-the-art image classification models. We systematically relate model calibration and accuracy, and find that the most recent models, notably those not using convolutions, are among the best calibrated. Trends observed in prior model generations, such as decay of calibration with distribution shift or model size, are less pronounced in recent architectures. We also show that model size and amount of pretraining do not fully explain these differences, suggesting that architecture is a major determinant of calibration properties.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Neural networks, especially vision models, are increasingly used in safety-critical applications such as autonomous driving (Bojarski et al., 2016), medical diagnosis (Esteva et al., 2017; Jiang et al., 2012), and meteorological forecasting (Sønderby et al., 2020). For such applications, it is essential that model predictions are not just accurate, but also well calibrated. Model calibration refers to the accuracy with which the scores provided by the model reflect its predictive uncertainty. For example, in a medical application, we would like to defer images for which the model makes low-confidence predictions to a physician for review (Kompa et al., 2021). Skipping human review due to confident, but incorrect, predictions, could have disastrous consequences.
|
| 14 |
+
|
| 15 |
+
While intense research and engineering effort has focused on improving the predictive accuracy of models, less attention has been given to model calibration. In fact, over the last few years, there have been many reports that calibration of modern neural networks can be surprisingly poor, despite the advances in accuracy (e.g. Guo et al. 2017; Lakshminarayanan et al. 2017; Malinin & Gales 2018; Thulasidasan et al. 2019; Hendrycks et al. 2020b; Ovadia et al. 2019; Wenzel et al. 2020; Havasi et al. 2021; Rahaman & Thiery 2020; Leathart & Polaczuk 2020). Some works suggest a trend for larger, more accurate models to be worse calibrated (Guo et al., 2017).
|
| 16 |
+
|
| 17 |
+
These concerns are more relevant than ever, since the architecture size, amount of training data, and computing power used by state-of-the-art models continue to increase. At the same time, rapid advances in model architecture (Tolstikhin et al., 2021; Dosovitskiy et al., 2021) and training approaches (Chen et al., 2020; Mahajan et al., 2018; Radford et al., 2021) raise the question whether past results on calibration, largely obtained on standard convolutional architectures, extend to current state-of-the-art models. Since model advances are quickly translated to real-world, safety-critical applications (e.g. Mustafa et al. 2021), there is an urgent need to re-assess the calibration properties of current state-of-the-art models.
|
| 18 |
+
|
| 19 |
+
Contributions. To address this need, we provide a systematic comparison of recent image classification models, relating their accuracy, calibration, and design features. We find that:
|
| 20 |
+
|
| 21 |
+
1. The best current models, including the non-convolutional MLP-Mixer (Tolstikhin et al., 2021) and Vision Transformers (Dosovitskiy et al., 2021), are well calibrated compared to past models and their performance is more robust to distribution shift.
|
| 22 |
+
2. In-distribution calibration slightly deteriorates with increasing model size, but this is outweighed by a simultaneous improvement in accuracy.
|
| 23 |
+
3. Under distribution shift, calibration improves with model size, reversing the trend seen indistribution.
|
| 24 |
+
4. Accuracy and calibration are correlated under distribution shift, such that optimizing for accuracy may also benefit calibration.
|
| 25 |
+
5. Model size, pretraining duration, and pretraining dataset size cannot fully explain differences in calibration properties between model families.
|
| 26 |
+
|
| 27 |
+
Our results suggest that further improvements in model accuracy will continue to benefit calibration. They also hint at architecture as an important determinant of model calibration. We provide code and a large dataset of calibration measurements, comprising 180 distinct models from 16 families, each evaluated on 79 ImageNet-scale datasets and 28 metric variants.1
|
| 28 |
+
|
| 29 |
+
# 2 Related Work
|
| 30 |
+
|
| 31 |
+
Measures of model calibration. The losses that are commonly used to train classification models, such as cross-entropy and squared error, are proper scoring rules (Gneiting et al., 2007) and are therefore guaranteed to yield perfectly calibrated models at their minimum—in the infinite-data limit. However, in practice, due to model mismatch and overfitting, even losses based on proper scoring rules may result in poor model calibration. Miscalibration is commonly quantified in terms of Expected Calibration Error (ECE; Naeini et al. 2015), which measures the absolute difference between predictive confidence and accuracy. We focus on ECE because it is a widely used and accepted calibration metric. Nevertheless, it is well understood that estimating ECE accurately is difficult because estimators can be strongly biased and many estimator variants exist (Nixon et al., 2019; Roelofs et al., 2020; Vaicenavicius et al., 2019; Gupta et al., 2021). Section 5 discusses these issues and our approaches to mitigate them.
|
| 32 |
+
|
| 33 |
+
Alternatives to ECE include likelihood measures, Brier score (Brier, 1950), Bayesian methods (Gelman et al., 2013), and conformal prediction (Shafer & Vovk, 2008). Further, model calibration can be represented visually with reliability diagrams (DeGroot & Fienberg, 1983). Figure 8 and Appendix F provide likelihoods, Brier scores, and reliability diagrams for our main analyses.
|
| 34 |
+
|
| 35 |
+
Empirical studies of model calibration. There have been many recent empirical studies on the robustness (accuracy under distribution shift) of image classifiers (Geirhos et al., 2019; Taori et al., 2020; Djolonga et al., 2020; Hendrycks et al., 2020a). Several works have also studied calibration. Most notable is Guo et al. (2017), who found that “modern neural networks, unlike those from a decade ago, are poorly calibrated”, that larger networks tend to be calibrated worse, and that “miscalibration worsen[s] even as classification error is reduced.” Other works have corroborated some of these findings (e.g., Thulasidasan et al. 2019; Wen et al. 2021). This line of work suggests a trend that larger models are worse calibrated, which would have major implications for research toward bigger models and datasets. We show that for more recent models, this trend is negligible in-distribution and in fact reverses under distribution shift.
|
| 36 |
+
|
| 37 |
+
Ovadia et al. (2019) empirically study calibration under distribution shift and provide a large comparison of methods for improving calibration. They report that both accuracy and calibration deteriorate with distribution shift. While we observe the same trend, we find that the calibration of some recent model families decays so slowly under distribution shift that the decay in accuracy is likely more relevant in practice (Section 4.3).
|
| 38 |
+
|
| 39 |
+
Ovadia et al. also find that, across methods for improving calibration, improvements on in-distribution data do not necessarily translate to out-of-distribution data. This finding may suggest that there is little correlation between in-distribution and out-of-distribution calibration in general. However, our results show that, across model architectures, the models with the best in-distribution calibration are also the best-calibrated on a range of out-of-distribution benchmarks. The important implication of this result is that designing models based on in-distribution performance likely also benefits their out-of-distribution performance.
|
| 40 |
+
|
| 41 |
+
Improving calibration. Many strategies have been proposed to improve model calibration such as post-hoc rescaling of predictions (Guo et al., 2017), averaging multiple predictions (Lakshminarayanan et al., 2017; Wen et al., 2020), and data augmentation (Thulasidasan et al., 2019; Wen et al., 2021). Here, we focus on the intrinsic calibration properties of state-of-the-art model families, rather than methods to further improve calibration.
|
| 42 |
+
|
| 43 |
+
As a baseline on top of a model’s intrinsic calibration properties, we study temperature scaling (Guo et al., 2017). It is effective in improving calibration and so simple that it can be applied in many cases at minimal additional cost, in contrast to many more sophisticated methods. Temperature scaling re-scales a model’s logits by a single parameter, chosen to optimize the model’s likelihood on a held-out portion of the training data. This temperature factor changes the model’s confidence, i.e., whether the model predictions are on average too certain (overconfident), optimally confident, or too uncertain (underconfident). The classification accuracy of the model is not affected by temperature scaling. A large fraction of model miscalibration is typically due to average over- or underconfidence, e.g. due to suboptimal training duration (Guo et al., 2017). By normalizing a model’s confidence, temperature scaling not only improves calibration, but also removes a primary confounder that can hide trends in calibration between models (see Section 4.2 and Appendix D). Therefore, we study both unscaled and temperature-scaled predictions in the paper.
|
| 44 |
+
|
| 45 |
+
# 3 Definitions and Notation
|
| 46 |
+
|
| 47 |
+
We consider the multi-class classification problem, as analyzed by Bröcker (2009), where we observe a variable $X$ and predict a categorical variable $Y \in \{ 1 , 2 , \dots , k \}$ . We model our predictor $f$ as a function that maps every input instance $X$ to a categorical distribution over $k$ labels, represented using a vector $f ( X )$ belonging to the $\left( k - 1 \right)$ -dimensional simplex $\Delta = \{ p \in [ 0 , 1 ] ^ { k } \mid \sum _ { y = 1 } ^ { k } p _ { y } = 1 \}$ .
|
| 48 |
+
|
| 49 |
+
Intuitively, a model $f$ is well-calibrated if its output truthfully quantifies the predictive uncertainty. For example, if we take all data points $x$ for which the model predicts $[ f ( x ) ] _ { y } \stackrel { - } { = } 0 . 3$ , we expect $3 0 \%$ of them to indeed take on the label $y$ . Formally, the model $f$ is said to be calibrated if (Bröcker, 2009)
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\forall p \in \Delta \colon P ( Y = y \mid f ( X ) = p ) = p _ { y } .
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
We will focus on a slightly weaker, but more practical condition, called top-label or argmax calibration (Kumar et al., 2019; Guo et al., 2017). This requires that the above holds only for the most likely label, i.e., $\forall p ^ { * } \in [ 0 , 1 ]$
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
P ( Y \in \arg \operatorname* { m a x } { p } \mid \operatorname* { m a x } { f ( X ) } = p ^ { * } ) = p ^ { * } ,
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
where the max and arg max act coordinate-wise.
|
| 62 |
+
|
| 63 |
+
The most common measure of the degree of miscalibration is the Expected Calibration Error $( E C E )$ , which computes the expected disagreement between the two sides of eq. (2)
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\mathbb { E } \big [ | p ^ { * } - E [ Y \in \arg \operatorname* { m a x } f ( X ) \mid \operatorname* { m a x } f ( X ) = p ^ { * } | \big ] .
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
Unfortunately, eq. (3) cannot be estimated without quantization as it conditions on a null event. Hence, one typically first buckets the predictions into $m$ bins $B _ { 1 } , \ldots , B _ { m }$ based on their top predicted probability, and then takes the expectation over these buckets. Namely, if we are given a set of $n$ i.i.d. samples $( x _ { 1 } , y _ { 1 } ) , \dotsc , ( x _ { n } , y _ { n } )$ distributed as $P ( X , Y )$ , then we assign each $\bar { \boldsymbol j } \in \{ 1 , \dots , n \}$ $B _ { i }$ n max and th $f ( x _ { j } )$ . Tracy $B _ { i }$ nfidenc, where $( B _ { i } ) =$ $\begin{array} { r } { \frac { 1 } { | B _ { i } | } \sum _ { j \in B _ { i } } \operatorname* { m a x } f ( x _ { j } ) } \end{array}$ $\begin{array} { r } { \mathbf { \Gamma } ^ { \prime } ( B _ { i } ) = \frac { 1 } { | B _ { i } | } \sum _ { j \in B _ { i } } \mathbb { [ } y _ { j } \in \arg \operatorname* { m a x } f ( x _ { j } ) \mathbb { I } } \end{array}$ $[ [ \cdot ] ]$ Iverson bracket. Finally, we construct an estimator by taking the expectation over the bins
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
{ \widehat { \mathrm { E C E } } } = \sum _ { i = 1 } ^ { m } { \frac { | B _ { i } | } { n } } \left| { \mathrm { a c c u r a c y } } ( B _ { i } ) - { \mathrm { c o n f i d e n c e } } ( B _ { i } ) \right| .
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
In Section 5 we discuss the statistical properties of this estimator, possible pitfalls, and several mitigation strategies.
|
| 76 |
+
|
| 77 |
+

|
| 78 |
+
Figure 1: Some modern neural network families are both highly accurate and well-calibrated. Left: Expected calibration error (ECE) vs. classification error on IMAGENET for state-of-the-art image classification models. Marker size indicates relative model size within its family. Points labeled “Guo et al.” are the values reported for DenseNet-161 and ResNet-152 in Guo et al. (2017). Right: Confidence distribution (top row) and reliability diagrams (bottom row) for some of the models.
|
| 79 |
+
|
| 80 |
+
# 4 Empirical Evaluation
|
| 81 |
+
|
| 82 |
+
# 4.1 Experimental Setup
|
| 83 |
+
|
| 84 |
+
Model families. In this study, we consider a range of recent and some historic state-of-the-art image classification models. Our selection of models covers convolutional and non-convolutional architectures, as well as supervised, weakly supervised, unsupervised and zero-shot training. We follow the original publications in naming the model variants within each family (e.g. different model sizes). See Appendix A.1 for a detailed description of all used models.
|
| 85 |
+
|
| 86 |
+
1. MLP-Mixer (Tolstikhin et al., 2021) is based exclusively on multi-layer perceptrons (MLPs) and is pre-trained on large supervised datasets.
|
| 87 |
+
2. ViT (Dosovitskiy et al., 2021) processes images with a transformer architecture originally designed for language (Vaswani et al., 2017) and is also pre-trained on large supervised datasets.
|
| 88 |
+
3. BiT (Kolesnikov et al., 2020) is a ResNet-based architecture (He et al., 2016). It is also pre-trained on large supervised datasets.
|
| 89 |
+
4. ResNext-WSL (Mahajan et al., 2018) is based on the ResNeXt architecture and trained with weak supervision from billions of hashtags on social media images.
|
| 90 |
+
5. SimCLR (Chen et al., 2020) is a ResNet, pretrained with an unsupervised contrastive loss.
|
| 91 |
+
6. CLIP (Radford et al., 2021) is pretrained on raw text and imagery using a contrastive loss.
|
| 92 |
+
7. AlexNet (Krizhevsky et al., 2012; Krizhevsky, 2014) was the first convolutional neural network to win the ImageNet challenge.
|
| 93 |
+
|
| 94 |
+
All models are either trained or fine-tuned on the IMAGENET training set, except for CLIP, which makes zero-shot predictions using IMAGENET class names as queries.
|
| 95 |
+
|
| 96 |
+
Datasets. We evaluate accuracy and calibration on the IMAGENET validation set and the following out-of-distribution benchmarks using the Robustness Metrics library (Djolonga et al., 2020):
|
| 97 |
+
|
| 98 |
+
1. IMAGENETV2 (Recht et al., 2019) is a new IMAGENET test set collected by closely following the original IMAGENET labeling protocol.
|
| 99 |
+
2. IMAGENET-C (Hendrycks & Dietterich, 2019) consists of the images from IMAGENET, modified with synthetic perturbations such as blur, pixelation, and compression artifacts at a range of severities.
|
| 100 |
+
3. IMAGENET-R (Hendrycks et al., 2020a) contains artificial renditions of IMAGENET classes such as art, cartoons, drawings, sculptures, and others.
|
| 101 |
+
4. IMAGENET-A (Hendrycks et al., 2021) contains images that are classified as belonging to IMAGENET classes by humans, but adversarially selected to be hard to classify for a ResNet50 trained on IMAGENET.
|
| 102 |
+
|
| 103 |
+
For the post-hoc recalibration of models, we reserve $20 \%$ of the IMAGENET validation set (randomly sampled) for fitting the temperature scaling parameter. All reported metrics are computed on the remaining $80 \%$ of the data. For evaluations on IMAGENET-C, we also exclude the $20 \%$ of images that are based on the IMAGENET images used for temperature scaling.
|
| 104 |
+
|
| 105 |
+
Calibration metric. Throughout the paper, we estimate ECE using equal-mass binning and 100 bins. Appendix E shows that our results hold for other ECE variants and are consistent with the Brier score and model likelihood.
|
| 106 |
+
|
| 107 |
+
# 4.2 In-Distribution Calibration
|
| 108 |
+
|
| 109 |
+
We begin by considering ECE on clean IMAGENET images (referred to as in-distribution). Figure 1 shows in-distribution ECE and reliability diagrams before any recalibration of the predicted probabilities. We find that several recent model families (MLP-Mixer, ViT, and BiT) are both highly accurate and well-calibrated compared to prior models, such as AlexNet or the models studied by Guo et al. (2017). This suggests that there may be no continuing trend for highly accurate modern neural networks to be poorly calibrated, as suggested previously (Guo et al., 2017; Lakshminarayanan et al., 2017; Malinin & Gales, 2018; Thulasidasan et al., 2019; Hendrycks et al., 2020b; Ovadia et al., 2019; Wenzel et al., 2020; Havasi et al., 2021; Rahaman & Thiery, 2020; Leathart & Polaczuk, 2020). In addition, we find that a recent zero-shot model, CLIP, is well-calibrated given its accuracy.
|
| 110 |
+
|
| 111 |
+
Temperature scaling reveals consistent properties of model families. The poor calibration of past models can often be remedied by post-hoc recalibration such as temperature scaling (Guo et al., 2017), which raises the question whether a difference between models remains after recalibration. We find that the most recent architectures are better calibrated than past models even after temperature scaling (Figure 2, right).
|
| 112 |
+
|
| 113 |
+
More generally, temperature scaling reveals consistent trends in the calibration properties between families that are obscured in the unscaled data by simple over- or underconfidence miscalibration. Before temperature scaling (Figure 2, left), several families overlap in their accuracy/calibration properties (MLP-Mixer, ViT, BiT). After temperature scaling (Figure 2, right), a clearer separation of families and consistent trends between accuracy and calibration within each family become apparent. Notably, temperature scaling reconciles our results for BiT (a ResNet architecture) with the results reported by Guo et al. for ResNets trained on IMAGENET. Furthermore, models pretrained without addi
|
| 114 |
+
|
| 115 |
+

|
| 116 |
+
Figure 2: Temperature scaling reveals consistent properties of model families. Left: ECE vs. classification error as in Figure 1. Right: ECE after applying temperature scaling.
|
| 117 |
+
|
| 118 |
+
tional labels (SimCLR) or with noisy labels (ResNeXt-WSL) tend to be calibrated worse for a given accuracy than ResNets trained with supervision (BiT and the models studied by Guo et al.). Finally, non-convolutional model families like MLP-Mixer and ViT can perform just as well, if not better, than convolutional ones.
|
| 119 |
+
|
| 120 |
+
Differences between families are not explained by model size or pretraining amount. We next attempt to disentangle how the differences between model families affect their calibration properties. We focus on model size and amount of pretraining, both important trends in state of-the-art models.
|
| 121 |
+
|
| 122 |
+
We first consider model size. Prior work has suggested that larger neural networks are worse calibrated (Guo et al., 2017). We also find that within most families, larger members tend to have higher calibration error (Figure 2, right). However, at the same time, larger models have consistently lower classification error. This means that each model family occupies a different Pareto set in the tradeoff between accuracy and calibration. For example, our results suggest that, at any given accuracy, ViT models are better calibrated than BiT models. Changing the size of a BiT model cannot move it into the Pareto set of ViT models. Model size can therefore not fully explain the intrinsic calibration differences between these model families.2
|
| 123 |
+
|
| 124 |
+
We next consider model pretraining. Many current state-of-the-art image models use transfer learning, in which a model is pre-trained on a large dataset and then fine-tuned to the task of interest (Kolesnikov et al., 2020; Chen et al., 2020; Xie et al., 2020). With transfer learning, large data sources can be exploited to train the model, even if little data are available for the final task. To test how the amount of pretraining affects calibration, we compare BiT models pretrained on IMAGENET (1.3M images), IMAGENET-21K (12.8M images), or JFT-300 (300M images; Sun et al. 2017).
|
| 125 |
+
|
| 126 |
+
More pretraining data consistently increases accuracy, especially for larger models. It has no consistent effect on calibration (Figure 3). In particular, after temperature scaling, ECE is essentially unchanged across this 300-fold increase in pretraining dataset size (e.g. for BiTR50x1 pretrained on IMAGENET, IMAGENET21K and JFT-300, the ECEs are 0.0185, 0.0182, 0.0185, respectively; for BiT-R101x3, they are 0.0272, 0.0311, 0.0236; Figure 3, bottom). Therefore, regardless of the pretraining dataset, BiT always remains Pareto-dominant over SimCLR and Pareto-dominated by ViT and MLPMixer in our experiments.
|
| 127 |
+
|
| 128 |
+
The BiT models compared in Figure 3 differ in both the amount of pretraining data and the duration of pretraining (see Kolesnikov et al. (2020) for details). To further disentangle these variables, we trained BiT models on varying numbers of pretraining examples while holding the number of training steps constant, and vice versa. We find that pretraining dataset size has no significant effect on calibration, while pretraining duration only shifts the model within its accuracy/calibration Pareto set (longer-trained models are more accurate and worse calibrated; Figure 10). These results suggest that pretraining alone cannot explain the differences between model families that we observe.
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 3: Family differences are not fully explained by the amount of pretraining. Each column shows ECE vs. classification error on ImageNet for BiT models pre-trained with a different dataset: IMAGENET (1.3M images), IMAGENET-21K (12.8M images), or JFT-300 (300M images). The values for other models are provided for reference in light shading (same values as in Figure 2). Note how all BiT models remain in the same relative location between ViT and SimCLR across a 300-fold difference in pretraining data size.
|
| 132 |
+
|
| 133 |
+
In summary, our results show that some modern neural network families combine high accuracy and state-of-the-art calibration on in-distribution data, both before and after post-hoc recalibration by temperature scaling. In Figure 8 and Appendices E and F, we show that these results generally hold for other measures of model calibration (other ECE variants, Brier score, and model likelihood). Our experiments further suggest that model size and pretraining amount do not fully explain the intrinsic calibration differences between model families. Given that the best-calibrated families (MLP-Mixer and ViT) are non-convolutional, we speculate that model architecture, and in particular its spatial inductive bias, play an important role.
|
| 134 |
+
|
| 135 |
+
# 4.3 Accuracy and Calibration Under Distribution Shift
|
| 136 |
+
|
| 137 |
+
For safety-critical applications, the model should produce reasonable uncertainty estimates not just in-distribution, but also under distribution shifts that were not anticipated at training time. We first assess out-of-distribution calibration on the IMAGENET-C dataset, which consists of images that have been synthetically corrupted at five different severities. As expected, both classification and calibration error generally increase with distribution shift (Figure 4; Ovadia et al. 2019; Hendrycks & Dietterich 2019). Interestingly, this decay in calibration performance is slower for MLP-Mixer and ViT than for the other model families, both before and after temperature scaling.
|
| 138 |
+
|
| 139 |
+
Regarding the effect of model size on calibration, we observed some trend towards worse calibration of larger models on in-distribution data. However, the trend is reversed for most model families as we move out of distribution, especially after accounting for confidence bias by temperature scaling (note positive slope of the gray lines at high corruption severities in Figure 4, bottom row). In other words, the calibration of larger models is more robust to distribution shift (Figure 5).
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 4: Calibration and accuracy on IMAGENET-C before (top) and after (bottom) temperature scaling on IMAGENET. Severity 0 refers to the clean IMAGENET test set; marker size indicates relative model size within its family (see Table 1 for model details). The calibration of some recent model families, e.g. MLP-Mixer and ViT, is more robust to distribution shift than past models.
|
| 143 |
+
|
| 144 |
+
We next consider to what degree the insights from in-distribution and IMAGENET-C calibration transfer to natural out-of-distribution data. Previous work on IMAGENET-C suggests that, when comparing recalibration methods, better in-distribution calibration and accuracy do not usually predict better calibration under distribution shift (Ovadia et al., 2019). Here, comparing model families, we find that the performance on several natural out-of-distribution datasets is largely consistent with that on IMAGENET (Figure 6). In particular, models that are Pareto-optimal (i.e. no other model is both more accurate and better calibrated) on IMAGENET remain Pareto-optimal on the OOD datasets. Further, we observe a strong correlation between accuracy and calibration on the OOD datasets. This relationship is consistent across models within a family and across datasets, over a wide range of accuracies (Figure 11).
|
| 145 |
+
|
| 146 |
+
These results suggest that larger and more accurate models, and in particular MLP-Mixer and ViT, can maintain their good in-distribution calibration even under severe distribution shifts. Based on the observed relationship between calibration and accuracy, we can reasonably hope that good calibration on in-distribution data (and anticipated distribution shifts) generally translates into good calibration on unanticipated outof-distribution data, similar to what has been observed for accuracy (Djolonga et al., 2020).
|
| 147 |
+
|
| 148 |
+
# 4.4 Relating Accuracy and Calibration Within Model Families
|
| 149 |
+
|
| 150 |
+
Our data suggest that most model families lie on different Pareto sets in the accuracy/calibration space, which establishes a clear preference between families. We next consider how to compare individual models within a family (or more specifically, within a Pareto set), where one model is more accurate but worse calibrated, and the other is less accurate but better calibrated. Which model should a practitioner choose for a safety-critical application?
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 5: Classification error and ECE for the top three families on IMAGENET-C, relative to the largest model variant in each family. As distribution shift increases, both errors tend to increase more slowly for larger models. Also note that changes in ECE are much smaller than changes in classification error.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 6: Calibration and accuracy before (top row) and after (bottom row) temperature scaling on out-of-distribution benchmarks. Marker size indicates relative model size within its family. IMAGENET-R and IMAGENET-A use a reduced subset of 200 classes; we follow the literature and select the subset of the model logits for these classes before evaluation. Out-of-distribution calibration tends to correlate with in-distribution calibration (Figure 1) and out-of-distribution accuracy.
|
| 157 |
+
|
| 158 |
+
The answer depends on the cost structure of the specific application (Hernández-Orallo et al., 2012). As an example, consider the scenario of selective prediction, which is common in medical diagnosis. In this task, one can choose to ignore the model prediction (“abstain”) at a fixed cost if the prediction confidence is low, rather than risking a (more costly) prediction error.
|
| 159 |
+
|
| 160 |
+
Figure 7 compares the expected cost for two BiT variants, one with better classification error $( \mathrm { R } 1 5 2 \mathrm { x } 4 $ , by 0.08), and one with better ECE (R50x1, by 0.009). For abstention rates up to $70 \%$ (which covers most practical scenarios with abstention rates low enough for the model to be useful), the model with better accuracy has a lower overall cost than the model with better ECE. The same is true for all other model families we study (Appendix B.3). For these families and this cost scenario, a practitioner should therefore always choose the most accu
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 7: Relative cost of BiT-R $1 5 2 \mathrm { x } 4$ and BiT$\mathrm { R } 5 0 \mathrm { x } 1$ models in a selective prediction scenario, computed as a combination of the misclassification and abstention costs at a given cost ratio $\mathbf { \dot { x } }$ -axis) and abstention rate (y-axis). Blue indicates regions where the higher-accuracy model $( \mathrm { R } 1 5 2 \mathrm { x } 4 )$ achieves a lower cost than the bettercalibrated model (R50x1). The accuracy advantage outweighs the calibration advantage for practical rejection rates, across all tested abstention costs.
|
| 164 |
+
|
| 165 |
+
rate available model regardless of differences in calibration. Ultimately, real-world cost structures are complex and may yield different results; Figure 7 presents one common scenario with downstream ramifications for the importance of the calibration differences compared to accuracy.
|
| 166 |
+
|
| 167 |
+
# 5 Pitfalls and Limitations
|
| 168 |
+
|
| 169 |
+
For this study, we approached calibration with a simple, practical question: Given two models, one more accurate and the other better calibrated, which should a practitioner choose? While working towards answering this question, we encountered several pitfalls that complicate the interpretation of calibration results.
|
| 170 |
+
|
| 171 |
+
Measuring calibration is challenging, and while the quantity we want to estimate is well specified, the estimator itself can be biased. There are two sources of bias: (i) from estimating ECE by binning, and (ii) from the finite sample size used to estimate the per-bin statistics.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 8: Alternative calibration metrics: negative log-likelihood (NLL) and Brier score. For comparison, the first row shows ECE as in Figure 6. Since NLL, Brier score, and classification error are all highly correlated, we also provide the residuals of NLL and Brier score after regressing out classification error (third and fifth row). Specifically, we first fit a linear regression $y _ { i } = \beta _ { 0 } + \beta _ { 1 } x _ { i }$ , where $x _ { i }$ is the classification error and $y _ { i }$ is the calibration measure of model $i$ . We then report the residual $y _ { i } - \left( \beta _ { 0 } + \beta _ { 1 } x _ { i } \right)$ on the $y$ -axis of the plots in the third and fifth row. The residuals show which models have better (or worse) NLL and Brier score than what can be expected from their accuracy alone. The relationships between model families are largely similar across all calibration metrics.
|
| 175 |
+
|
| 176 |
+
The first of these biases is always negative (Kumar et al., 2019), while the second one is always positive. Thus, the estimator can both under- and over-estimate the true value, and the magnitude of the bias can depend on multiple factors. In practice, this means that the ranking of models depends on which ECE variant is chosen to estimate calibration (Nixon et al., 2019). As we show below, this is especially problematic for the positive bias, because this bias depends on the accuracy of the model. It is therefore possible to arrive at opposite conclusions about the relationship between accuracy and calibration, depending on the chosen bin size (Figure 9), especially when comparing models with widely varying accuracies.
|
| 177 |
+
|
| 178 |
+
Intuitively, a larger number of bins implies fewer points per bin and thus higher variance of the estimate of the model accuracy in each bin, which adds positive bias to the estimate of ECE. More formally, to estimate accuracy $( B _ { i } )$ precisely, we need a number of samples inversely proportional to the standard deviation $\sqrt { p _ { i } ( 1 - p _ { i } ) } / | B _ { i } |$ , where $p _ { i }$ is the expected accuracy in $B _ { i }$ . This indicates that the bias would be smaller for models with extreme average accuracies (i.e. close to 0 or 1) and larger for models with an accuracy close to 0.5. A detailed analysis reveals additional effects that further reduce the bias for higher-accuracy models (Appendix C). In particular, if we estimate $( \mathbb { E } [ \mathrm { a c c u r a c y } ( B _ { i } ) ] - \mathbb { E } [ \mathrm { \bar { c } o n f i d e n c e } ( B _ { i } ) ] ) ^ { 2 }$ for any bin $i$ with $n _ { i }$ samples (using the sample means of the confidences and the accuracies), the bias can be shown to be equal to (conditioning on $X \in B _ { i }$ omitted for brevity)
|
| 179 |
+
|
| 180 |
+

|
| 181 |
+
Figure 9: The effect of binning-induced bias in ECE depends on accuracy. Each dot represents a BiT ResNet model. Plotted models differ in model size, pretraining dataset size, and pretraining duration. All models are fine-tuned and evaluated on IMAGENET. After temperature scaling, there is a near-linear relationship between ECE and classification error. However, whether this relationship is positive or negative depends on the number of bins used for estimating ECE. This effect is explained by an accuracy-dependent bias that increases with the number of bins.
|
| 182 |
+
|
| 183 |
+
$$
|
| 184 |
+
\frac { 1 } { n _ { i } } ( \mathbb { V } [ A ] + \mathbb { V } [ C ] - 2 { \bf C o v } [ C , A ] ) ,
|
| 185 |
+
$$
|
| 186 |
+
|
| 187 |
+
where $A = [ [ Y \in \arg \operatorname* { m a x } { f ( X ) } ] ]$ and $C = \operatorname* { m a x } f ( X )$ . Hence, from Equation 5 we can conclude J Kthat higher accuracy models have a lower bias not only due to higher accuracy (lower $\mathbb { V } [ A ] )$ , but also because their outputs correlate more with the correct label (higher covariance).
|
| 188 |
+
|
| 189 |
+
In addition to a careful choice of bin size, considering accuracy and calibration jointly mitigates this issue, because the Pareto-optimal models rarely change, even if the ranking based on ECE alone does (Appendix E). In Appendices E and F, we provide the main figures of the paper for other ECE variants (number of bins, binning scheme, normalization metric, top-label, all-label, class-wise).
|
| 190 |
+
|
| 191 |
+
Finally, metrics such as Brier score (Brier, 1950) and likelihood provide alternative assessments of model calibration that do not require estimating expected calibration error. We find that the relationships between model families are consistent across ECE, NLL and Brier score (Figure 8). In particular, the same models (specifically the largest MLP-Mixer and ViT variants) remain Paretooptimal with respect to the calibration metric and classification error in most cases. The relationship between models is visualized especially clearly after regressing out from the calibration metrics their correlation with classification error (Figure 8, third and fifth row).
|
| 192 |
+
|
| 193 |
+
# 6 Conclusion
|
| 194 |
+
|
| 195 |
+
We performed a large study of the calibration of recent state-of-the-art image models and its relationship with accuracy. We find that modern image models are well calibrated across distribution shifts despite being designed with a focus on accuracy. Our results suggest that there is no general trend for recent or highly accurate neural networks to be poorly calibrated compared to older or less accurate models.
|
| 196 |
+
|
| 197 |
+
Our experiments suggest that simple dimensions such as model size and pretraining amount do not fully account for the performance differences between families, pointing towards architecture as a major determinant of calibration. Of particular note is the finding that MLP-Mixer and Vision Transformers—two recent architectures that are not based on convolutions—are among the best-calibrated models both in-distribution and out-of-distribution. Self-attention (which Vision Transformers employ heavily) has been shown previously to be beneficial for certain kinds of outof-distribution robustness (Hendrycks et al., 2020a). Our work now hints at calibration benefits of non-convolutional architectures more broadly, for certain kinds of distribution shift. Further work on the influence of architectural inductive biases on calibration and out-of-distribution robustness will be necessary to tell whether these results generalize. If so, they may further hasten the end of the convolutional era in computer vision.
|
| 198 |
+
|
| 199 |
+
# Acknowledgments and Disclosure of Funding
|
| 200 |
+
|
| 201 |
+
We thank Carlos Riquelme and Balaji Lakshminarayanan for valuable comments on the manuscript.
|
| 202 |
+
The authors declare no competing interests.
|
| 203 |
+
References
|
| 204 |
+
Bojarski, M., Del Testa, D., Dworakowski, D., Firner, B., Flepp, B., Goyal, P., Jackel, L. D., Monfort, M., Muller, U., Zhang, J., et al. End to end learning for self-driving cars. arXiv: 1604.07316, 2016.
|
| 205 |
+
Brier, G. W. Verification of forecasts expressed in terms of probability. Monthly weather review, 1950.
|
| 206 |
+
Bröcker, J. Reliability, sufficiency, and the decomposition of proper scores. Journal of the Royal Meteorological Society, 2009.
|
| 207 |
+
Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. E. A simple framework for contrastive learning of visual representations. In International Conference on Machine Learning, 2020.
|
| 208 |
+
DeGroot, M. H. and Fienberg, S. E. The comparison and evaluation of forecasters. Journal of the Royal Statistical Society, 1983.
|
| 209 |
+
Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. Imagenet: A large-scale hierarchical image database. In Conference on Computer Vision and Pattern Recognition, 2009.
|
| 210 |
+
Djolonga, J., Matthias, M., Nado, Z., Nixon, J., Romijnders, R., Tran, D., and Lucic, M. Robustness Metrics, 2020. URL https://github.com/google-research/robustness_metrics.
|
| 211 |
+
Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021.
|
| 212 |
+
Esteva, A., Kuprel, B., Novoa, R. A., Ko, J., Swetter, S. M., Blau, H. M., and Thrun, S. Dermatologistlevel classification of skin cancer with deep neural networks. Nature, 2017.
|
| 213 |
+
Geirhos, R., Rubisch, P., Michaelis, C., Bethge, M., Wichmann, F. A., and Brendel, W. Imagenettrained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations, 2019.
|
| 214 |
+
Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., and Rubin, D. B. Bayesian data analysis. CRC press, 2013.
|
| 215 |
+
Gneiting, T., Balabdaoui, F., and Raftery, A. E. Probabilistic forecasts, calibration and sharpness. Journal of the Royal Statistical Society, 2007.
|
| 216 |
+
Guo, C., Pleiss, G., Sun, Y., and Weinberger, K. Q. On calibration of modern neural networks. In International Conference on Machine Learning, 2017.
|
| 217 |
+
Gupta, K., Rahimi, A., Ajanthan, T., Mensink, T., Sminchisescu, C., and Hartley, R. Calibration of neural networks using splines. International Conference on Learning Representations, 2021.
|
| 218 |
+
Havasi, M., Jenatton, R., Fort, S., Liu, J. Z., Snoek, J., Lakshminarayanan, B., Dai, A. M., and Tran, D. Training independent subnetworks for robust prediction. In International Conference on Learning Representations, 2021.
|
| 219 |
+
He, K., Zhang, X., Ren, S., and Sun, J. Identity mappings in deep residual networks. In European Conference on Computer Vision, 2016.
|
| 220 |
+
Hendrycks, D. and Dietterich, T. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019.
|
| 221 |
+
Hendrycks, D., Basart, S., Mu, N., Kadavath, S., Wang, F., Dorundo, E., Desai, R., Zhu, T., Parajuli, S., Guo, M., et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv: 2006.16241, 2020a.
|
| 222 |
+
Hendrycks, D., Mu, N., Cubuk, E. D., Zoph, B., Gilmer, J., and Lakshminarayanan, B. Augmix: A simple data processing method to improve robustness and uncertainty. In International Conference on Learning Representations, 2020b.
|
| 223 |
+
Hendrycks, D., Zhao, K., Basart, S., Steinhardt, J., and Song, D. Natural adversarial examples. In Conference on Computer Vision and Pattern Recognition, 2021.
|
| 224 |
+
Hernández-Orallo, J., Flach, P. A., and Ferri, C. A unified view of performance metrics: translating threshold choice into expected classification loss. Journal of Machine Learning Research, 2012.
|
| 225 |
+
Jiang, X., Osl, M., Kim, J., and Ohno-Machado, L. Calibrating predictive model estimates to support personalized medicine. Journal of the American Medical Informatics Association, 2012.
|
| 226 |
+
Kolesnikov, A., Beyer, L., Zhai, X., Puigcerver, J., Yung, J., Gelly, S., and Houlsby, N. Big transfer (bit): General visual representation learning. In European Conference on Computer Vision, 2020.
|
| 227 |
+
Kompa, B., Snoek, J., and Beam, A. L. Second opinion needed: communicating uncertainty in medical machine learning. NPJ Digital Medicine, 2021.
|
| 228 |
+
Krizhevsky, A. One weird trick for parallelizing convolutional neural networks. arXiv: 1404.5997, 2014.
|
| 229 |
+
Krizhevsky, A., Sutskever, I., and Hinton, G. E. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, 2012.
|
| 230 |
+
Kumar, A., Liang, P. S., and Ma, T. Verified uncertainty calibration. In Advances in Neural Information Processing Systems, 2019.
|
| 231 |
+
Lakshminarayanan, B., Pritzel, A., and Blundell, C. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in Neural Information Processing Systems, 2017.
|
| 232 |
+
Leathart, T. and Polaczuk, M. Temporal probability calibration. arXiv: 2002.02644, 2020.
|
| 233 |
+
Mahajan, D., Girshick, R. B., Ramanathan, V., He, K., Paluri, M., Li, Y., Bharambe, A., and van der Maaten, L. Exploring the limits of weakly supervised pretraining. In European Conference on Computer Vision, 2018.
|
| 234 |
+
Malinin, A. and Gales, M. J. F. Predictive uncertainty estimation via prior networks. In Advances in Neural Information Processing Systems, 2018.
|
| 235 |
+
Müller, R., Kornblith, S., and Hinton, G. E. When does label smoothing help? In Advances in Neural Information Processing Systems, 2019.
|
| 236 |
+
Mustafa, B., Loh, A., Freyberg, J., MacWilliams, P., Wilson, M., McKinney, S. M., Sieniek, M., Winkens, J., Liu, Y., Bui, P., Prabhakara, S., Telang, U., Karthikesalingam, A., Houlsby, N., and Natarajan, V. Supervised transfer learning at scale for medical imaging. arXiv: 2101.05913, 2021.
|
| 237 |
+
Naeini, M. P., Cooper, G., and Hauskrecht, M. Obtaining well calibrated probabilities using bayesian binning. In AAAI Conference on Artificial Intelligence, 2015.
|
| 238 |
+
Nixon, J., Dusenberry, M. W., Zhang, L., Jerfel, G., and Tran, D. Measuring calibration in deep learning. In IEEE Conference on Computer Vision and Pattern Recognition Workshops, 2019.
|
| 239 |
+
Ovadia, Y., Fertig, E., Lakshminarayanan, B., Nowozin, S., Sculley, D., Dillon, J. V., Ren, J., Nado, Z., and Snoek, J. Can you trust your model’s uncertainty? evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems, 2019.
|
| 240 |
+
Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., et al. Learning transferable visual models from natural language supervision. Technical report, OpenAI, 2021.
|
| 241 |
+
Rahaman, R. and Thiery, A. H. Uncertainty quantification and deep ensembles. arXiv: 2007.08792, 2020.
|
| 242 |
+
|
| 243 |
+
Recht, B., Roelofs, R., Schmidt, L., and Shankar, V. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning, 2019.
|
| 244 |
+
Roelofs, R., Cain, N., Shlens, J., and Mozer, M. C. Mitigating bias in calibration error estimation. arXiv: 2012.08668, 2020.
|
| 245 |
+
Shafer, G. and Vovk, V. A tutorial on conformal prediction. Journal of Machine Learning Research, 2008.
|
| 246 |
+
Sønderby, C. K., Espeholt, L., Heek, J., Dehghani, M., Oliver, A., Salimans, T., Agrawal, S., Hickey, J., and Kalchbrenner, N. Metnet: A neural weather model for precipitation forecasting. arXiv: 2003.12140, 2020.
|
| 247 |
+
Sun, C., Shrivastava, A., Singh, S., and Gupta, A. Revisiting unreasonable effectiveness of data in deep learning era. In International Conference on Computer Vision, 2017.
|
| 248 |
+
Szegedy, C., Vanhoucke, V., Ioffe, S., Shlens, J., and Wojna, Z. Rethinking the inception architecture for computer vision. In Conference on Computer Vision and Pattern Recognition, 2016.
|
| 249 |
+
Taori, R., Dave, A., Shankar, V., Carlini, N., Recht, B., and Schmidt, L. Measuring robustness to natural distribution shifts in image classification. Advances in Neural Information Processing Systems, 2020.
|
| 250 |
+
Thulasidasan, S., Chennupati, G., Bilmes, J. A., Bhattacharya, T., and Michalak, S. On mixup training: Improved calibration and predictive uncertainty for deep neural networks. In Advances in Neural Information Processing Systems, 2019.
|
| 251 |
+
Tolstikhin, I., Houlsby, N., Kolesnikov, A., Beyer, L., Zhai, X., Unterthiner, T., Yung, J., Steiner, A., Keysers, D., Uszkoreit, J., Lucic, M., and Dosovitskiy, A. MLP-Mixer: An all-MLP architecture for vision. arXiv: 2105.01601, 2021.
|
| 252 |
+
Vaicenavicius, J., Widmann, D., Andersson, C. R., Lindsten, F., Roll, J., and Schön, T. B. Evaluating model calibration in classification. In International Conference on Artificial Intelligence and Statistics, 2019.
|
| 253 |
+
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. In Advances in Neural Information Processing Systems, 2017.
|
| 254 |
+
Wen, Y., Tran, D., and Ba, J. Batchensemble: an alternative approach to efficient ensemble and lifelong learning. In Advances in Neural Information Processing Systems, 2020.
|
| 255 |
+
Wen, Y., Jerfel, G., Muller, R., Dusenberry, M. W., Snoek, J., Lakshminarayanan, B., and Tran, D. Combining ensembles and data augmentation can harm your calibration. In International Conference on Learning Representations, 2021.
|
| 256 |
+
Wenzel, F., Snoek, J., Tran, D., and Jenatton, R. Hyperparameter ensembles for robustness and uncertainty quantification. In Advances in Neural Information Processing Systems, 2020.
|
| 257 |
+
Xie, Q., Luong, M.-T., Hovy, E., and Le, Q. V. Self-training with noisy student improves imagenet classification. In Conference on Computer Vision and Pattern Recognition, 2020.
|
md/train/S1xBioR5KX/S1xBioR5KX.md
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PARAMETER EFFICIENT TRAINING OF DEEP CONVOLUTIONAL NEURAL NETWORKS BY DYNAMIC SPARSE REPARAMETERIZATION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Modern deep neural networks are highly overparameterized, and often of huge sizes. A number of post-training model compression techniques, such as distillation, pruning and quantization, can reduce the size of network parameters by a substantial fraction with little loss in performance. However, training a small network of the post-compression size de novo typically fails to reach the same level of accuracy achieved by compression of a large network, leading to a widely-held belief that gross overparameterization is essential to effective learning. In this work, we argue that this is not necessarily true. We describe a dynamic sparse reparameterization technique that closed the performance gap between a model compressed through iterative pruning and a model of the post-compression size trained de novo. We applied our method to training deep residual networks and showed that it outperformed existing reparameterization techniques, yielding the best accuracy for a given parameter budget for training. Compared to existing dynamic reparameterization methods that reallocate non-zero parameters during training, our approach achieved better performance at lower computational cost. Our method is not only of practical value for training under stringent memory constraints, but also potentially informative to theoretical understanding of generalization properties of overparameterized deep neural networks.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep neural network’s success is due in no small part to two of its surprising properties that starkly defy conventional wisdom. First, training of modern deep neural networks is a high-dimensional non-convex optimization problem, a kind prohibitively difficult in general from an optimization theoretic viewpoint. Yet first-order gradient-based methods, stochastic gradient descent (SGD) and its variants, prove to be very effective; training seldom gets trapped in bad local minima. Second, overparameterization (i.e. having more model parameters than training data examples) does not undermine generalization; highly overparameterized models in practice seldom overfit, a phenomenon at odds with traditional principles of statistical learning theory.
|
| 12 |
+
|
| 13 |
+
Simply put, huge models are not hard to train, and trained huge models are not bad ones.
|
| 14 |
+
|
| 15 |
+
Emerging evidence has attributed these effects to the geometry of high-dimensional loss landscapes of overparameterized deep neural networks (Dauphin et al., 2014; Choromanska et al., 2014; Goodfellow et al., 2014; Im et al., 2016; Wu et al., 2017; Liao & Poggio, 2017; Cooper, 2018; Novak et al., 2018), and to the implicit regularization properties of SGD (Brutzkus et al., 2017; Zhang et al., 2018a; Poggio et al., 2017), though a thorough theoretical understanding is not yet complete. On the other hand, practitioners, blessed in this reality, do not seem to shy away from building gigantic models. Models with parameters in the tens and hundreds of millions are common in practice, with the current record holder having a parameter count in the range of a hundred billion (Shazeer et al., 2017).
|
| 16 |
+
|
| 17 |
+
However, huge models are computationally expensive, both spatially (in terms of memory requirements) and temporally (in terms of number of operations), at both training time and inference time. Thus, scalable methods for controlling the computational complexity of deep neural networks are key to making them more useful in practice.
|
| 18 |
+
|
| 19 |
+
To achieve efficient inference, a number of well-established model compression techniques are highly effective in reducing the post-training model size with little degradation in performance. These include distillation (e.g. Bucilua et al. (2006); Hinton et al. (2015)), quantization (e.g. Hubara et al. (2016); McDonnell (2018)), low-rank decomposition (e.g. Denil et al. (2013); Jaderberg et al. (2014)), and pruning (e.g. Han et al. (2015); Zhang et al. (2018b)), to name a few.
|
| 20 |
+
|
| 21 |
+
Despite their success, post-training compression methods require the full overparameterized model to be trained in the first place. Training remains expensive. In order to make training more efficient, significant efforts have been invested into numerical innovations for training at limited precision (e.g. Courbariaux et al. (2016); Koster et al. (2017)). In contrast, however, little progress has been made in ¨ effective training at significantly reduced number of parameters.
|
| 22 |
+
|
| 23 |
+
One obvious alternative toward this goal is to seek novel network architectures, ones that are more parameter efficient 1. In fact, recent architectural innovations in deep convolutional neural networks (CNNs) not only achieved better generalization performance, but parameter efficiency as well (see Section 5).
|
| 24 |
+
|
| 25 |
+
Instead of inventing new networks, an alternative approach is to achieve higher parameter efficiency directly by reparameterizing an existing model architecture. In general, any differentiable reparameterization can be used to augment training of a given model. Let an original network (or a layer therein) be denoted by $\pmb { y } = \bar { f } ( \pmb { x } ; \pmb { \theta } )$ , parameterized by $\theta \in \Theta$ . Reparameterize it by $\phi \in \Phi$ through $\pmb \theta = g ( \phi ; \psi )$ , where $g$ is differentiable w.r.t. $\phi$ but not necessarily w.r.t. $\psi$ . Denote the reparameterized network by $f _ { \psi }$ , considering $\psi$ as metaparameters 2:
|
| 26 |
+
|
| 27 |
+
$$
|
| 28 |
+
{ \pmb y } = f _ { \pmb { \psi } } \left( { \pmb x } ; \pmb { \phi } \right) \triangleq f \left( { \pmb x } ; { \pmb g } ( { \pmb \phi } ; { \pmb \psi } ) \right) .
|
| 29 |
+
$$
|
| 30 |
+
|
| 31 |
+
Training of $f _ { \psi }$ is done by backpropagation further through $g$ , as $\begin{array} { r } { \frac { \partial } { \partial \phi } = \frac { \partial g } { \partial \phi } \frac { \partial } { \partial g } } \end{array}$ . If it is so chosen that $\dim ( \Phi ) < \dim ( \Theta )$ and $f _ { \psi } \approx f$ in terms of its generalization performance, then $f _ { \psi }$ is a more parameter efficient approximation of $f$ .
|
| 32 |
+
|
| 33 |
+
Sparse reparameterization is a special case where $g$ is a linear projection; $\phi$ is the non-zero entries (i.e. “weights”) and $\psi$ their indices (i.e. “connectivity”) in the original parameter $\pmb \theta$ . Likewise, parameter sharing (or more generally linear constraints of parameters) is a similar special case of linear reparameterization where $\phi$ is the tied parameters and $\psi$ their indices. In this sense a convolution layer can be considered a reparameterization of a fully connected layer.
|
| 34 |
+
|
| 35 |
+
Further, if metaparameters $\psi$ are fixed during the course of training, the reparameterization is static, whereas if $\psi$ is adjusted adaptively during training, we call it dynamic reparameterization.
|
| 36 |
+
|
| 37 |
+
Now, the question is: given a full model $f$ , is it possible to find a more efficient reparameterization $f _ { \psi }$ that, trained de novo, can generalize comparably well? The success of various model compression techniques suggests that such reparameterizations might exist for most well-known models, and a recent study (Frankle & Carbin, 2018) made successful post hoc identifications of sparse reparameterized small networks with precisely such properties. Nevertheless, attempts at training small networks de novo typically yield results significantly underperforming networks obtained by compressing larger models (Zhu & Gupta, 2017). This has led to a commonly held belief that gross overparameterization is necessary for effective training. Here we argue that this is not true by presenting a dynamic sparse reparameterization technique able to train sparse models de novo without the need to compress a large model, a desirable feature for training on memory- and power-constrained devices.
|
| 38 |
+
|
| 39 |
+
Our contributions are listed as follows.
|
| 40 |
+
|
| 41 |
+
1. We showed that it is possible to train a small sparse network directly without a larger than inference-time parameter footprint at any stages of training, yet still achieving generalization performance at least on par with post-training iterative pruning of large dense models, yielding the most parameter efficient model at a given sparsity.
|
| 42 |
+
|
| 43 |
+
2. We showed that our method is more scalable and efficient, and leads to significantly better accuracy than existing dynamic sparse reparameterization training techniques.
|
| 44 |
+
|
| 45 |
+
# 2 RELATED WORK
|
| 46 |
+
|
| 47 |
+
Training of differentiably reparameterized networks has been proposed in numerous studies before.
|
| 48 |
+
|
| 49 |
+
Dense reparameterization Several dense reparameterization techniques sought to reduce the size of fully connected layers. These include low-rank decomposition (Denil et al., 2013), fastfood transform (Yang et al., 2014), ACDC transform (Moczulski et al., 2015), HashedNet (Chen et al., 2015), low displacement rank (Sindhwani et al., 2015) and block-circulant matrix parameterization (Treister et al., 2018).
|
| 50 |
+
|
| 51 |
+
Note that similar reparameterizations were also used to introduce certain algebraic properties to the parameters for purposes other than reducing model sizes, e.g. to make training more stable as in unitary evolution RNNs (Arjovsky et al., 2015) and in weight normalization (Salimans & Kingma, 2016), to inject inductive biases (Thomas et al., 2018), and to alter (Dinh et al., 2017) or to measure (Li et al., 2018) properties of the loss landscape. All dense reparameterization methods to date are static.
|
| 52 |
+
|
| 53 |
+
Sparse reparameterization Successful training of sparse reparameterized networks usually employs iterative pruning and retraining, e.g. Han et al. (2015); Narang et al. (2017); Zhu & Gupta (2017) 3. Training typically starts with a large pre-trained model and sparsity is gradually increased during the course of fine-tuning. Training a small, static, and sparse model de novo always fared much worse than training a large one to begin with (Zhu & Gupta, 2017).
|
| 54 |
+
|
| 55 |
+
Frankle & Carbin (2018) successfully identified small and sparse subnetworks post-training which, when trained in isolation, reached a similar accuracy as the enclosing big network. They further showed that these subnetworks were sensitive to initialization, and hypothesized that the role of overparameterization is to provide a large number of candidate subnetworks, thereby increasing the likelihood that one of these subnetworks will have the necessary structure and initialization needed for effective learning.
|
| 56 |
+
|
| 57 |
+
Most closely related to our work are dynamic sparse reparameterization techniques that emerged only recently. Like ours, these methods adaptively alter, by certain heuristic rules, reparameterization during training. Sparse evolutionary training (Mocanu et al., 2018) used magnitude-based pruning and random growth at the end of each training epoch. NeST (Dai et al., 2017; 2018) iteratively grew and pruned parameters and neurons during training; parameter growth was guided by gradient and pruning by magnitude. Deep rewiring (Bellec et al., 2017) combined sparse reparameterization with stochastic parameter updates for training. These methods were mostly concerned with sparsifying fully connected layers and applied to relatively small and shallow networks. We show that the method we propose in this paper is more scalable and computationally efficient than these previous approaches, while achieving better performance on deep convolutional networks.
|
| 58 |
+
|
| 59 |
+
# 3 METHODS
|
| 60 |
+
|
| 61 |
+
In this section, we describe our dynamic sparse reparameterization method. Some notations first. Let all reparameterized weight tensors in the original network be denoted by $\{ \boldsymbol { \mathsf { W } } _ { l } \}$ , where $l = 1 , \cdots , L$ indexes layers. Let $N _ { l }$ be the number of parameters in $\boldsymbol { \mathsf { W } } _ { l }$ , and $N = \textstyle \sum _ { l } \bar { N _ { l } }$ the total parameter count.
|
| 62 |
+
|
| 63 |
+
Sparse reparameterize $\pmb { \mathsf { W } } _ { l } = g \left( \phi _ { l } ; \psi _ { l } \right)$ , where function $g$ places components of parameter $\phi _ { l }$ into positions in $\boldsymbol { \mathsf { W } } _ { l }$ indexed by $\psi _ { l } \in \Psi _ { M _ { l } } \left( \{ 1 , \cdot \cdot \cdot , N _ { l } \} \right) ^ { \angle }$ 4, s.t. $W _ { l , \psi _ { l , i } } = \phi _ { l , i } , \forall i$ indexing components. Let $M _ { l } < N _ { l }$ be the dimensionality of $\phi _ { l }$ and $\psi _ { l }$ , i.e. the number of non-zero weights in $\boldsymbol { \mathsf { W } } _ { l }$ . Define $\begin{array} { r } { s _ { l } = 1 - \frac { M _ { l } } { N _ { l } } } \end{array}$ as the sparsity of $\boldsymbol { \mathsf { W } } _ { l }$ . Global sparsity is then defined as $\begin{array} { r } { s = 1 - \frac { M } { N } } \end{array}$ where $\begin{array} { r } { M = \sum _ { l } M _ { l } } \end{array}$
|
| 64 |
+
|
| 65 |
+
During the whole course of training, we kept global sparsity constant, specified by hyperparameter $s \in ( 0 , 1 )$ . Reparameterization was initialized by uniformly sampling positions in each weight tensor
|
| 66 |
+
|
| 67 |
+
Input: $\left\{ \left( \phi _ { l } ^ { ( t ) } , \psi _ { l } ^ { ( t ) } \right) \right\}$ , M (t) , H (t) . From step t
|
| 68 |
+
Output: nφ(t+1)l , ψ(t+1)l o, M (t+1), H (t+1) . To step $t + 1$
|
| 69 |
+
Need: K, δ . Target number of parameters to be pruned and its fractional tolerance
|
| 70 |
+
1 for $l \in \{ 1 , \cdots , L \}$ do $\triangleright$ For each reparameterized weight tensor
|
| 71 |
+
2 $\Pi _ { l } ^ { ( t ) } \gets \left\{ i : \big | \phi _ { l , i } ^ { ( t ) } \big | < H ^ { ( t ) } \right\}$ . Indices of subthreshold components of $\phi _ { l } ^ { ( t ) }$ to be pruned
|
| 72 |
+
3 $\left( \boldsymbol { K } _ { l } ^ { ( t ) } , \boldsymbol { R } _ { l } ^ { ( t ) } \right) \gets \left( \big | \Pi _ { l } ^ { ( t ) } \big | , M _ { l } ^ { ( t ) } - \big | \Pi _ { l } ^ { ( t ) } \big | \right)$ . Numbers of pruned and surviving weights
|
| 73 |
+
4 if $\begin{array} { r } { \sum _ { l } K _ { l } ^ { ( t ) } < ( 1 - \delta ) K } \end{array}$ then $\triangleright$ Too few parameters pruned
|
| 74 |
+
5 $H ^ { ( t + 1 ) } \gets 2 H ^ { ( t ) }$ $\triangleright$ Increase pruning threshold
|
| 75 |
+
6 else if $\begin{array} { r } { \sum _ { l } K _ { l } ^ { ( t ) } > ( 1 + \delta ) K } \end{array}$ then . Too many parameters pruned
|
| 76 |
+
7 $\begin{array} { r } { H ^ { ( t + 1 ) } \gets \frac { 1 } { 2 } H ^ { ( t ) } } \end{array}$ $\triangleright$ Decrease pruning threshold
|
| 77 |
+
8 else . A proper number of parameters pruned
|
| 78 |
+
9 $H ^ { ( t + 1 ) } H ^ { ( t ) }$ . Maintain pruning threshold
|
| 79 |
+
10 for $l \in \{ 1 , \cdots , L \}$ do . For each reparameterized weight tensor
|
| 80 |
+
11 $\begin{array} { r } { G _ { l } ^ { ( t ) } \gets \left\lfloor \frac { R _ { l } ^ { ( t ) } } { \sum _ { l } R _ { l } ^ { ( t ) } } \sum _ { l } K _ { l } ^ { ( t ) } \right\rceil } \end{array}$ . Redistribute parameters for growth
|
| 81 |
+
12 ψ˜(t)l ∼ U hΨG(t)l {1, · · · , Nl} \ nψ(t)l,i oi . Sample zero positions to grow new weights
|
| 82 |
+
13 14 M l ← M l − K l + G l φ ( t +1)l , ψ ( t +1)l ← φ ( t )l ,i /∈ Π ( t )l , 0 , ψ ( t )l ,i /∈ Π ( t )l , ψ˜ ( t )l . New parameter count. New reparameterization
|
| 83 |
+
|
| 84 |
+
at the global sparsity $s$ , i.e. $\boldsymbol { \psi } _ { l } ^ { ( 0 ) } \sim \mathcal { U } \left[ \boldsymbol { \Psi } _ { M _ { l } ^ { ( 0 ) } } \left( \left\{ 1 , \cdots , N _ { l } \right\} \right) \right] , \forall l$ , where $M _ { l } ^ { ( 0 ) } = \left\lfloor ( 1 - s ) N _ { l } \right\rceil$ .
|
| 85 |
+
Associated parameters $\phi _ { l } ^ { ( 0 ) }$ were randomly initialized.
|
| 86 |
+
|
| 87 |
+
Dynamic reparameterization was done periodically by repeating the following steps during training: 1. Train the model (currently reparameterized by $\left\{ \left( \phi _ { l } ^ { ( t ) } , \psi _ { l } ^ { ( t ) } \right) \right\} )$ for $P$ batch iterations; 2. Reallocate free paramenew reparameterization $\left\{ \left( \phi _ { l } ^ { ( t + 1 ) } , \psi _ { l } ^ { ( t + 1 ) } \right) \right\}$ weight tensors following Algorithm 1 to arrive at.
|
| 88 |
+
|
| 89 |
+
The adaptive reallocation is in essence a two-step procedure: a global pruning followed by a tensorwise growth. Specifically our algorithm has the following key features:
|
| 90 |
+
|
| 91 |
+
• Pruning was based on magnitude of weights, by comparing all parameters to a global threshold $H$ , making the algorithm much more scalable than methods relying on layer-specific pruning. • We made $H$ adaptive, subject to a simple setpoint control dynamics that ensured roughly $K$ weights to be pruned globally per iteration. This proved to be much cheaper computationally than pruning exactly $K$ smallest weights, which requires sorting all weights in the network. • Growth was by uniformly sampling zero weights and tensor-specific, thereby achieving a reallocation of parameters across layers. The heuristic guiding growth is
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
G _ { l } ^ { ( t ) } = \left\lfloor \frac { R _ { l } ^ { ( t ) } } { \sum _ { l } R _ { l } ^ { ( t ) } } \sum _ { l } K _ { l } ^ { ( t ) } \right\rceil ,
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where K(t) and $R _ { l } ^ { ( t ) } = M _ { l } ^ { ( t ) } - K _ { l } ^ { ( t ) }$ are the pruned and surviving parameter counts, respectively. This rule allocated more free parameters to weight tensors with more surviving entries, while keeping the global sparsity the same by balancing numbers of parameters pruned and grown 5.
|
| 98 |
+
|
| 99 |
+
Table 1: Datasets and models used in experiments
|
| 100 |
+
|
| 101 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=2>|MNIST CIFAR10</td><td rowspan=1 colspan=1>|Imagenet</td></tr><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=2>|LeNet-300-100 |WRN-28-2(LeCun et al.,1998)[(Zagoruyko & Komodakis,2016)</td><td rowspan=1 colspan=1>Resnet-50(He et al., 2015)</td></tr><tr><td rowspan=1 colspan=1>Architecture</td><td rowspan=1 colspan=1>F300F100F10</td><td rowspan=1 colspan=1>C16/3×3[C16/3×3,C16/3×3]×4[C64/3×3,C64/3 ×3]×4[C128/3×3,C128/3×3]×4GlobalAvgPool,F10</td><td rowspan=1 colspan=1>C64/7×7-2,MaxPool/3×3-2[C64/1×1,C64/3×3,C256/1×1]×3[C128/1×1,C128/3×3,C512/1×1]×4[C256/1×1,C256/3×3,C1024/1×1]×6[C512/1×1,C512/3×3,C2048/1×1]×3GlobalAvgPool,F100</td></tr><tr><td rowspan=1 colspan=1># Parameters|267K</td><td rowspan=1 colspan=2>|1.5M</td><td rowspan=1 colspan=1>|25.6M</td></tr></table>
|
| 102 |
+
|
| 103 |
+
For brevity architecture specifications omit batch normalization and activations. Fully connected (F) and convolutional (C) layers are specified with output size and kernel size, Max pooling (MaxPool) with kernel size and none with global average pooling (GlobalAvgPool). Brackets enclose residual blocks postfixed with repetition numbers; downsampling convolution in the first block of a scale group is implied.
|
| 104 |
+
|
| 105 |
+
The entire procedure can be fully specified by hyperparameters $( s , P , K , \delta , H ^ { ( 0 ) } )$ . For specific values used in experiments see implementational details in Appendix A.
|
| 106 |
+
|
| 107 |
+
# 4 EXPERIMENTAL RESULTS
|
| 108 |
+
|
| 109 |
+
We evaluated our method in three sets of experiments (Table 1). We chose more modern convolutional networks, Resnet (He et al., 2015) and Wide Resnet (Zagoruyko & Komodakis, 2016), with parameter efficiency superior to earlier models, e.g. AlexNet (Krizhevsky et al., 2012) and VGG (Simonyan & Zisserman, 2014), thanks to the adoption of skip connections and use of global average pooling over fully connected layers. Such a setup makes a much stronger case for our method because compression is much harder for these recent models. Pre-activation batch normalization was used in all cases.
|
| 110 |
+
|
| 111 |
+
Dynamic sparse reparameterization was applied to all weight tensors of fully connected and convolutional layers (with the exception of downsampling convolutions and the first convolutional layer taking the input image), while all biases and parameters of normalization layers were kept dense 6.
|
| 112 |
+
|
| 113 |
+
At a specific sparsity $s$ , we compared our method (dynamic sparse) against six baselines:
|
| 114 |
+
|
| 115 |
+
• Full dense: original large and dense model, with $N$ parameters;
|
| 116 |
+
• Thin dense: original model with less wide layers, such that it had $( 1 - s ) N$ parameters;
|
| 117 |
+
• Static sparse: original model reparameterized to sparsity $s$ , then trained with connectivity fixed;
|
| 118 |
+
• Compressed sparse: state-of-the-art compression of the original model by iterative pruning and retraining the original model to target sparsity $s$ (Zhu & Gupta, 2017);
|
| 119 |
+
• DeepR: sparse model trained by using Deep Rewiring (Bellec et al., 2017);
|
| 120 |
+
• SET: sparse model trained by using Sparse Evolutionary Training (Mocanu et al., 2018).
|
| 121 |
+
|
| 122 |
+
Note that compressed sparse is a compression method that starts training with a dense model, whereas DeepR and SET, like ours, are dynamic reparameterization techniques that maintain sparsity throughout training. See Appendix A for hyperparameters used in the experiments.
|
| 123 |
+
|
| 124 |
+
LeNet-300-100 on MNIST Like previous work on post-training compression, e.g. Han et al. (2015), and dynamic reparameterization, e.g. Bellec et al. (2017), we first experimented with a simple LeNet-300-100 trained on MNIST. We found that static sparse grossly underperformed compressed sparse, a gap effectively closed by our dynamic sparse method (Figure 1a) with the following nuances. Dynamic sparse slightly outperformed compressed sparse at very high sparsity (i.e. low parameter count), a trend reversed, albeit weakly, at lower sparsities.
|
| 125 |
+
|
| 126 |
+
A breakdown of post-training sparsities across layers of the network (Figure 1b) reveals reliable patterns emerged from the dynamics of our adaptive reparameterization algorithm. This is consistent with previous observations (Bellec et al., 2017) that, given a fixed global sparsity, it was wiser to allocate more free parameters to the last layer, than to impose constant sparsity on all layers.
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
Figure 1: LeNet-300-100 on MNIST. (a) Test accuracy plotted against number of trainable parameters for different methods. Dashed lines are used for full dense model and for compression methods, whereas all reparameterization methods maintaining a fixed sparsity level throughout training are represented by solid lines. Circular symbols mark the median of 5 runs, error bars standard deviation. Parameter counts include all trainable parameters, i.e. reparameterized sparse paremeter tensors plus all other parameter tensors that were kept dense, such as those of batch normalization layers. For small numbers of trainable parameters, the static sparse model fails to learn (not shown, out of ordinate range). (b) Layer-wise breakdown of final sparsities emerged from our dynamic sparse parameterization algorithm (Algorithm 1) at different levels of overall sparsity. Mean and standard deviation from 5 runs.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 2: WRN-28-2 on CIFAR10. (a) Test accuracy plotted against number of trainable parameters for different methods. Conventions same as in Figure 1a. (b) Breakdown of final sparsities emerged from our dynamic sparse parameterization algorithm (Algorithm 1) at different levels of global sparsity. (c) A further breakdown of final sparsities of individual residual blocks in the WRN groups at three scales, at the overall sparsity of 0.6. (d) Same as (c) at overall sparsity of 0.8. All results in (b, c & d) are mean and standard deviation from 5 runs.
|
| 133 |
+
|
| 134 |
+
WRN-28-2 on CIFAR10 Next, we experimented with a Wide Resnet model WRN-28-2 (Zagoruyko & Komodakis, 2016) trained to classify CIFAR10 images (see Appendix A for details of implementation). As shown in Figure 2a, static sparse and thin dense significantly underperformed the state-of-the-art compressed sparse model, whereas our method dynamic sparse significantly outperformed it. Deep rewiring significantly lagged all other method. While the performance of SET was on par with compressed sparse, it lagged behind dynamic sparse at high sparsity levels. At low sparsity levels SET largely closed the gap to compressed sparse.
|
| 135 |
+
|
| 136 |
+
Table 2: Test accuracy $\%$ (top-1, top-5) of Resnet-50 trained on Imagenet
|
| 137 |
+
|
| 138 |
+
<table><tr><td colspan="3">Final overall sparsity (# Parameters) |</td><td colspan="2">0.8 (7.3M)</td><td>0.9 (5.1M)</td><td colspan="2">0.0 (25.6M)</td></tr><tr><td rowspan="2">Reparameterization</td><td>static</td><td>Thin dense Static sparse DeepR</td><td>71.6 [-3.3] 70.4 [-4.5] 1</td><td>90.3 [-2.1] 89.8 [-2.6] 1</td><td>69.4 89.2 [-5.5] [-3.2] 66.4 87.4 [-8.5] [-5.0] 1 1</td><td rowspan="2">74.9 92.4 [0.0] [0.0]</td></tr><tr><td>dynamic</td><td>(Bellec et al., 2017) SET (Mocanu et al., 2018) Dynamic sparse (Ours)</td><td>[-] 72.6 [-2.3] 73.3 [-1.6]</td><td>[-] 91.2 [-1.2] 92.4 [0.0]</td><td>[-] [-] 70.4 90.1 [-4.5] [-2.3] 71.6 90.5 [-3.3] [-1.9]</td></tr><tr><td colspan="2" rowspan="2">Compression</td><td>Compressed sparse (Zhu & Gupta, 2017) ThiNet</td><td>73.2 [-1.7] 68.4</td><td>91.5 [-0.9]</td><td>70.3 90.0 [-4.6] [-2.4]</td><td colspan="2"></td></tr><tr><td>(Luo et al., 2017) sss (Huang & Wang,2017)</td><td>[-4.5] 71.8 [-4.3]</td><td>88.3 [-2.8] 90.8 [-2.1]</td><td></td><td colspan="2">(at 8.7M parameter count) (at 15.6M parameter count)</td></tr></table>
|
| 139 |
+
|
| 140 |
+
Numbers in square brackets are differences from the full dense baseline. Romanized numbers are results of our experiments, and italicized ones taken directly from the original paper. Performance of two structured pruning methods, ThiNet and Sparse Structure Selection (SSS), are also listed for comparison (below the double line, see Appendix C for discussion of their relevance); note the difference in parameter counts.
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Figure 3: Block-wise breakdown of final sparsities of Resnet-50 trained on Imagenet. (a) At overall sparsity 0.8. Similar to Figure 2c. (b) Same as (a) at overall sparsity of 0.9.
|
| 144 |
+
|
| 145 |
+
Again, consistent sparsity patterns emerged from the adaptive reparameterization dynamics of Algorithm 1 (Figure 2b, c & d). We observed two rough trends: (a) larger parameter tensors tended to be sparser than smaller ones, and (b) deeper layers tended to be sparser than shallower ones.
|
| 146 |
+
|
| 147 |
+
Resnet-50 on Imagenet Finally, we experimented with the Resnet-50 bottleneck architecture (He et al., 2015) trained on Imagenet (see Appendix A for details of implementation). We tested two global sparsity levels, 0.8 and 0.9 (Table 2). Again, our method (dynamic sparse) outperformed state-of-the-art sparse compression (compressed sparse), which in turn outperformed static sparse and thin dense baselines. We also list in Table 2 two representative methods of structured pruning (see Appendix C), ThiNet (Luo et al., 2017) and Sparse Structure Selection (Huang & Wang, 2017), which, consistent with recent criticisms (Liu et al., 2018), underperformed static dense baselines.
|
| 148 |
+
|
| 149 |
+
Consistent with the aforementioned experiments with LeNet-100-10 and WRN-28-2, reliable sparsity patterns across layers emerged from dynamic parameter reallocation during training, displaying the same empirical trends described above (Figure 3).
|
| 150 |
+
|
| 151 |
+
Computational overhead of dynamic reparameterization We assessed the additional computational cost incurred by reparameterization steps (Algorithm 1) during training, and compared ours with existing dynamic sparse reparameterization techniques, DeepR and SET (Table 3). Because both SET and ours reallocate parameters only intermittently (every few hundred training iterations), the computational overhead was negligible for the experiments presented here7. DeepR, however, requires adding noise to gradient updates as well as reallocating parameters every training iteration, and therefore led to a significantly larger overhead.
|
| 152 |
+
|
| 153 |
+
Table 3: Computational overhead of dynamic reparameterization during training
|
| 154 |
+
|
| 155 |
+
<table><tr><td></td><td>WRN-28-2 on CIFAR10</td><td>Resnet-50 on Imagenet</td></tr><tr><td>DeepR (Bellec et al., 2017)</td><td>4.466 ± 0.358</td><td>5.636 ± 0.218</td></tr><tr><td>SET (Mocanu et al., 2018)</td><td>1.087 ± 0.049</td><td>1.009 ± 0.002</td></tr><tr><td>Dynamic sparse (Ours)</td><td>1.083 ± 0.051</td><td>1.005 ± 0.004</td></tr></table>
|
| 156 |
+
|
| 157 |
+
Shown are median ratios of wall-clock epoch times for training with over without reparameterization, standard deviation estimated from 25 epochs. WRN-28-2 on CIFAR10 was trained on a single Nvidia Titan $\mathrm { X p }$ GPU, and Resnet-50 on Imagenet on four with data parallelism (also see Appendix A for implementation details).
|
| 158 |
+
|
| 159 |
+
# 5 DISCUSSION
|
| 160 |
+
|
| 161 |
+
In this work, we described and validated the best known solution so far to the following problem: given a small, fixed budget of parameters for a deep CNN throughout training time, how to train it to yield the best generalization performance. Our method used a dynamic reparameterization technique that adaptively reallocated free parameters across the network based on a simple heuristic. We demonstrated that this method not only fared much better than static reparameterization techniques, but also significantly outperformed even the state-of-the-art sparse compression methods. Note that compression is a much more forgiving situation where the parameter budget is not imposed during the entire course, but only at the end, of training.
|
| 162 |
+
|
| 163 |
+
Thus, our method yielded the most parameter efficient sparse reparameterization of a given CNN. The past few years have seen a steady improvement in parameter efficiency of state-of-the-art CNN models thanks to innovations in network architectures. Specifically, the introduction of residual modules and the use of global pooling in place of fully connected layers are largely responsible, as convolutional layers are more parameter efficient than fully connected layers in general. For example, AlexNet (Krizhevsky et al., 2012) had a majority of its parameters in fully connected layers, and this fraction has been decreasing in VGG (Simonyan & Zisserman, 2014), Inception (Szegedy et al., 2014), and more recently in Resnets (He et al., 2015) it was reduced to close to none. Meanwhile, compact architectures with far fewer parameters also emerged at reasonable costs of performance degradation, e.g. SqueezeNet (Iandola et al., 2016) and MobileNet (Howard et al., 2017), for niche use cases where computing resources are limited.
|
| 164 |
+
|
| 165 |
+
Here we took a different, but complementary, approach. Instead of searching the space of network architectures for new models with superior parameter efficiency, we sought to reparameterize a given model to make it more parameter efficient. Such techniques have a history as long as modern convolutional networks. Most early methods used dense reparameterization (Denil et al., 2013; Yang et al., 2014; Moczulski et al., 2015; Sindhwani et al., 2015), effective in reducing redundancy in fully connected layers of big sizes, such as in AlexNet. These became less relevant as models became increasingly free of large linear layers but heavy in convolutional ones 8.
|
| 166 |
+
|
| 167 |
+
Sparse reparameterization, on the other hand, has been shown useful in compression of state-of-the-art deep CNNs (Han et al., 2015; Narang et al., 2017). However, a prominent empirical observation from these compression studies is that training a small sparse model de novo could never reach the same accuracy achieved by one of the same size compressed down from a large model (Zhu & Gupta, 2017). Why does it seem impossible to train a compact network but easy to compress a large one?
|
| 168 |
+
|
| 169 |
+
The “lottery ticket hypothesis” (Frankle & Carbin, 2018) offered a plausible explanation. The authors identified, by post-training pruning, trainable sparse models that, albeit sensitive to initialization, generalized comparably well (called “winning tickets”). They further posited that, the necessity of starting training with a large model is because only a big network with combinatorially a huge number of small subnetworks has a high probability of “winning the initialization lottery”. Similarly, here we argue that post hoc identification of trainable compact (not necessarily sparse) reparameterization is actually rather trivial also because the optimization trajectory is typically a very low-dimensional object. Take for example the training of Resnet-152 (parameter count 60.2M) as described by He et al. (2015): parameter updates for 600K iterations reliably send a random initialization to a state-of-the-art solution. One could simply take a trivial post hoc reparameterization as a linear projection onto the span of the 600K parameter updates which, even if they are all linearly independent from each other, amount to less than $1 \%$ of the total parameter count. The low dimensionality of optimization trajectory is consistent with emerging evidence suggesting that optima of overparameterized deep neural networks are usually high-dimensional manifolds with low co-dimensions (Cooper, 2018), and that such optima have superior generalization properties (Wu et al., 2017) and favored by SGD (Zhang et al., 2018a; Poggio et al., 2017).
|
| 170 |
+
|
| 171 |
+
What prohibits any post hoc reparameterized compact model from being effectively trained de novo is however its sensitivity to initialization–though optimization trajectories are each low-dimensional, their linear spans do not necessarily overlap when starting from different initial points. An obvious way “to win the lottery” is to purchase all available tickets (i.e. having a huge model to cover all possible linear spans of optimization trajectories), but it is also conceivably feasible “to cheat” by adaptively changing the number on a single ticket as the lottery result is being announced (i.e. dynamic reparameterization that continually re-orients a low-dimensional parameter manifold tangentially along an optimization trajectory). We believe our method did exactly this.
|
| 172 |
+
|
| 173 |
+
We were inspired by previous methods of dynamic sparse reparameterization, e.g. DeepR (Bellec et al., 2017) and SET (Mocanu et al., 2018) (also see Appendix C). Compared to these techniques, our method has a number of advantages. First, ours produced better performing sparse CNNs, fully closed the gap to compression of large dense models. Second, our reparameterization incurred the least computational overhead during training by infrequent and cheap parameter reallocation. Finally, our method is highly scalable thanks to its automatic reallocation of parameters across layers, without the need of manually configuring sparsity for each layer 9.
|
| 174 |
+
|
| 175 |
+
A noteworthy observation from our experiments is that the highest parameter efficiency was achieved by non-structured sparsification (see Appendix C for details). Accuracy suffered significantly when structure was imposed on the sparsity patterns (see Appendix D). Because computations involving fine-grained sparsity cannot be readily accelerated on GPUs, a number of compression methods by structured pruning (see Appendix C) remove entire channels from deep CNNs to yield smaller networks with dense parameter tensors. However, many of these structured pruning methods produced compressed models no better than direct training of a thin dense model (Liu et al., 2018) (also see Table 2 for examples compared with our method).
|
| 176 |
+
|
| 177 |
+
Our findings suggest that it is possible to train sparse models directly to reach generalization performances equal to or better than those of dense or sparse networks of comparable size produced by compression. This warrants a renewed look at the practical choices of best hardware architectures for training, between computing devices optimized for dense linear algebra versus those suited for sparse operations.
|
| 178 |
+
|
| 179 |
+
# REFERENCES
|
| 180 |
+
|
| 181 |
+
Martin Arjovsky, Amar Shah, and Yoshua Bengio. Unitary Evolution Recurrent Neural Networks. nov 2015. URL http://arxiv.org/abs/1511.06464.
|
| 182 |
+
|
| 183 |
+
Guillaume Bellec, David Kappel, Wolfgang Maass, and Robert Legenstein. Deep Rewiring: Training very sparse deep networks. nov 2017. URL http://arxiv.org/abs/1711.05136.
|
| 184 |
+
|
| 185 |
+
Alon Brutzkus, Amir Globerson, Eran Malach, and Shai Shalev-Shwartz. SGD Learns Overparameterized Networks that Provably Generalize on Linearly Separable Data. oct 2017. URL http://arxiv.org/abs/1710.10174.
|
| 186 |
+
|
| 187 |
+
Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model Compression. Technical report, 2006. URL https://www.cs.cornell.edu/{˜}caruana/compression. kdd06.pdf.
|
| 188 |
+
|
| 189 |
+
Wenlin Chen, James T. Wilson, Stephen Tyree, Kilian Q. Weinberger, and Yixin Chen. Compressing Neural Networks with the Hashing Trick. apr 2015. URL http://arxiv.org/abs/1504. 04788.
|
| 190 |
+
|
| 191 |
+
Anna Choromanska, Mikael Henaff, Michael Mathieu, Gerard Ben Arous, and Yann LeCun. The Loss ´ Surfaces of Multilayer Networks. nov 2014. URL http://arxiv.org/abs/1412.0233.
|
| 192 |
+
|
| 193 |
+
Y Cooper. The loss landscape of overparameterized neural networks. apr 2018. URL http: //arxiv.org/abs/1804.10200.
|
| 194 |
+
|
| 195 |
+
Matthieu Courbariaux, Itay Hubara, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized Neural Networks: Training Deep Neural Networks with Weights and Activations Constrained to $+ 1$ or -1. feb 2016. URL http://arxiv.org/abs/1602.02830.
|
| 196 |
+
|
| 197 |
+
Xiaoliang Dai, Hongxu Yin, and Niraj K. Jha. NeST: A Neural Network Synthesis Tool Based on a Grow-and-Prune Paradigm. pp. 1–15, 2017. URL http://arxiv.org/abs/1711.02017.
|
| 198 |
+
|
| 199 |
+
Xiaoliang Dai, Hongxu Yin, and Niraj K. Jha. Grow and Prune Compact, Fast, and Accurate LSTMs. may 2018. URL http://arxiv.org/abs/1805.11797.
|
| 200 |
+
|
| 201 |
+
Yann Dauphin, Razvan Pascanu, Caglar Gulcehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. arXiv, pp. 1–14, 2014. URL http://arxiv.org/abs/1406.2572.
|
| 202 |
+
|
| 203 |
+
Misha Denil, Babak Shakibi, Laurent Dinh, Marc’Aurelio Ranzato, and Nando de Freitas. Predicting Parameters in Deep Learning. jun 2013. URL http://arxiv.org/abs/1306.0543.
|
| 204 |
+
|
| 205 |
+
Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp Minima Can Generalize For Deep Nets. 2017. ISSN 1938-7228. URL http://arxiv.org/abs/1703.04933.
|
| 206 |
+
|
| 207 |
+
Jonathan Frankle and Michael Carbin. The Lottery Ticket Hypothesis: Finding Small, Trainable Neural Networks. mar 2018. URL http://arxiv.org/abs/1803.03635.
|
| 208 |
+
|
| 209 |
+
Ian J. Goodfellow, Oriol Vinyals, and Andrew M. Saxe. Qualitatively characterizing neural network optimization problems. dec 2014. URL http://arxiv.org/abs/1412.6544.
|
| 210 |
+
|
| 211 |
+
Song Han, Jeff Pool, John Tran, and William J. Dally. Learning both Weights and Connections for Efficient Neural Networks. jun 2015. URL http://arxiv.org/abs/1506.02626.
|
| 212 |
+
|
| 213 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. Arxiv.Org, 7(3):171–180, 2015. ISSN 1664-1078. doi: 10.3389/fpsyg.2013.00124. URL http://arxiv.org/pdf/1512.03385v1.pdf.
|
| 214 |
+
|
| 215 |
+
Yihui He, Xiangyu Zhang, and Jian Sun. Channel Pruning for Accelerating Very Deep Neural Networks. jul 2017. URL http://arxiv.org/abs/1707.06168.
|
| 216 |
+
|
| 217 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the Knowledge in a Neural Network. pp. 1–9, 2015. ISSN 0022-2488. doi: 10.1063/1.4931082. URL http://arxiv.org/abs/ 1503.02531.
|
| 218 |
+
|
| 219 |
+
Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. apr 2017. URL http://arxiv.org/abs/1704.04861.
|
| 220 |
+
|
| 221 |
+
Zehao Huang and Naiyan Wang. Data-Driven Sparse Structure Selection for Deep Neural Networks. jul 2017. URL https://arxiv.org/abs/1707.01213.
|
| 222 |
+
|
| 223 |
+
Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Quantized Neural Networks: Training Neural Networks with Low Precision Weights and Activations. sep 2016. URL http://arxiv.org/abs/1609.07061.
|
| 224 |
+
|
| 225 |
+
Forrest N. Iandola, Song Han, Matthew W. Moskewicz, Khalid Ashraf, William J. Dally, and Kurt Keutzer. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and. feb 2016. URL http://arxiv.org/abs/1602.07360.
|
| 226 |
+
|
| 227 |
+
Daniel Jiwoong Im, Michael Tao, and Kristin Branson. An empirical analysis of the optimization of deep network loss surfaces. dec 2016. URL http://arxiv.org/abs/1612.04010.
|
| 228 |
+
|
| 229 |
+
Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up Convolutional Neural Networks with Low Rank Expansions. may 2014. URL http://arxiv.org/abs/1405.3866.
|
| 230 |
+
|
| 231 |
+
Urs Koster, Tristan J. Webb, Xin Wang, Marcel Nassar, Arjun K. Bansal, William H. Constable, ¨ Ouz H. Elibol, Scott Gray, Stewart Hall, Luke Hornof, Amir Khosrowshahi, Carey Kloss, Ruby J. Pai, and Naveen Rao. Flexpoint: An Adaptive Numerical Format for Efficient Training of Deep Neural Networks. nov 2017. URL http://arxiv.org/abs/1711.02213.
|
| 232 |
+
|
| 233 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. ImageNet Classification with Deep Convolutional Neural Networks. Technical report, 2012.
|
| 234 |
+
|
| 235 |
+
Vadim Lebedev and Victor Lempitsky. Fast ConvNets Using Group-wise Brain Damage. jun 2015. URL https://arxiv.org/abs/1506.02515.
|
| 236 |
+
|
| 237 |
+
Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2323, 1998. ISSN 00189219. doi: 10.1109/5.726791.
|
| 238 |
+
|
| 239 |
+
Chunyuan Li, Heerad Farkhoor, Rosanne Liu, and Jason Yosinski. Measuring the Intrinsic Dimension of Objective Landscapes. apr 2018. URL http://arxiv.org/abs/1804.08838.
|
| 240 |
+
|
| 241 |
+
Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning Filters for Efficient ConvNets. aug 2016. URL http://arxiv.org/abs/1608.08710.
|
| 242 |
+
|
| 243 |
+
Qianli Liao and Tomaso Poggio. Theory of Deep Learning II: Landscape of the Empirical Risk in Deep Learning. arXiv, mar 2017. URL http://arxiv.org/abs/1703.09833.
|
| 244 |
+
|
| 245 |
+
Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning Efficient Convolutional Networks through Network Slimming. aug 2017. URL https://arxiv. org/abs/1708.06519.
|
| 246 |
+
|
| 247 |
+
Zhuang Liu, Mingjie Sun, Tinghui Zhou, Gao Huang, and Trevor Darrell. Rethinking the Value of Network Pruning. oct 2018. URL http://arxiv.org/abs/1810.05270.
|
| 248 |
+
|
| 249 |
+
Jian-Hao Luo, Jianxin Wu, and Weiyao Lin. ThiNet: A Filter Level Pruning Method for Deep Neural Network Compression. jul 2017. URL http://arxiv.org/abs/1707.06342.
|
| 250 |
+
|
| 251 |
+
Mark D. McDonnell. Training wide residual networks for deployment using a single bit for each weight. feb 2018. URL http://arxiv.org/abs/1802.08530.
|
| 252 |
+
|
| 253 |
+
Deepak Mittal, Shweta Bhardwaj, Mitesh M. Khapra, and Balaraman Ravindran. Recovering from Random Pruning: On the Plasticity of Deep Convolutional Neural Networks. jan 2018. URL http://arxiv.org/abs/1801.10447.
|
| 254 |
+
|
| 255 |
+
Decebal Constantin Mocanu, Elena Mocanu, Peter Stone, Phuong H. Nguyen, Madeleine Gibescu, and Antonio Liotta. Scalable training of artificial neural networks with adaptive sparse connectivity inspired by network science. Nature Communications, 9(1):2383, dec 2018. ISSN 2041- 1723. doi: 10.1038/s41467-018-04316-3. URL http://www.nature.com/articles/ s41467-018-04316-3.
|
| 256 |
+
|
| 257 |
+
Marcin Moczulski, Misha Denil, Jeremy Appleyard, and Nando de Freitas. ACDC: A Structured Efficient Linear Layer. nov 2015. URL http://arxiv.org/abs/1511.05946.
|
| 258 |
+
|
| 259 |
+
Sharan Narang, Erich Elsen, Gregory Diamos, and Shubho Sengupta. Exploring Sparsity in Recurrent Neural Networks. apr 2017. URL http://arxiv.org/abs/1704.05119.
|
| 260 |
+
|
| 261 |
+
Roman Novak, Yasaman Bahri, Daniel A. Abolafia, Jeffrey Pennington, and Jascha Sohl-Dickstein. Sensitivity and Generalization in Neural Networks: an Empirical Study. feb 2018. URL http: //arxiv.org/abs/1802.08760.
|
| 262 |
+
|
| 263 |
+
Tomaso Poggio, Kenji Kawaguchi, Qianli Liao, Brando Miranda, Lorenzo Rosasco, Xavier Boix, Jack Hidary, and Hrushikesh Mhaskar. Theory of Deep Learning III: explaining the non-overfitting puzzle. 2017. URL http://arxiv.org/abs/1801.00173.
|
| 264 |
+
|
| 265 |
+
Tim Salimans and Diederik P. Kingma. Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks. feb 2016. URL http://arxiv.org/abs/ 1602.07868.
|
| 266 |
+
|
| 267 |
+
Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer. jan 2017. URL https://arxiv.org/abs/1701.06538.
|
| 268 |
+
|
| 269 |
+
Karen Simonyan and Andrew Zisserman. Very Deep Convolutional Networks for Large-Scale Image Recognition. sep 2014. URL http://arxiv.org/abs/1409.1556.
|
| 270 |
+
|
| 271 |
+
Vikas Sindhwani, Tara N. Sainath, and Sanjiv Kumar. Structured Transforms for Small-Footprint Deep Learning. oct 2015. URL http://arxiv.org/abs/1510.01722.
|
| 272 |
+
|
| 273 |
+
Xavier Suau, Luca Zappella, and Nicholas Apostoloff. Network Compression using Correlation Analysis of Layer Responses. jul 2018. URL http://arxiv.org/abs/1807.10585.
|
| 274 |
+
|
| 275 |
+
Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going Deeper with Convolutions. sep 2014. URL http://arxiv.org/abs/1409.4842.
|
| 276 |
+
|
| 277 |
+
Anna T Thomas, Albert Gu, Tri Dao, Atri Rudra, and R Christopher. Learning invariance with compact transforms. pp. 1–7, 2018.
|
| 278 |
+
|
| 279 |
+
Eran Treister, Lars Ruthotto, Michal Sharoni, Sapir Zafrani, and Eldad Haber. Low-Cost Parameterizations of Deep Convolution Neural Networks. may 2018. URL http://arxiv.org/abs/ 1805.07821.
|
| 280 |
+
|
| 281 |
+
Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning Structured Sparsity in Deep Neural Networks. 2016. ISSN 0028-0836. doi: 10.1109/HPCA.2015.7056066. URL https://papers.nips.cc/paper/ 6504-learning-structured-sparsity-in-deep-neural-networks.pdf.
|
| 282 |
+
|
| 283 |
+
Lei Wu, Zhanxing Zhu, and Weinan E. Towards Understanding Generalization of Deep Learning: Perspective of Loss Landscapes. jun 2017. URL http://arxiv.org/abs/1706.10239.
|
| 284 |
+
|
| 285 |
+
Zichao Yang, Marcin Moczulski, Misha Denil, Nando de Freitas, Alex Smola, Le Song, and Ziyu Wang. Deep Fried Convnets. dec 2014. URL http://arxiv.org/abs/1412.7149.
|
| 286 |
+
|
| 287 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide Residual Networks. may 2016. URL http: //arxiv.org/abs/1605.07146.
|
| 288 |
+
|
| 289 |
+
Chiyuan Zhang, Qianli Liao, Alexander Rakhlin, Brando Miranda, Noah Golowich, and Tomaso Poggio. Theory of Deep Learning IIb: Optimization Properties of SGD. jan 2018a. URL http://arxiv.org/abs/1801.02254.
|
| 290 |
+
|
| 291 |
+
Tianyun Zhang, Shaokai Ye, Kaiqi Zhang, Jian Tang, Wujie Wen, Makan Fardad, and Yanzhi Wang. A Systematic DNN Weight Pruning Framework using Alternating Direction Method of Multipliers. apr 2018b. URL http://arxiv.org/abs/1804.03294.
|
| 292 |
+
|
| 293 |
+
Michael Zhu and Suyog Gupta. To prune, or not to prune: exploring the efficacy of pruning for model compression. 2017. URL http://arxiv.org/abs/1710.01878.
|
| 294 |
+
|
| 295 |
+
# APPENDIX A DETAILS OF IMPLEMENTATION
|
| 296 |
+
|
| 297 |
+
We implemented all models and reparameterization mechanisms using pytorch. Experiments were run on GPUs, and all sparse tensors were represented as dense tensors filtered by a binary mask 10. Source code to reproduce all experiments is available on GitHub:
|
| 298 |
+
|
| 299 |
+
Link suppressed for the sake of anonymity during review process.
|
| 300 |
+
|
| 301 |
+
Training Hyperparameter settings for training are listed in the first block of Table 4. Standard mild data augmentation was used in all experiments for CIFAR10 (random translation, cropping and horizontal flipping) and for Imagenet (random cropping and horizontal flipping).
|
| 302 |
+
|
| 303 |
+
Sparse compression baseline We compared our method against iterative pruning methods (Han et al., 2015; Zhu & Gupta, 2017). We start from a full dense model trained with hyperparameters provided in the first block of Table 4 and then gradually prune the network to a target sparsity in $T$ steps. As in Zhu & Gupta (2017), the pruning schedule we used was
|
| 304 |
+
|
| 305 |
+
$$
|
| 306 |
+
s ^ { ( t ) } = s + ( 1 - s ) \left( 1 - \frac { t } { T } \right) ^ { 3 } ,
|
| 307 |
+
$$
|
| 308 |
+
|
| 309 |
+
where $t = 0 , 1 , \cdots , T$ indexes pruning steps, and $s$ the target sparsity reached at the end of training. Thus, this baseline (labeled as compressed sparse in the paper) was effectively trained for more iterations (original training phase plus compression phase) than our dynamic sparse method, to the best of our knowledge a so far strongest baseline to benchmark our method.
|
| 310 |
+
|
| 311 |
+
Hyperparameter settings for sparse compression are listed in the second block of Table 4.
|
| 312 |
+
|
| 313 |
+
Dynamic reparameterization (ours) Hyperparameter settings for dynamic sparse reparameterization (Algorithm 1) are listed in the third block of Table 4.
|
| 314 |
+
|
| 315 |
+
Sparse Evolutionary Training (SET) Because the larger-scale experiments here (WRN-28-2 on CIFAR10 and Resnet-50 on Imagenet) were not attempted by Mocanu et al. (2018), no specific settings for reparameterization in these cases were available in the original paper. In order to make a fair comparison, we used the same hyperparameters as those used in our dynamic reparameterization scheme (third block in Table 4). At each reparameterization step, the weights in each layer were sorted by magnitude and the smallest fraction was pruned. An equal number of parameters were then randomly allocated in the same layer and initialized to zero. For control, the total number of reallocated weights at each step was chosen to be the same as our dynamic reparameterization method, as was the schedule for reparameterization.
|
| 316 |
+
|
| 317 |
+
Deep Rewiring (DeepR) The fourth block in Table 4 contain hyperparameters for the DeepR experiments. We refer the reader to Bellec et al. (2017) for details of the deep rewiring algorithm and for explanation of the hyperparameters.
|
| 318 |
+
|
| 319 |
+
Exceptions For reasons described below, we made a few minor exceptions in sparsification for certain model layers in our experiments.
|
| 320 |
+
|
| 321 |
+
• The sparsity of the last linear layer in LeNet-300-100 was allowed to be sparsified to at most $9 0 \%$ sparsity. In cases where global sparsity was over $9 0 \%$ , we redistribute free parameters from earlier layers to maintain the total parameter count. This is because, if the last layer was allowed to be overly sparse, performance sustained huge degradation unsuited for meaningful comparison. • The last linear layer of WRN-28-2 was always kept dense. It has a negligible fraction of parameter count.
|
| 322 |
+
|
| 323 |
+
Table 4: Hyperparameters for all experiments presented in the paper
|
| 324 |
+
|
| 325 |
+
<table><tr><td rowspan=1 colspan=1>Experiment</td><td rowspan=1 colspan=1>LeNet-300-100on MNIST</td><td rowspan=1 colspan=1>WRN-28-2on CIFAR10</td><td rowspan=1 colspan=1>Resnet-50 on Imagenet</td></tr><tr><td rowspan=1 colspan=4> Hyperparameters for training</td></tr><tr><td rowspan=1 colspan=1>Number of training epochs</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>200</td><td rowspan=1 colspan=1>100</td></tr><tr><td rowspan=1 colspan=1>Mini-batch size</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>Learning rate schedule(epoch range: learning rate)</td><td rowspan=1 colspan=1>1-25:0.10026-50:0.02051 - 75:0.04076 - 100:0.008</td><td rowspan=1 colspan=1>1-60:0.10061 - 120:0.020121 - 160:0.040161 -200:0.008</td><td rowspan=1 colspan=1>1-30: 0.100031 - 60: 0.010061 -90: 0.001091- 100: 0.0001</td></tr><tr><td rowspan=1 colspan=1>Momentum (Nesterov)</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>0.9</td></tr><tr><td rowspan=1 colspan=1>L1 regularization multiplier</td><td rowspan=1 colspan=1>0.0001|</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>0.0</td></tr><tr><td rowspan=1 colspan=1>L² regularization multiplier</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>0.0005</td><td rowspan=1 colspan=1>0.0001</td></tr><tr><td rowspan=1 colspan=4> Hyperparameters for sparse compression (compressed sparse) (Zhu & Gupta, 2017)</td></tr><tr><td rowspan=1 colspan=1>Number of pruning iterations (T)</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>20</td></tr><tr><td rowspan=1 colspan=1>Number of training epochsbetween pruning iterations</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=1 colspan=1> Number of training epochs post-pruning</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>Number of epochs during pruning</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td></tr><tr><td rowspan=1 colspan=1> Learning rate schedule during pruning(epoch range: learning rate)</td><td rowspan=1 colspan=1>1- 20: 0.0200|21-30:0.004031-40:0.0008</td><td rowspan=1 colspan=1>1- 25: 0.0200|25-35:0.004036-50:0.0008</td><td rowspan=1 colspan=1>1- 25: 0.010026 -35: 0.001036 -50: 0.0001</td></tr><tr><td rowspan=1 colspan=4>Hyperparameters for dynamic sparse reparameterization (dynamic sparse) (ours)</td></tr><tr><td rowspan=1 colspan=1>Number of parameters to prune (K)</td><td rowspan=1 colspan=1>600</td><td rowspan=1 colspan=1>20,000</td><td rowspan=1 colspan=1>200,000</td></tr><tr><td rowspan=1 colspan=1>Fractional tolerance of K (d)</td><td rowspan=1 colspan=1>0.1|</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.1</td></tr><tr><td rowspan=1 colspan=1>Initial pruning threshold (H())</td><td rowspan=1 colspan=1>0.001</td><td rowspan=1 colspan=1>0.001|</td><td rowspan=1 colspan=1>0.001</td></tr><tr><td rowspan=3 colspan=1>Reparameterization period (P) schedule(epoch range: P)</td><td rowspan=3 colspan=1>1-25: 10026-50: 20051-75: 40076 - 100: 800</td><td rowspan=1 colspan=1>1-25: 10026-80: 200</td><td rowspan=1 colspan=1>1-25: 100026-50: 2000</td></tr><tr><td rowspan=1 colspan=1>81 -140: 400</td><td rowspan=1 colspan=1>51-75: 4000</td></tr><tr><td rowspan=1 colspan=1>141 - 200: 800</td><td rowspan=1 colspan=1>76 - 100: 8000</td></tr><tr><td rowspan=1 colspan=4>Hyperparameters for Sparse Evolutionary Training (SET) (Mocanu et al., 2018)</td></tr><tr><td rowspan=1 colspan=1>Number of parameters to pruneat each re-parameterization step</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>20,000</td><td rowspan=1 colspan=1>200,000</td></tr><tr><td rowspan=1 colspan=1>Reparameterization period (P) schedule(epoch range: P)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1-25: 10026-80: 20081 -140: 400141 - 200: 800</td><td rowspan=1 colspan=1>1-25: 100026-50: 200051-75: 400076 - 100: 8000</td></tr><tr><td rowspan=1 colspan=4>Hyperparameters for Deep Rewiring (DeepR) (Bellec et al., 2017)</td></tr><tr><td rowspan=1 colspan=1>L1 regularization multiplier (α)</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>10-5</td><td rowspan=1 colspan=1>10-5</td></tr><tr><td rowspan=3 colspan=1>Temperature (T) schedule(epoch range: T)</td><td rowspan=3 colspan=1></td><td rowspan=2 colspan=1>1-25:10-526-80:10-8</td><td rowspan=1 colspan=1>1- 25:10-5</td></tr><tr><td rowspan=1 colspan=1>26-50:10-8</td></tr><tr><td rowspan=1 colspan=1>81 - 140:10-12141-200:10-15</td><td rowspan=1 colspan=1>51-75:10-1276-100:10-15</td></tr></table>
|
| 326 |
+
|
| 327 |
+
# APPENDIX B COMPARISON TO STATIC DENSE REPARAMETERIZATION METHODS
|
| 328 |
+
|
| 329 |
+
We also compared our dynamic sparse reparameterization method to a number of static dense reparameterization techniques, e.g. Denil et al. (2013); Yang et al. (2014); Moczulski et al. (2015); Sindhwani et al. (2015); Chen et al. (2015); Treister et al. (2018). Instead of sparsification, these methods impose structure on large parameter tensors by parameter sharing. Most of these methods have not been used for convolutional layers except for recent ones (Chen et al., 2015; Treister et al., 2018). We found that HashedNet (Chen et al., 2015) had the best performance over other static dense reparameterization methods, and also benchmarked our method against it. Instead of reparameterizing a parameter tensor with $N$ entries to a sparse one with $M < N$ non-zero components, HashedNet’s reparameterization is to put $M$ free parameters into $N$ positions in the parameter through a random mapping from $\{ 1 , \cdots , N \}$ to $\{ 1 , \cdots , M \}$ computed by cheap hashing, resulting in a dense parameter tensor with shared components.
|
| 330 |
+
|
| 331 |
+
Results of LeNet-300-100-10 on MNIST are presented in Figure 4a, those of WRN-28-2 on CIFAR10 in Figure 4b, and those of Resnet-50 on Imagenet in Table 5. For a certain global sparsity $s$ of our method, we compare it against a HashedNet with all reparameterized tensor hashed such that each had a fraction $1 - s$ of effective parameter count. We found that our method dynamic sparse significantly outperformed HashedNet.
|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Figure 4: Comparison to HashedNet. (a) Test accuracy for LeNet-300-100-10 trained on MNIST. (b) Test accuracy for WRN-28-2 trained on CIFAR10. Conventions same as in Figure 1a.
|
| 335 |
+
|
| 336 |
+
Table 5: Test accuracy $\%$ (top-1, top-5) of Resnet-50 on Imagenet for dynamic sparse vs. HashedNet
|
| 337 |
+
|
| 338 |
+
<table><tr><td>Final overall sparsity (# Parameters)</td><td>0.8 (7.3M)</td><td></td><td>0.9 (5.1M)</td></tr><tr><td>HashedNet</td><td>70.0 [-4.9]</td><td>89.6 [-2.8]</td><td>66.9 [-8.0] 87.4 [-5.0]</td></tr><tr><td>Dynamic sparse (ours)</td><td>73.3 [-1.6]</td><td>92.4 [0.0]</td><td>71.6 [-3.3] 90.5 [-1.9]</td></tr></table>
|
| 339 |
+
|
| 340 |
+
Numbers in square brackets are differences from the full dense baseline.
|
| 341 |
+
|
| 342 |
+
# APPENDIX C A TAXONOMY OF TRAINING METHODS THAT YIELD “SPARSE” DEEP CNNS
|
| 343 |
+
|
| 344 |
+
As an extension to Section 2 of the main text, here we elaborate on existing methods related to ours, how they compare with and contrast to each other, and what features, apart from effectiveness, distinguished our approach from all previous ones. We confine the scope of comparison to training methods that produce smaller versions (i.e. ones with fewer parameters) of a given modern (i.e. post-AlexNet) deep convolutional neural network model. We list representative methods in Table 6.
|
| 345 |
+
|
| 346 |
+
We classify these methods by three key features.
|
| 347 |
+
|
| 348 |
+
Strict parameter budget throughout training and inference This feature was discussed in depth in the main text. Most of the methods to date are compression techniques, i.e. they start training with a fully parameterized, dense model, and then reduce parameter counts. To the best of our knowledge, only three methods, namely DeepR (Bellec et al., 2017), SET (Mocanu et al., 2018) and ours, strictly impose, throughout the entire course of training, a fixed small parameter budget, one that is equal to the size of the final sparse model for inference. We make a distinction between these direct training methods (first block) and compression methods (second and third blocks of Table 6) 11.
|
| 349 |
+
|
| 350 |
+
Table 6: Representative examples of training methods that yield “sparse” deep CNNs
|
| 351 |
+
|
| 352 |
+
<table><tr><td>Method</td><td>Strict parameter budget throughout training and inference</td><td>Granularity of sparsity</td><td>Automatic layer sparsity</td></tr><tr><td>Dynamic Sparse Reparameterization (Ours)</td><td>yes</td><td>non-structured</td><td>yes</td></tr><tr><td>Sparse Evolutionary Training (SET) (Mocanu et al., 2018)</td><td>yes</td><td>non-structured</td><td>no</td></tr><tr><td>Deep Rewiring (DeepR) (Bellec et al., 2017)</td><td>yes</td><td>non-structured</td><td>no</td></tr><tr><td rowspan="2">NN Synthesis Tool (NeST) (Dai et al., 2017; 2018) tf.contrib.model_pruning (Zhu & Gupta,2017)</td><td>no</td><td>non-structured</td><td>yes</td></tr><tr><td>no</td><td>non-structured</td><td>no</td></tr><tr><td>RNN Pruning (Narang et al.,2017)</td><td>no</td><td>non-structured</td><td>no</td></tr><tr><td>Deep Compression (Han et al., 2015)</td><td>no</td><td>non-structured</td><td>no</td></tr><tr><td>Group-wise Brain Damage (Lebedev&Lempitsky,2015)</td><td>no</td><td>channel</td><td>no</td></tr><tr><td>L1-norm Channel Pruning (Li et al., 2016)</td><td>no</td><td>channel</td><td>no</td></tr><tr><td>Structured Sparsity Learning (SSL) (Wen et al., 2016)</td><td>no</td><td>channel/kernel/layer</td><td>yes</td></tr><tr><td>ThiNet (Luo et al., 2017)</td><td>no</td><td>channel</td><td>no</td></tr><tr><td>LASSO-regression Channel Pruning (He et al., 2017)</td><td>no</td><td>channel</td><td>no</td></tr><tr><td>Network Slimming (Liu et al., 2017)</td><td>no</td><td>channel</td><td>yes</td></tr><tr><td>Sparse Structure Selection (SSS) (Huang & Wang,2017)</td><td>no</td><td>layer</td><td>yes</td></tr><tr><td>Principal Filter Analysis (PFA) (Suau et al., 2018)</td><td>no</td><td>channel</td><td>yes/no</td></tr></table>
|
| 353 |
+
|
| 354 |
+
We provide examples of different categories of methods. This is not a complete list of methods.
|
| 355 |
+
|
| 356 |
+
This distinction is meaningful in two ways: (a) practically, direct training methods are more memoryefficient on appropriate computing substrate by requiring parameter storage of no more than the final compressed model size; (b) theoretically, these methods, if performing on par with or better than compression methods (as this work suggests), shed light on an important question: whether gross overparameterization is necessary for good generalization performance?
|
| 357 |
+
|
| 358 |
+
Granularity of sparsity The granularity of sparsity refers to the additional structure imposed on the placement of the non-zero entries of a sparsified parameter tensor. The finest-grained case, namely non-structured, allows each individual weight in a parameter tensor to be zero or non-zero independently. Early compression techniques, e.g. Han et al. (2015), and more recent pruning-based compression methods based thereon, e.g. Zhu & Gupta (2017), are non-structured (second block of Table 6). So are all direct training methods like ours (first block of Table 6).
|
| 359 |
+
|
| 360 |
+
Non-structured sparsity makes its computations difficult to accelerate on GPUs. To tackle this problem, a class of compression methods, called structured pruning (third block in Table 6), constrain “sparsity” to a much coarser granularity. Typically, pruning is performed to an entire convolution channel, e.g. ThiNet (Luo et al., 2017), even whole layers or residual blocks (Huang & Wang, 2017). This way, the compressed “sparse” model has essentially smaller and/or fewer dense parameter tensors, and computation can thus be accelerated on GPUs the same way as dense neural networks.
|
| 361 |
+
|
| 362 |
+
These structured compression methods, however, did not make a useful baseline in this work, for the following reasons. First, because they produce dense models, their relevance to our method (non-structured, non-compression) is far more remote than non-structured compression techniques yielding sparse models, for a meaningful comparison. Second, typical structured pruning methods substantially underperformed non-structured ones (see Table 2 for two examples, ThiNet and SSS), and emerging evidence has called into question the fundamental value of structured pruning: Mittal et al. (2018) found that the channel pruning criteria used in a number of state-of-the-art structured pruning methods performed no better than random channel elimination, and Liu et al. (2018) found that fine-tuning in a number of state-of-the-art pruning methods fared no better than direct training of a randomly initialized pruned model which, in the case of channel/layer pruning, is simply a less wide and/or less deep dense model (see Table 2 for comparison of ThiNet and SSS against thin dense).
|
| 363 |
+
|
| 364 |
+
In addition, we also performed extra experiments in which we constrained our method to perform “structured sparsification” and obtained significantly worse results, see Appendix D.
|
| 365 |
+
|
| 366 |
+
Predefined versus automatically discovered sparsity levels across layers The last key feature (rightmost column of Table 6) for our classification of methods is whether the sparsity levels of different layers of the network is automatically discovered during training or predefined by manual configuration. The value of automatic sparsification, e.g. ours, is twofold. First, it is conceptually more general because parameter reallocation heuristics can be applied to diverse model architectures, whereas layer-specific configuration has to be cognizant of network architecture, and at times also of the task to learn. Second, it is practically more scalable because it obviates manual configurations of layer-wise sparsity, agnostic of the depth and size of the network, keeping the overhead of hyperparameter tuning constant rather than scaling with model depth/size. In addition to efficiency, we also show in Appendix E extra experiments on how automatic parameter reallocation across layers contributed to its effectiveness.
|
| 367 |
+
|
| 368 |
+
In conclusion, to the best of our knowledge, our method is unique from all existing ones because it • strictly maintained a fixed parameter footprint throughout the entire course of training, and • automatically discovered layer-wise sparsity levels during training.
|
| 369 |
+
|
| 370 |
+
As discussed in Appendix C, we benchmarked our direct sparse training methods against the best performing non-structured pruning method (Zhu & Gupta, 2017) known to us. Compression by structured channel-wise pruning, on the other hand, is not better than even the thin dense baseline (Table 2), consistent with recent criticisms (Mittal et al., 2018; Liu et al., 2018).
|
| 371 |
+
|
| 372 |
+
We asked how our method would perform if it were constrained to training sparse models at a coarser granularity. To answer this question, we performed additional experiments for WRN-28-2 trained on CIFAR10 and Resnet-50 trained on Imagenet, as described in the following.
|
| 373 |
+
|
| 374 |
+
Consider a weight tensor of a convolution layer, of size $C _ { \mathrm { o u t } } \times C _ { \mathrm { i n } } \times 3 \times 3$ , where $C _ { \mathrm { o u t } }$ and $C _ { \mathrm { i n } }$ are the number of output and input channels, respectively. Our method performed dynamic sparse reparameterization by pruning and reallocating individual weights of the 4-dimensional parameter tensor–the finest granularity. To adapt our procedure to coarse-grain sparsity on groups of parameters, we modified our Algorithm 1 in the following ways:
|
| 375 |
+
|
| 376 |
+
1. the pruning step now removed entire groups of weights by comparing their $L ^ { 1 }$ -norms with the adaptive threshold;
|
| 377 |
+
2. the adaptive threshold was updated based on the difference between the target number and the actual number of groups to prune/grow at each step;
|
| 378 |
+
3. the growth step reallocated groups of weights within and across parameter tensors using the same heuristic (Equation 2).
|
| 379 |
+
|
| 380 |
+
We show results at kernel-level granularity (i.e. groups are $3 \times 3$ kernels) in Figure 5 and Table 7, for WRN-28-2 on CIFAR10 and Resnet-50 on Imagenet, respectively. We made two observations. First, enforcing kernel-level sparsity leads to significantly worse accuracy compared to unstructured sparsity. Second, at this coarser granularity, our method still outperformed the thin dense baseline model with the same number of parameters.
|
| 381 |
+
|
| 382 |
+

|
| 383 |
+
Figure 5: Test accuracy for WRN-28-2 trained on CIFAR10 for two variants of dynamic sparse, i.e. kernel-level granularity of sparsity and non-structured (same as dynamic sparse in the main text), as well as the thin dense baseline. Conventions same as in Figure 1a.
|
| 384 |
+
|
| 385 |
+
Table 7: Test accuracy $\%$ (top-1, top-5) of Resnet-50 on Imagenet for different levels of granularity of sparsity
|
| 386 |
+
|
| 387 |
+
<table><tr><td>Final overall sparsity (# Parameters)</td><td>0.8 (7.3M)</td><td>0.9 (5.1M)</td></tr><tr><td>Thin dense</td><td>71.6 [-3.3] 90.3 [-2.1]</td><td>69.4 [-5.5] 89.2 [-3.2]</td></tr><tr><td>Dynamic sparse (kernel granularity)</td><td>72.6 [-2.3] 91.0 [-1.4]</td><td>70.2 [-4.7] 89.8[-2.6]</td></tr><tr><td>Dynamic sparse (non-structured)</td><td>73.3 [-1.6] 92.4[ 0.0]</td><td>71.6 [-3.3] 90.5 [-1.9]</td></tr></table>
|
| 388 |
+
|
| 389 |
+
Numbers in square brackets are differences from the full dense baseline.
|
| 390 |
+
|
| 391 |
+
When we further coarsened the granularity of sparsity to channel level (i.e. groups are $C _ { \mathrm { i n } } \times 3 \times 3$ slices that generate output feature maps), our method utterly failed to produce performant models.
|
| 392 |
+
|
| 393 |
+
# APPENDIX E AUTOMATIC PARAMETER REALLOCATION ACROSS LAYERS ENABLES LEARNING AT EXTREME SPARSITY LEVELS
|
| 394 |
+
|
| 395 |
+
In order to assess whether and how much our parameter reallocation heuristic (Equation 2) contributed to the effectiveness of our method, we did a set of control experiments in which all free parameter reallocation were constrained to within parameter tensors, i.e. parameter reallocation across layers were disabled, and sparsity stayed constant (uniformly initialized) for each layer.
|
| 396 |
+
|
| 397 |
+
The results are presented in Figure 6 for LeNet-300-100-10 on MNIST. We found that removing inter-layer parameter allocation yielded worse performance, particularly at extremely high sparsity levels. This suggested that parameter reallocation across the entire model was beneficial to our dynamic reparameterization.
|
| 398 |
+
|
| 399 |
+

|
| 400 |
+
Figure 6: Test accuracy for LeNet-300-100-10 on MNIST of dynamic sparse (i.e. Algorithm 1) compared against constrained dynamic sparse for which parameter reallocation occurred only within, but not across, layers.
|
md/train/SJe5P6EYvS/SJe5P6EYvS.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MOGRIFIER LSTM
|
| 2 |
+
|
| 3 |
+
Gábor Melis†, Tomáš Kociskýˇ †, Phil Blunsom†‡
|
| 4 |
+
{melisgl,tkocisky,pblunsom}@google.com
|
| 5 |
+
†DeepMind, London, UK
|
| 6 |
+
‡University of Oxford
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
Many advances in Natural Language Processing have been based upon more expressive models for how inputs interact with the context in which they occur. Recurrent networks, which have enjoyed a modicum of success, still lack the generalization and systematicity ultimately required for modelling language. In this work, we propose an extension to the venerable Long Short-Term Memory in the form of mutual gating of the current input and the previous output. This mechanism affords the modelling of a richer space of interactions between inputs and their context. Equivalently, our model can be viewed as making the transition function given by the LSTM context-dependent. Experiments demonstrate markedly improved generalization on language modelling in the range of 3–4 perplexity points on Penn Treebank and Wikitext-2, and 0.01–0.05 bpc on four character-based datasets. We establish a new state of the art on all datasets with the exception of Enwik8, where we close a large gap between the LSTM and Transformer models.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
The domination of Natural Language Processing by neural models is hampered only by their limited ability to generalize and questionable sample complexity (Belinkov and Bisk 2017; Jia and Liang 2017; Iyyer et al. 2018; Moosavi and Strube 2017; Agrawal et al. 2016), their poor grasp of grammar (Linzen et al. 2016; Kuncoro et al. 2018), and their inability to chunk input sequences into meaningful units (Wang et al. 2017). While direct attacks on the latter are possible, in this paper, we take a language-agnostic approach to improving Recurrent Neural Networks (RNN, Rumelhart et al. (1988)), which brought about many advances in tasks such as language modelling, semantic parsing, machine translation, with no shortage of non-NLP applications either (Bakker 2002; Mayer et al. 2008). Many neural models are built from RNNs including the sequence-to-sequence family (Sutskever et al. 2014) and its attention-based branch (Bahdanau et al. 2014). Thus, innovations in RNN architecture tend to have a trickle-down effect from language modelling, where evaluation is often the easiest and data the most readily available, to many other tasks, a trend greatly strengthened by ULMFiT (Howard and Ruder 2018), ELMo (Peters et al. 2018) and BERT (Devlin et al. 2018), which promote language models from architectural blueprints to pretrained building blocks.
|
| 15 |
+
|
| 16 |
+
To improve the generalization ability of language models, we propose an extension to the LSTM (Hochreiter and Schmidhuber 1997), where the LSTM’s input $_ { \textbf { \em x } }$ is gated conditioned on the output of the previous step $h _ { p r e \nu }$ . Next, the gated input is used in a similar manner to gate the output of the previous time step. After a couple of rounds of this mutual gating, the last updated $_ { \textbf { \em x } }$ and $h _ { p r e \nu }$ are fed to an LSTM. By introducing these additional of gating operations, in one sense, our model joins the long list of recurrent architectures with gating structures of varying complexity which followed the invention of Elman Networks (Elman 1990). Examples include the LSTM, the GRU (Chung et al. 2015), and even designs by Neural Architecture Search (Zoph and Le 2016).
|
| 17 |
+
|
| 18 |
+
Intuitively, in the lowermost layer, the first gating step scales the input embedding (itself a representation of the average context in which the token occurs) depending on the actual context, resulting in a contextualized representation of the input. While intuitive, as Section 4 shows, this interpretation cannot account for all the observed phenomena.
|
| 19 |
+
|
| 20 |
+
In a more encompassing view, our model can be seen as enriching the mostly additive dynamics of recurrent transitions placing it in the company of the Input Switched Affine Network (Foerster et al.
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
Figure 1: Mogrifier with 5 rounds of updates. The previous state $\pmb { h } ^ { 0 } = \pmb { h } _ { p r e \nu }$ is transformed linearly (dashed arrows), fed through a sigmoid and gates ${ \pmb x } ^ { - 1 } = { \pmb x }$ in an elementwise manner producing $\mathbf { x } ^ { 1 }$ . Conversely, the linearly transformed $\mathbf { x } ^ { 1 }$ gates $ { \boldsymbol { h } } ^ { 0 }$ and produces $\boldsymbol { h } ^ { 2 }$ . After a number of repetitions of this mutual gating cycle, the last values of $\boldsymbol { h } ^ { * }$ and $\pmb { x } ^ { * }$ sequences are fed to an LSTM cell. The prev subscript of $^ { h }$ is omitted to reduce clutter.
|
| 24 |
+
|
| 25 |
+
2017) with a separate transition matrix for each possible input, and the Multiplicative RNN (Sutskever et al. 2011), which factorizes the three-way tensor of stacked transition matrices. Also following this line of research are the Multiplicative Integration LSTM (Wu et al. 2016) and – closest to our model in the literature – the Multiplicative LSTM (Krause et al. 2016). The results in Section 3.4 demonstrate the utility of our approach, which consistently improves on the LSTM and establishes a new state of the art on all but the largest dataset, Enwik8, where we match similarly sized transformer models.
|
| 26 |
+
|
| 27 |
+
# 2 MODEL
|
| 28 |
+
|
| 29 |
+
To allow for ease of subsequent extension, we present the standard LSTM update (Sak et al. 2014) with input and state of size $m$ and $n$ respectively as the following function:
|
| 30 |
+
|
| 31 |
+
$$
|
| 32 |
+
\begin{array} { r l } & { \mathrm { L S T M } \colon \mathbb { R } ^ { m } \times \mathbb { R } ^ { n } \times \mathbb { R } ^ { n } \to \mathbb { R } ^ { n } \times \mathbb { R } ^ { n } } \\ & { \quad \mathrm { L S T M } ( \pmb { x } , \pmb { c } _ { p r e \nu } , \pmb { h } _ { p r e \nu } ) = ( \pmb { c } , \pmb { h } ) . } \end{array}
|
| 33 |
+
$$
|
| 34 |
+
|
| 35 |
+
The updated state $^ c$ and the output $^ { h }$ are computed as follows:
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
\begin{array} { r l } & { f = \sigma \big ( \mathbf { W } ^ { f x } \mathbf { x } + \mathbf { W } ^ { f h } h _ { p r e \nu } + b ^ { f } \big ) } \\ & { i = \sigma \big ( \mathbf { W } ^ { i x } \mathbf { x } + \mathbf { W } ^ { i h } h _ { p r e \nu } + b ^ { i } \big ) } \\ & { j = \operatorname { t a n h } ( \mathbf { W } ^ { j x } \mathbf { x } + \mathbf { W } ^ { j h } h _ { p r e \nu } + b ^ { j } ) } \\ & { o = \sigma \big ( \mathbf { W } ^ { o x } \mathbf { x } + \mathbf { W } ^ { o h } h _ { p r e \nu } + b ^ { o } \big ) } \\ & { c = f \odot c _ { p r e \nu } + i \odot j } \\ & { h = o \odot \operatorname { t a n h } ( c ) , } \end{array}
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+
where $\sigma$ is the logistic sigmoid function, $\odot$ is the elementwise product, $\mathbf { W } ^ { * * }$ and $b ^ { * }$ are weight matrices and biases.
|
| 42 |
+
|
| 43 |
+
While the LSTM is typically presented as a solution to the vanishing gradients problem, its gate $i$ can also be interpreted as scaling the rows of weight matrices $\mathbf { W } ^ { j * }$ (ignoring the non-linearity in $j )$ . In this sense, the LSTM nudges Elman Networks towards context-dependent transitions and the extreme case of Input Switched Affine Networks. If we took another, larger step towards that extreme, we could end up with Hypernetworks (Ha et al. 2016). Here, instead, we take a more cautious step, and equip the LSTM with gates that scale the columns of all its weight matrices $\mathbf { W } ^ { * * }$ in a context-dependent manner. The scaling of the matrices $\mathbf { W } ^ { * x }$ (those that transform the cell input) makes the input embeddings dependent on the cell state, while the scaling of $\mathbf { W } ^ { * h }$ does the reverse.
|
| 44 |
+
|
| 45 |
+
The Mogrifier1 LSTM is an LSTM where two inputs $_ { \textbf { \em x } }$ and $h _ { p r e \nu }$ modulate one another in an alternating fashion before the usual LSTM computation takes place (see Fig. 1). That is, Mogrify $( { \bf { x } } , c _ { p r e \nu } , { \bf { h } } _ { p r e \nu } ) = \mathrm { L S T M } ( { \bf { x } } ^ { \uparrow } , c _ { p r e \nu } , { \bf { h } } _ { p r e \nu } ^ { \uparrow } )$ where the modulated inputs $\mathbf { \boldsymbol { x } } ^ { \uparrow }$ and $h _ { p r e \nu } ^ { \dagger }$ are defined as the highest indexed $\mathbf { \Delta } _ { \mathbf { \boldsymbol { x } } ^ { i } }$ and $h _ { p r e \nu } ^ { i }$ , respectively, from the interleaved sequences
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\begin{array} { r } { \pmb { x } ^ { i } = 2 \sigma ( \mathbf { Q } ^ { i } h _ { p r e \nu } ^ { i - 1 } ) \odot \pmb { x } ^ { i - 2 } , \qquad \mathrm { f o r ~ o d d ~ i \in [ 1 \dots { r } ] ~ } } \end{array}
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\begin{array} { r } { \pmb { h } _ { p r e \nu } ^ { i } = 2 \sigma ( \mathbf { R } ^ { i } \pmb { x } ^ { i - 1 } ) \odot \pmb { h } _ { p r e \nu } ^ { i - 2 } , \qquad \mathrm { f o r ~ e v e n ~ i \in ~ [ 1 \dots { r } ] ~ } } \end{array}
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
with ${ \pmb x } ^ { - 1 } = { \pmb x }$ and $h _ { p r e \nu } ^ { 0 } = h _ { p r e \nu }$ . The number of “rounds”, $r \in \mathbb N$ , is a hyperparameter; $r = 0$ recovers the LSTM. Multiplication with the constant 2 ensures that randomly initialized ${ \bf Q } ^ { i } , { \bf R } ^ { i }$ matrices result in transformations close to identity. To reduce the number of additional model parameters, we typically factorize the ${ \bf Q } ^ { i } , { \bf R } ^ { i }$ matrices as products of low-rank matrices: $\mathbf { Q } ^ { i } =$ $\mathbf { \dot { Q } } _ { \mathrm { l e f t } } ^ { i } \mathbf { Q } _ { \mathrm { r i g h t } } ^ { i }$ with $\dot { \mathbf { Q } } ^ { i } \in \mathbb { R } ^ { i n \times n }$ , $\mathbf { Q } _ { \mathrm { l e f t } } ^ { i } \in \mathbb { R } ^ { m \times k }$ , $\mathbf { Q } _ { \mathrm { r i g h t } } ^ { i } \in \mathbb { R } ^ { k \times n }$ , where $k < m i n ( m , n )$ is the rank.
|
| 56 |
+
|
| 57 |
+
# 3 EXPERIMENTS
|
| 58 |
+
|
| 59 |
+
# 3.1 THE CASE FOR SMALL-SCALE
|
| 60 |
+
|
| 61 |
+
Before describing the details of the data, the experimental setup and the results, we take a short detour to motivate work on smaller-scale datasets. A recurring theme in the history of sequence models is that the problem of model design is intermingled with optimizability and scalability. Elman Networks are notoriously difficult to optimize, a property that ultimately gave birth to the idea of the LSTM, but also to more recent models such as the Unitary Evolution RNN (Arjovsky et al. 2016) and fixes like gradient clipping (Pascanu et al. 2013). Still, it is far from clear – if we could optimize these models well – how different their biases would turn out to be. The non-separability of model and optimization is fairly evident in these cases.
|
| 62 |
+
|
| 63 |
+
Scalability, on the other hand, is often optimized for indirectly. Given the limited ability of current models to generalize, we often compensate by throwing more data at the problem. To fit a larger dataset, model size must be increased. Thus the best performing models are evaluated based on their scalability3. Today, scaling up still yields tangible gains on down-stream tasks, and language modelling data is abundant. However, we believe that simply scaling up will not solve the generalization problem and better models will be needed. Our hope is that by choosing small enough datasets, so that model size is no longer the limiting factor, we get a number of practical advantages:
|
| 64 |
+
|
| 65 |
+
$\star$ Generalization ability will be more clearly reflected in evaluations even without domain adaptation. $\star$ Turnaround time in experiments will be reduced, and the freed up computational budget can be put to good use by controlling for nuisance factors. $\star$ The transient effects of changing hardware performance characteristics are somewhat lessened.
|
| 66 |
+
|
| 67 |
+
Thus, we develop, analyse and evaluate models primarily on small datasets. Evaluation on larger datasets is included to learn more about the models’ scaling behaviour and because of its relevance for applications, but it is to be understood that these evaluations come with much larger error bars and provide more limited guidance for further research on better models.
|
| 68 |
+
|
| 69 |
+
# 3.2 DATASETS
|
| 70 |
+
|
| 71 |
+
We compare models on both word and character-level language modelling datasets. The two wordlevel datasets we picked are the Penn Treebank (PTB) corpus by Marcus et al. (1993) with preprocessing from Mikolov et al. (2010) and Wikitext-2 by Merity et al. (2016), which is about twice the size of PTB with a larger vocabulary and lighter preprocessing. These datasets are definitely on the small side, but – and because of this – they are suitable for exploring different model biases. Their main shortcoming is the small vocabulary size, only in the tens of thousands, which makes them inappropriate for exploring the behaviour of the long tail. For that, open vocabulary language modelling and byte pair encoding (Sennrich et al. 2015) would be an obvious choice. Still, our primary goal here is the comparison of the LSTM and Mogrifier architectures, thus we instead opt for character-based language modelling tasks, where vocabulary size is not an issue, the long tail is not truncated, and there are no additional hyperparameters as in byte pair encoding that make fair comparison harder. The first character-based corpus is Enwik8 from the Hutter Prize dataset (Hutter 2012). Following common practice, we use the first 90 million characters for training and the remaining 10 million evenly split between validation and test. The character-level task on the
|
| 72 |
+
|
| 73 |
+
Table 1: Word-level perplexities of near state-of-the-art models, our LSTM baseline and the Mogrifier on PTB and Wikitext-2. Models with Mixture of Softmaxes (Yang et al. 2017) are denoted with MoS, depth N with dN. MC stands for Monte-Carlo dropout evaluation. Previous state-of-the-art results in italics. Note the comfortable margin of 2.8–4.3 perplexity points the Mogrifier enjoys over the LSTM.
|
| 74 |
+
|
| 75 |
+
<table><tr><td rowspan="2" colspan="3"></td><td colspan="2">No Dyneval</td><td colspan="2">Dyneval</td></tr><tr><td>Val.</td><td>Test</td><td>Val.</td><td>Test</td></tr><tr><td rowspan="9">B</td><td>FRAGE (d3,MoS15) (Gong et al. 2018)</td><td>22M</td><td>54.1</td><td>52.4</td><td>47.4</td><td>46.5</td></tr><tr><td>AWD-LSTM (d3,MoS15) (Yang et al.2017)</td><td>22M</td><td>56.5</td><td>54.4</td><td>48.3</td><td>47.7</td></tr><tr><td>Transformer-XL (Dai et al. 2019)</td><td>24M</td><td>56.7</td><td>54.5</td><td></td><td></td></tr><tr><td>LSTM (d2)</td><td>24M</td><td>55.8</td><td>54.6</td><td>48.9</td><td>48.4</td></tr><tr><td>Mogrifier (d2)</td><td>24M</td><td>52.1</td><td>51.0</td><td>45.1</td><td>45.0</td></tr><tr><td>LSTM (d2, MC)</td><td>24M</td><td>55.5</td><td>54.1</td><td>48.6</td><td>48.4</td></tr><tr><td>Mogrifier (d2,C)</td><td>24M</td><td>51.4</td><td>50.1</td><td>44.9</td><td>44.8</td></tr><tr><td>FRAGE (d3,MoS15) (Gong et al. 2018)</td><td>35M</td><td>60.3</td><td>58.0</td><td>40.8</td><td>39.1</td></tr><tr><td>AWD-LSTM (d3,MoS15) (Yang et al.2017)</td><td>35M</td><td>63.9</td><td>61.2</td><td>42.4</td><td>40.7</td></tr><tr><td>B LSTM (d2,MoS2)</td><td>35M</td><td>62.6</td><td>60.1</td><td>43.2</td><td>41.5</td></tr><tr><td>Mogrifier (d2,MoS2)</td><td>35M</td><td>58.7</td><td>56.6</td><td>40.6</td><td>39.0</td></tr><tr><td>LSTM (d2, MoS2, MC)</td><td>35M</td><td>61.9</td><td>59.4</td><td>43.2</td><td>41.4</td></tr><tr><td>Mogrifier (d2,MoS2,MC)</td><td>35M</td><td>57.3</td><td>55.1</td><td>40.2</td><td>38.6</td></tr></table>
|
| 76 |
+
|
| 77 |
+
Mikolov preprocessed PTB corpus (Merity et al. 2018) is unique in that it has the disadvantages of closed vocabulary without the advantages of word-level modelling, but we include it for comparison to previous work. The final character-level dataset is the Multilingual Wikipedia Corpus (MWC, Kawakami et al. (2017)), from which we focus on the English and Finnish language subdatasets in the single text, large setting.
|
| 78 |
+
|
| 79 |
+
# 3.3 SETUP
|
| 80 |
+
|
| 81 |
+
We tune hyperparameters following the experimental setup of Melis et al. (2018) using a black-box hyperparameter tuner based on batched Gaussian Process Bandits (Golovin et al. 2017). For the LSTM, the tuned hyperparameters are the same: input_embedding_ratio, learning_rate, l2_penalty, input_dropout, inter_layer_dropout, state_dropout, output_dropout. For the Mogrifier, the number of rounds $r$ and the rank $k$ of the low-rank approximation is also tuned (allowing for full rank, too). For word-level tasks, BPTT (Werbos et al. 1990) window size is set to 70 and batch size to 64. For character-level tasks, BPTT window size is set to 150 and batch size to 128 except for Enwik8 where the window size is 500. Input and output embeddings are tied for word-level tasks following Inan et al. (2016) and Press and Wolf (2016). Optimization is performed with Adam (Kingma and Ba 2014) with $\beta _ { 1 } = 0$ , a setting that resembles RMSProp without momentum. Gradients are clipped (Pascanu et al. 2013) to norm 10. We switch to averaging weights similarly to Merity et al. (2017) after a certain number of checkpoints with no improvement in validation cross-entropy or at $80 \%$ of the training time at the latest. We found no benefit to using two-step finetuning.
|
| 82 |
+
|
| 83 |
+
Model evaluation is performed with the standard, deterministic dropout approximation or MonteCarlo averaging (Gal and Ghahramani 2016) where explicitly noted (MC). In standard dropout evaluation, dropout is turned off while in MC dropout predictions are averaged over randomly sampled dropout masks (200 in our experiments). Optimal softmax temperature is determined on the validation set, and in the MC case dropout rates are scaled (Melis et al. 2018). Finally, we report results with and without dynamic evaluation (Krause et al. 2017). Hyperparameters for dynamic evaluation are tuned using the same method (see Appendix A for details).
|
| 84 |
+
|
| 85 |
+
We make the code and the tuner output available at https://github.com/deepmind/lamb.
|
| 86 |
+
|
| 87 |
+
# 3.4 RESULTS
|
| 88 |
+
|
| 89 |
+
Table 1 lists our results on word-level datasets. On the PTB and Wikitext-2 datasets, the Mogrifier has lower perplexity than the LSTM by 3–4 perplexity points regardless of whether or not dynamic evaluation (Krause et al. 2017) and Monte-Carlo averaging are used. On both datasets, the state of the art is held by the AWD LSTM (Merity et al. 2017) extended with Mixture of Softmaxes (Yang et al. 2017) and FRAGE (Gong et al. 2018). The Mogrifier improves the state of the art without either of these methods on PTB, and without FRAGE on Wikitext-2.
|
| 90 |
+
|
| 91 |
+
Table 2: Bits per character on character-based datasets of near state-of-the-art models, our LSTM baseline and the Mogrifier. Previous state-of-the-art results in italics. Depth N is denoted with dN. MC stands for Monte-Carlo dropout evaluation. Once again the Mogrifier strictly dominates the LSTM and sets a new state of the art on all but the Enwik8 dataset where with dynamic evaluation it closes the gap to the Transformer-XL of similar size $^ { \dagger }$ Krause et al. (2019), $^ \ddag$ Ben Krause, personal communications, May 17, 2019). On most datasets, model size was set large enough for underfitting not to be an issue. This was very much not the case with Enwik8, so we grouped models of similar sizes together for ease of comparison. Unfortunately, a couple of dynamic evaluation test runs diverged (NaN) on the test set and some were just too expensive to run (Enwik8, MC).
|
| 92 |
+
|
| 93 |
+
<table><tr><td rowspan="2" colspan="2"></td><td rowspan="2"></td><td colspan="2">No Dyneval</td><td colspan="2">Dyneval</td></tr><tr><td>Val.</td><td>Test</td><td>Val.</td><td>Test</td></tr><tr><td rowspan="7">B 图</td><td>Trellis Networks (Bai et al.2018)</td><td>13.4M</td><td></td><td>1.159</td><td></td><td></td></tr><tr><td>AWD-LSTM (d3) (Merity et al.2017)</td><td>13.8M</td><td></td><td>1.175</td><td></td><td></td></tr><tr><td>LSTM (d2)</td><td>24M</td><td>1.163</td><td>1.143</td><td>1.116</td><td>1.103</td></tr><tr><td>Mogrifier (d2)</td><td>24M</td><td>1.149</td><td>1.131</td><td>1.098</td><td>1.088</td></tr><tr><td>LSTM (d2, MC)</td><td>24M</td><td>1.159</td><td>1.139</td><td>1.115</td><td>1.101</td></tr><tr><td>Mogrifier (d2, MC)</td><td>24M</td><td>1.137</td><td>1.120</td><td>1.094</td><td>1.083</td></tr><tr><td>HCLM with Cache (Kawakami et al. 2017)</td><td>8M</td><td>1.591</td><td>1.538</td><td></td><td></td></tr><tr><td rowspan="5">WMW 图</td><td>LSTM (d1) (Kawakami et al.2017)</td><td>8M</td><td>1.793</td><td>1.736</td><td></td><td></td></tr><tr><td>LSTM (d2)</td><td>24M</td><td>1.353</td><td>1.338</td><td>1.239</td><td>1.225</td></tr><tr><td>Mogrifier (d2)</td><td>24M</td><td>1.319</td><td>1.305</td><td>1.202</td><td>1.188</td></tr><tr><td>LSTM (d2, MC)</td><td>24M</td><td>1.346</td><td>1.332</td><td>1.238</td><td>NaN</td></tr><tr><td>Mogrifier (d2, MC)</td><td>24M</td><td>1.312</td><td>1.298</td><td>1.200</td><td>1.187</td></tr><tr><td rowspan="6">JMN H</td><td>HCLM with Cache (Kawakami et al. 2017)</td><td>8M</td><td>1.754</td><td>1.711</td><td></td><td></td></tr><tr><td>LSTM (d1) (Kawakami et al. 2017)</td><td>8M</td><td>1.943</td><td>1.913</td><td></td><td></td></tr><tr><td>LSTM (d2)</td><td>24M</td><td>1.382</td><td>1.367</td><td>1.249</td><td>1.237</td></tr><tr><td>Mogrifier (d2)</td><td>24M</td><td>1.338</td><td>1.326</td><td>1.202</td><td>1.191</td></tr><tr><td>LSTM (d2, MC)</td><td>24M</td><td>1.377</td><td>1.361</td><td>1.247</td><td>1.234</td></tr><tr><td>Mogrifier (d2, MC)</td><td>24M</td><td>1.327</td><td>1.313</td><td>1.198</td><td>NaN</td></tr><tr><td rowspan="19">grirg 图</td><td>Transformer-XL (d24) (Dai et al.2019)</td><td>277M</td><td></td><td>0.993</td><td></td><td>0.940t</td></tr><tr><td>Transformer-XL (d18) (Dai et al.2019)</td><td>88M</td><td></td><td>1.03</td><td></td><td></td></tr><tr><td>LSTM (d4)</td><td>96M</td><td>1.145</td><td>1.155</td><td>1.041</td><td>1.020</td></tr><tr><td>Mogrifier (d4)</td><td>96M</td><td>1.110</td><td>1.122</td><td>1.009</td><td>0.988</td></tr><tr><td>LSTM (d4,MC)</td><td>96M</td><td>1.139</td><td>1.147</td><td></td><td></td></tr><tr><td>Mogrifier (d4, MC)</td><td>96M</td><td>1.104</td><td>1.116</td><td></td><td></td></tr><tr><td>Transformer-XL (d12) (Dai et al.2019)</td><td>41M</td><td></td><td>1.06</td><td></td><td>1.01t</td></tr><tr><td>AWD-LSTM (d3) (Merity et al.2017)</td><td>47M</td><td></td><td>1.232</td><td></td><td></td></tr><tr><td>mLSTM (d1) (Krause et al. 2016)</td><td>46M</td><td></td><td>1.24</td><td></td><td>1.08</td></tr><tr><td>LSTM (d4)</td><td>48M</td><td>1.182</td><td>1.195</td><td>1.073</td><td>1.051</td></tr><tr><td>Mogrifier (d4)</td><td>48M</td><td>1.135</td><td>1.146</td><td>1.035</td><td>1.012</td></tr><tr><td>LSTM (d4, MC)</td><td>48M</td><td>1.176</td><td>1.188</td><td></td><td></td></tr><tr><td>Mogrifier (d4,MC)</td><td>48M</td><td>1.130</td><td>1.140</td><td></td><td></td></tr></table>
|
| 94 |
+
|
| 95 |
+
Table 2 lists the character-level modelling results. On all datasets, our baseline LSTM results are much better than those previously reported for LSTMs, highlighting the issue of scalability and experimental controls. In some cases, these unexpectedly large gaps may be down to lack of hyperparameter tuning as in the case of Merity et al. (2017), or in others, to using a BPTT window size (50) that is too small for character-level modelling (Melis et al. 2017) in order to fit the model into memory. The Mogrifier further improves on these baselines by a considerable margin. Even the smallest improvement of 0.012 bpc on the highly idiosyncratic, character-based, Mikolov preprocessed PTB task is equivalent to gaining about 3 perplexity points on word-level PTB. MWC, which was built for open-vocabulary language modelling, is a much better smaller-scale character-level dataset. On the English and the Finnish corpora in MWC, the Mogrifier enjoys a gap of 0.033-0.046 bpc. Finally, on the Enwik8 dataset, the gap is 0.029-0.039 bpc in favour of the Mogrifier.
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
Figure 2: “No-zigzag” Mogrifier for the ablation study. Gating is always based on the original inputs.
|
| 99 |
+
|
| 100 |
+
Table 3: PTB ablation study validation perplexities with 24M parameters.
|
| 101 |
+
|
| 102 |
+
<table><tr><td>Mogrifier Full rank Qi, Pi</td><td>54.1 54.6</td></tr><tr><td>No zigzag LSTM</td><td>55.0</td></tr><tr><td>mLSTM</td><td>57.5 57.8</td></tr></table>
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 3: Perplexity vs the rounds $r$ in the PTB ablation study.
|
| 106 |
+
|
| 107 |
+
Of particular note is the comparison to Transformer-XL (Dai et al. 2019), a state-of-the-art model on larger datasets such as Wikitext-103 and Enwik8. On PTB, without dynamic evaluation, the Transformer-XL is on par with our LSTM baseline which puts it about 3.5 perplexity points behind the Mogrifier. On Enwik8, also without dynamic evaluation, the Transformer-XL has a large, 0.09 bpc advantage at similar parameter budgets, but with dynamic evaluation this gap disappears. However, we did not test the Transformer-XL ourselves, so fair comparison is not possible due to differing experimental setups and the rather sparse result matrix for the Transformer-XL.
|
| 108 |
+
|
| 109 |
+
# 4 ANALYSIS
|
| 110 |
+
|
| 111 |
+
# 4.1 ABLATION STUDY
|
| 112 |
+
|
| 113 |
+
The Mogrifier consistently outperformed the LSTM in our experiments. The optimal settings were similar across all datasets, with $r \in \{ 5 , 6 \}$ and $k \in [ 4 0 \dots 9 0 ]$ (see Appendix B for a discussion of hyperparameter sensitivity). In this section, we explore the effect of these hyperparameters and show that the proposed model is not unnecessarily complicated. To save computation, we tune all models using a shortened schedule with only 145 epochs instead of 964 and a truncated BPTT window size of 35 on the word-level PTB dataset, and evaluate using the standard, deterministic dropout approximation with a tuned softmax temperature.
|
| 114 |
+
|
| 115 |
+
Fig. 3 shows that the number of rounds $r$ greatly influences the results. Second, we found the low-rank factorization of $\mathbf { Q } ^ { i }$ and $\mathbf { R } ^ { i }$ to help a bit, but the full-rank variant is close behind which is what we observed on other datasets, as well. Finally, to verify that the alternating gating scheme is not overly complicated, we condition all newly introduced gates on the original inputs $_ { \textbf { \em x } }$ and $h _ { p r e \nu }$ (see Fig. 2). That is, instead of Eq. 1 and Eq. 2 the no-zigzag updates are
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\begin{array} { r } { \begin{array} { r l } & { \qquad \mathbf { \Delta } x ^ { i } = 2 \sigma ( \mathbf { Q } ^ { i } h _ { p r e \nu } ) \odot \mathbf { \Delta } x ^ { i - 2 } \qquad } & { \mathrm { ~ f o r ~ o d d ~ i \in [ 1 \dots { } } , } \\ { h _ { p r e \nu } ^ { i } = 2 \sigma ( \mathbf { R } ^ { i } x ) \odot h _ { p r e \nu } ^ { i - 2 } \qquad } & { \mathrm { ~ f o r ~ e v e n ~ i \in [ 1 \dots { } } . . . r ] . } \end{array} } \end{array}
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
In our experiments, the no-zigzag variant underperformed the baseline Mogrifier by a small but significant margin, and was on par with the $r = 2$ model in Fig. 3 suggesting that the Mogrifier’s iterative refinement scheme does more than simply widen the range of possible gating values of $_ { \textbf { \em x } }$ and $h _ { p r e \nu }$ to $( 0 , 2 ^ { \lceil r / 2 \rceil } )$ and $( 0 , 2 ^ { \lfloor r / 2 \rfloor } )$ , respectively.
|
| 122 |
+
|
| 123 |
+
# 4.2 COMPARISON TO THE MLSTM
|
| 124 |
+
|
| 125 |
+
The Multiplicative LSTM (Krause et al. 2016), or mLSTM for short, is closest to our model in the literature. It is defined as $\mathrm { m L S T M } ( { \pmb x } , { \pmb c } _ { p r e \nu } , { \pmb h } _ { p r e \nu } ) = \mathrm { L S T M } ( { \pmb x } , { \pmb c } _ { p r e \nu } , { \pmb h } _ { p r e \nu } ^ { m } )$ , where $h _ { p r e \nu } ^ { m } =$ $( \mathbf { W } ^ { m x } \pmb { x } ) \odot ( \mathbf { W } ^ { m h } h _ { p r e \nu } )$ . In this formulation, the differences are readily apparent. First, the mLSTM allows for multiplicative interaction between $_ { \textbf { \em x } }$ and $h _ { p r e \nu }$ , but it only overrides $h _ { p r e \nu }$ , while in the Mogrifier the interaction is two-way, which – as the ablation study showed – is important. Second, the mLSTM can change not only the magnitude but also the sign of values in $h _ { p r e \nu }$ , something with which we experimented in the Mogrifier, but could not get to work. Furthermore, in the definition of $\boldsymbol { h } _ { p r e \nu } ^ { m }$ , the unsquashed linearities and their elementwise product make the mLSTM more sensitive to initialization and unstable during optimization.
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 4: Cross-entropy vs sequence length in the reverse copy task with i.i.d. tokens. Lower is better. The Mogrifier is better than the LSTM even in this synthetic task with no resemblance to natural language.
|
| 129 |
+
|
| 130 |
+
On the Enwik8 dataset, we greatly improved on the published results of the mLSTM (Krause et al. 2016). In fact, even our LSTM baseline outperformed the mLSTM by 0.03 bpc. We also conducted experiments on PTB based on our reimplementation of the mLSTM following the same methodology as the ablation study and found that the mLSTM did not improve on the LSTM (see Table 3).
|
| 131 |
+
|
| 132 |
+
Krause et al. (2016) posit and verify the recovery hypothesis which says that having just suffered a large loss, the loss on the next time step will be smaller on average for the mLSTM than for the LSTM. This was found not to be the case for the Mogrifier. Neither did we observe a significant change in the gap between the LSTM and the Mogrifier in the tied and untied embeddings settings, which would be expected if recovery was affected by $_ { \textbf { \em x } }$ and $h _ { p r e \nu }$ being in different domains.
|
| 133 |
+
|
| 134 |
+
# 4.3 THE REVERSE COPY TASK
|
| 135 |
+
|
| 136 |
+
Our original motivation for the Mogrifier was to allow the context to amplify salient and attenuate nuisance features in the input embeddings. We conduct a simple experiment to support this point of view. Consider the reverse copy task where the network reads an input sequence of tokens and a marker token after which it has to repeat the input in reverse order. In this simple sequence-tosequence learning (Sutskever et al. 2014) setup, the reversal is intended to avoid the minimal time lag problem (Hochreiter and Schmidhuber 1997), which is not our focus here.
|
| 137 |
+
|
| 138 |
+
The experimental setup is as follows. For the training set, we generate 500 000 examples by uniformly sampling a given number of tokens from a vocabulary of size 1000. The validation and test sets are constructed similarly, and contain 10 000 examples. The model consists of an independent, unidirectional encoder and a decoder, whose total number of parameters is 10 million. The decoder is initialized from the last state of the encoder. Since overfitting is not an issue here, no dropout is necessary, and we only tune the learning rate, the l2 penalty, and the embedding size for the LSTM. For the Mogrifier, the number of rounds $r$ and the rank $k$ of the low-rank approximation are also tuned.
|
| 139 |
+
|
| 140 |
+
We compare the case where both the encoder and decoder are LSTMs to where both are Mogrifiers. Fig. 4a shows that, for sequences of length 50 and 100, both models can solve the task perfectly. At higher lengths though, the Mogrifier has a considerable advantage. Examining the best hyperparameter settings found, the embedding/hidden sizes for the LSTM and Mogrifier are 498/787 vs 41/1054 at 150 steps, and 493/790 vs 181/961 at 200 steps. Clearly, the Mogrifier was able to work with a much smaller embedding size than the LSTM, which is in line with our expectations for a model with a more flexible interaction between the input and recurrent state. We also conducted experiments with a larger model and vocabulary size, and found the effect even more pronounced (see Fig. 4b).
|
| 141 |
+
|
| 142 |
+
# 4.4 WHAT THE MOGRIFIER IS NOT
|
| 143 |
+
|
| 144 |
+
The results on the reverse copy task support our hypothesis that input embeddings are enriched by the Mogrifier architecture, but that cannot be the full explanation as the results of the ablation study indicate. In the following, we consider a number of hypotheses about where the advantage of the Mogrifier lies and the experiments that provide evidence against them.
|
| 145 |
+
|
| 146 |
+
E Hypothesis: the benefit is in scaling $_ { \textbf { \em x } }$ and $h _ { p r e \nu }$ . We verified that data dependency is a crucial feature by adding a learnable scaling factor to the LSTM inputs. We observed no improvement. Also, at extremely low-rank (less than 5) settings where the amount of information in its gating is small, the Mogrifier loses its advantage.
|
| 147 |
+
E Hypothesis: the benefit is in making optimization easier. We performed experiments with different optimizers (SGD, RMSProp), with intra-layer batch normalization and layer normalization on the LSTM gates. While we cannot rule out an effect on optimization difficulty, in all of these experiments the gap between the LSTM and the Mogrifier was the same.
|
| 148 |
+
E Hypothesis: exact tying of embeddings is too constraining, the benefit is in making this relationship less strict. Experiments conducted with untied embeddings and character-based models demonstrate improvements of similar magnitude.
|
| 149 |
+
E Hypothesis: the benefit is in the low-rank factorization of ${ \bf Q } ^ { i } , { \bf R } ^ { i }$ implicitly imposing structure on the LSTM weight matrices. We observed that the full-rank Mogrifier also performed better than the plain LSTM. We conducted additional experiments where the LSTM’s gate matrices were factorized and observed no improvement.
|
| 150 |
+
E Hypothesis: the benefit comes from better performance on rare words. The observed advantage on character-based modelling is harder to explain based on frequency. Also, in the reverse copy experiments, a large number of tokens were sampled uniformly, so there were no rare words at all.
|
| 151 |
+
E Hypothesis: the benefit is specific to the English language. This is directly contradicted by the Finnish MWC and the reverse copy experiments.
|
| 152 |
+
E Hypothesis: the benefit is in handling long-range dependencies better. Experiments in the episodic setting (i.e. sentence-level language modelling) exhibited the same gap as the non-episodic ones.
|
| 153 |
+
E Hypothesis: the scaling up of inputs saturates the downstream LSTM gates. The idea here is that saturated gates may make states more stable over time. We observed the opposite: the means of the standard LSTM gates in the Mogrifier were very close between the two models, but their variance was smaller in the Mogrifier.
|
| 154 |
+
|
| 155 |
+
# 5 CONCLUSIONS AND FUTURE WORK
|
| 156 |
+
|
| 157 |
+
We presented the Mogrifier LSTM, an extension to the LSTM, with state-of-the-art results on several language modelling tasks. Our original motivation for this work was that the context-free representation of input tokens may be a bottleneck in language models and by conditioning the input embedding on the recurrent state some benefit was indeed derived. While it may be part of the explanation, this interpretation clearly does not account for the improvements brought by conditioning the recurrent state on the input and especially the applicability to character-level datasets. Positioning our work on the Multiplicative RNN line of research offers a more compelling perspective.
|
| 158 |
+
|
| 159 |
+
To give more credence to this interpretation, in the analysis we highlighted a number of possible alternative explanations, and ruled them all out to varying degrees. In particular, the connection to the mLSTM is weaker than expected as the Mogrifier does not exhibit improved recovery (see Section 4.2), and on PTB the mLSTM works only as well as the LSTM. At the same time, the evidence against easier optimization is weak, and the Mogrifier establishing some kind of sharing between otherwise independent LSTM weight matrices is a distinct possibility.
|
| 160 |
+
|
| 161 |
+
Finally, note that as shown by Fig. 1 and Eq. 1-2, the Mogrifier is a series of preprocessing steps composed with the LSTM function, but other architectures, such as Mogrifier GRU or Mogrifier Elman Network are possible. We also leave investigations into other forms of parameterization of context-dependent transitions for future work.
|
| 162 |
+
|
| 163 |
+
# ACKNOWLEDGMENTS
|
| 164 |
+
|
| 165 |
+
We would like to thank Ben Krause for the Transformer-XL dynamic evaluation results, Laura Rimell, Aida Nematzadeh, Angeliki Lazaridou, Karl Moritz Hermann, Daniel Fried for helping with experiments, Chris Dyer, Sebastian Ruder and Jack Rae for their valuable feedback.
|
| 166 |
+
|
| 167 |
+
# REFERENCES
|
| 168 |
+
|
| 169 |
+
Aishwarya Agrawal, Dhruv Batra, and Devi Parikh. Analyzing the behavior of visual question answering models. arXiv preprint arXiv:1606.07356, 2016.
|
| 170 |
+
|
| 171 |
+
Martin Arjovsky, Amar Shah, and Yoshua Bengio. Unitary evolution recurrent neural networks. In International Conference on Machine Learning, pages 1120–1128, 2016.
|
| 172 |
+
|
| 173 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
|
| 174 |
+
|
| 175 |
+
Shaojie Bai, J Zico Kolter, and Vladlen Koltun. Trellis networks for sequence modeling. arXiv preprint arXiv:1810.06682, 2018.
|
| 176 |
+
|
| 177 |
+
Bram Bakker. Reinforcement learning with long short-term memory. In Advances in neural information processing systems, pages 1475–1482, 2002.
|
| 178 |
+
|
| 179 |
+
Yonatan Belinkov and Yonatan Bisk. Synthetic and natural noise both break neural machine translation. arXiv preprint arXiv:1711.02173, 2017.
|
| 180 |
+
|
| 181 |
+
Junyoung Chung, Caglar Gulcehre, Kyunghyun Cho, and Yoshua Bengio. Gated feedback recurrent neural networks. In International Conference on Machine Learning, pages 2067–2075, 2015.
|
| 182 |
+
|
| 183 |
+
Zihang Dai, Zhilin Yang, Yiming Yang, William W Cohen, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019.
|
| 184 |
+
|
| 185 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 186 |
+
|
| 187 |
+
Jeffrey L Elman. Finding structure in time. Cognitive science, 14(2):179–211, 1990.
|
| 188 |
+
|
| 189 |
+
Jakob N Foerster, Justin Gilmer, Jascha Sohl-Dickstein, Jan Chorowski, and David Sussillo. Input switched affine networks: An rnn architecture designed for interpretability. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 1136–1145. JMLR. org, 2017.
|
| 190 |
+
|
| 191 |
+
Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In Advances in Neural Information Processing Systems, pages 1019–1027, 2016.
|
| 192 |
+
|
| 193 |
+
Daniel Golovin, Benjamin Solnik, Subhodeep Moitra, Greg Kochanski, John Karro, and D Sculley. Google vizier: A service for black-box optimization. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 1487–1495. ACM, 2017.
|
| 194 |
+
|
| 195 |
+
Chengyue Gong, Di He, Xu Tan, Tao Qin, Liwei Wang, and Tie-Yan Liu. Frage: frequency-agnostic word representation. In Advances in Neural Information Processing Systems, pages 1334–1345, 2018.
|
| 196 |
+
|
| 197 |
+
David Ha, Andrew Dai, and Quoc V Le. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016.
|
| 198 |
+
|
| 199 |
+
Sepp Hochreiter and Jürgen Schmidhuber. Lstm can solve hard long time lag problems. In Advances in neural information processing systems, pages 473–479, 1997.
|
| 200 |
+
|
| 201 |
+
Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. arXiv preprint arXiv:1801.06146, 2018.
|
| 202 |
+
|
| 203 |
+
Marcus Hutter. The human knowledge compression contest. URL http://prize. hutter1. net, 6, 2012.
|
| 204 |
+
|
| 205 |
+
Hakan Inan, Khashayar Khosravi, and Richard Socher. Tying word vectors and word classifiers: A loss framework for language modeling. CoRR, abs/1611.01462, 2016. URL http://arxiv.org/abs/1611.01462.
|
| 206 |
+
|
| 207 |
+
Mohit Iyyer, John Wieting, Kevin Gimpel, and Luke Zettlemoyer. Adversarial example generation with syntactically controlled paraphrase networks. arXiv preprint arXiv:1804.06059, 2018.
|
| 208 |
+
|
| 209 |
+
Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. arXiv preprint arXiv:1707.07328, 2017.
|
| 210 |
+
Kazuya Kawakami, Chris Dyer, and Phil Blunsom. Learning to create and reuse words in open-vocabulary neural language modeling. arXiv preprint arXiv:1704.06986, 2017.
|
| 211 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 212 |
+
Ben Krause, Liang Lu, Iain Murray, and Steve Renals. Multiplicative LSTM for sequence modelling. CoRR, abs/1609.07959, 2016. URL http://arxiv.org/abs/1609.07959.
|
| 213 |
+
Ben Krause, Emmanuel Kahembwe, Iain Murray, and Steve Renals. Dynamic evaluation of neural sequence models. arXiv preprint arXiv:1709.07432, 2017.
|
| 214 |
+
Ben Krause, Emmanuel Kahembwe, Iain Murray, and Steve Renals. Dynamic evaluation of transformer language models. arXiv preprint arXiv:1904.08378, 2019.
|
| 215 |
+
Adhiguna Kuncoro, Chris Dyer, John Hale, Dani Yogatama, Stephen Clark, and Phil Blunsom. Lstms can learn syntax-sensitive dependencies well, but modeling structure makes them better. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1426–1436, 2018.
|
| 216 |
+
Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. Assessing the ability of lstms to learn syntax-sensitive dependencies. Transactions of the Association for Computational Linguistics, 4:521–535, 2016.
|
| 217 |
+
Mitchell P Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The Penn treebank. Computational linguistics, 19(2):313–330, 1993.
|
| 218 |
+
Hermann Mayer, Faustino Gomez, Daan Wierstra, Istvan Nagy, Alois Knoll, and Jürgen Schmidhuber. A system for robotic heart surgery that learns to tie knots using recurrent neural networks. Advanced Robotics, 22 (13-14):1521–1537, 2008.
|
| 219 |
+
Gábor Melis, Chris Dyer, and Phil Blunsom. On the state of the art of evaluation in neural language models. arXiv preprint arXiv:1707.05589, 2017.
|
| 220 |
+
Gábor Melis, Charles Blundell, Tomáš Kocisk ˇ y, Karl Moritz Hermann, Chris Dyer, and Phil Blunsom. Pushing \` the bounds of dropout. arXiv preprint arXiv:1805.09208, 2018.
|
| 221 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. CoRR, abs/1609.07843, 2016. URL http://arxiv.org/abs/1609.07843.
|
| 222 |
+
Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and optimizing lstm language models. arXiv preprint arXiv:1708.02182, 2017.
|
| 223 |
+
Stephen Merity, Nitish Shirish Keskar, and Richard Socher. An analysis of neural language modeling at multiple scales. arXiv preprint arXiv:1803.08240, 2018.
|
| 224 |
+
Tomas Mikolov, Martin Karafiát, Lukas Burget, Jan Cernocky, and Sanjeev Khudanpur. Recurrent neural \` network based language model. In Interspeech, volume 2, page 3, 2010.
|
| 225 |
+
Nafise Sadat Moosavi and Michael Strube. Lexical features in coreference resolution: To be used with caution. arXiv preprint arXiv:1704.06779, 2017.
|
| 226 |
+
Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International conference on machine learning, pages 1310–1318, 2013.
|
| 227 |
+
Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
|
| 228 |
+
Ofir Press and Lior Wolf. Using the output embedding to improve language models. CoRR, abs/1608.05859, 2016. URL http://arxiv.org/abs/1608.05859.
|
| 229 |
+
David E Rumelhart, Geoffrey E Hinton, Ronald J Williams, et al. Learning representations by back-propagating errors. Cognitive modeling, 5(3):1, 1988.
|
| 230 |
+
Hasim Sak, Andrew W. Senior, and Françoise Beaufays. Long short-term memory based recurrent neural network architectures for large vocabulary speech recognition. CoRR, abs/1402.1128, 2014. URL http: //arxiv.org/abs/1402.1128.
|
| 231 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015.
|
| 232 |
+
Ilya Sutskever, James Martens, and Geoffrey E Hinton. Generating text with recurrent neural networks. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pages 1017–1024, 2011.
|
| 233 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pages 3104–3112, 2014.
|
| 234 |
+
Chong Wang, Yining Wang, Po-Sen Huang, Abdelrahman Mohamed, Dengyong Zhou, and Li Deng. Sequence modeling via segmentations. In Proceedings of the 34th International Conference on Machine LearningVolume 70, pages 3674–3683. JMLR. org, 2017.
|
| 235 |
+
Paul J Werbos et al. Backpropagation through time: what it does and how to do it. Proceedings of the IEEE, 78 (10):1550–1560, 1990.
|
| 236 |
+
Yuhuai Wu, Saizheng Zhang, Ying Zhang, Yoshua Bengio, and Ruslan R Salakhutdinov. On multiplicative integration with recurrent neural networks. In Advances in neural information processing systems, pages 2856–2864, 2016.
|
| 237 |
+
Zhilin Yang, Zihang Dai, Ruslan Salakhutdinov, and William W Cohen. Breaking the softmax bottleneck: a high-rank rnn language model. arXiv preprint arXiv:1711.03953, 2017.
|
| 238 |
+
Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. CoRR, abs/1611.01578, 2016. URL http://arxiv.org/abs/1611.01578.
|
| 239 |
+
|
| 240 |
+
# APPENDIX A HYPERPARAMETER TUNING RANGES
|
| 241 |
+
|
| 242 |
+
In all experiments, we tuned hyperparameters using Google Vizier (Golovin et al. 2017). The tuning ranges are listed in Table 4. Obviously, mogrifier_rounds and mogrifier_rank are tuned only for the Mogrifier. If input_embedding_ratio $\geqslant 1$ , then the input/output embedding sizes and the hidden sizes are set to equal and the linear projection from the cell output into the output embeddings space is omitted. Similarly, mogrif ier_rank $\leqslant 0$ is taken to mean full rank $\mathbf { Q } ^ { * }$ , $\mathbf { R } ^ { * }$ without factorization. Since Enwik8 is a much larger dataset, we don’t tune input_embedding_ratio and specify tighter tuning ranges for dropout based on preliminary experiments (see Table 5).
|
| 243 |
+
|
| 244 |
+
Dynamic evaluation hyperparameters were tuned according to Table 6. The highest possible value for max_time_steps, the BPTT window size, was 20 for word, and 50 for character-level tasks. The batch size for estimating the mean squared gradients over the training data was set to 1024, gradient clipping was turned off, and the l2 penalty was set to zero.
|
| 245 |
+
|
| 246 |
+
Table 4: Hyperparameter tuning ranges for all tasks except Enwik8.
|
| 247 |
+
|
| 248 |
+
<table><tr><td>learning_rate input_embedding_ratio 12_penalty</td><td>Low High 0.001 0.004 0.0 2.0 5e-6 0.0</td><td>Spacing log</td></tr><tr><td>input_dropout</td><td>1e-3 0.9</td><td>log</td></tr><tr><td>inter_layer_dropout</td><td>0.0 0.95</td><td></td></tr><tr><td>state_dropout</td><td>0.0</td><td></td></tr><tr><td></td><td></td><td>0.8</td></tr><tr><td>output_dropout</td><td>0.0</td><td>0.95</td></tr><tr><td>mogrifier_rounds (r)</td><td>0</td><td>6</td></tr><tr><td>mogrifier_rank (k)</td><td>-20</td><td>100</td></tr></table>
|
| 249 |
+
|
| 250 |
+
Table 5: Hyperparameter tuning ranges for Enwik8.
|
| 251 |
+
|
| 252 |
+
<table><tr><td>learning_rate</td><td>High 0.004</td><td>Spacing log</td></tr><tr><td>12_penalty input_dropout</td><td>1e-3 0.2</td><td>log</td></tr><tr><td></td><td></td><td></td></tr><tr><td>inter_layer_dropout</td><td>0.2</td><td></td></tr><tr><td>state_dropout</td><td>0.25</td><td></td></tr><tr><td>output_dropout</td><td>0.0 0.0</td><td>0.25</td></tr><tr><td>mogrifier_rounds (r)</td><td>0</td><td>6</td></tr><tr><td>mogrifier_rank (k)</td><td>-20</td><td>100</td></tr></table>
|
| 253 |
+
|
| 254 |
+
Table 6: Hyperparameter tuning ranges for dynamic evaluation.
|
| 255 |
+
|
| 256 |
+
<table><tr><td>max_time_steps</td><td>Low 1</td><td>High 20/50</td><td>Spacing</td></tr><tr><td>dyneval_learning_rate</td><td>1e-6</td><td>1e-3</td><td>log</td></tr><tr><td>dyneval_decay_rate</td><td>1e-6</td><td>1e-2</td><td>log</td></tr><tr><td>dyneval_epsilon</td><td>1e-8</td><td>1e-2</td><td>log</td></tr></table>
|
| 257 |
+
|
| 258 |
+
# APPENDIX B HYPERPARAMETER SENSITIVITY
|
| 259 |
+
|
| 260 |
+
The parallel coordinate plots in Fig. 5 and 6, give a rough idea about hyperparameter sensitivity. The red lines correspond to hyperparameter combinations closest to the best solution found. To find the closest combinations, we restricted the range for each hyperparameter separately to about $15 \%$ of its entire tuning range.
|
| 261 |
+
|
| 262 |
+
For both the LSTM and the Mogrifier, the results are at most 1.2 perplexity points off the best result, so our results are somewhat insensitive to jitter in the hyperparameters. Still, in this setup, grid search would require orders of magnitude more trials to find comparable solutions.
|
| 263 |
+
|
| 264 |
+
On the other hand, the tuner does take advantage of the stochasticity of training, and repeated runs with the same parameters may be give slightly worse results. To gauge the extent of this effect, on PTB we estimated the standard deviation in reruns of the LSTM with the best hyperparameters to be about 0.2 perplexity points, but the mean was about 0.7 perplexity points off the result produced with the weights saved in best tuning run.
|
| 265 |
+
|
| 266 |
+

|
| 267 |
+
Figure 5: Average per-word validation cross-entropies for hyperparameter combinations in the neighbourhood of the best solution for a 2-layer LSTM with 24M weights on the Penn Treebank dataset.
|
| 268 |
+
|
| 269 |
+

|
| 270 |
+
Figure 6: Average per-word validation cross-entropies for hyperparameter combinations in the neighbourhood of the best solution for a 2-layer Mogrifier LSTM with 24M weights on the Penn Treebank dataset. feature_mask_rank and feature_mask_rounds are aliases for mogrifier_rank and mogrifier_rounds
|
md/train/SJeLIgBKPS/SJeLIgBKPS.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/SkYMnLxRW/SkYMnLxRW.md
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# WEIGHTED TRANSFORMER NETWORK FOR MACHINE TRANSLATION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
State-of-the-art results on neural machine translation often use attentional sequence-to-sequence models with some form of convolution or recursion. Vaswani et al. (2017) propose a new architecture that avoids recurrence and convolution completely. Instead, it uses only self-attention and feed-forward layers. While the proposed architecture achieves state-of-the-art results on several machine translation tasks, it requires a large number of parameters and training iterations to converge. We propose Weighted Transformer, a Transformer with modified attention layers, that not only outperforms the baseline network in BLEU score but also converges $1 5 - 4 0 \%$ faster. Specifically, we replace the multi-head attention by multiple self-attention branches that the model learns to combine during the training process. Our model improves the state-of-the-art performance by 0.5 BLEU points on the WMT 2014 English-to-German translation task and by 0.4 on the English-to-French translation task.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Recurrent neural networks (RNNs), such as long short-term memory networks (LSTMs) (Hochreiter & Schmidhuber, 1997), form an important building block for many tasks that require modeling of sequential data. RNNs have been successfully employed for several such tasks including language modeling (Melis et al., 2017; Merity et al., 2017; Mikolov), speech recognition (Xiong et al., 2017; Graves et al., 2013; Lee et al., 1995), and machine translation (Wu et al., 2016; Bahdanau et al., 2014). RNNs make output predictions at each time step by computing a hidden state vector $h _ { t }$ based on the current input token and the previous states. This sequential computation underlies their ability to map arbitrary input-output sequence pairs. However, because of their auto-regressive property of requiring previous hidden states to be computed before the current time step, they cannot benefit from parallelization.
|
| 12 |
+
|
| 13 |
+
Variants of recurrent networks that use strided convolutions eschew the traditional time-step based computation (Kaiser & Bengio, 2016; Lei & Zhang, 2017; Bradbury et al., 2016; Gehring et al., 2016; 2017; Kalchbrenner et al., 2016). However, in these models, the operations needed to learn dependencies between distant positions can be difficult to learn (Hochreiter et al., 2001; Hochreiter, 1998). Attention mechanisms, often used in conjunction with recurrent models, have become an integral part of complex sequential tasks because they facilitate learning of such dependencies (Luong et al., 2015; Bahdanau et al., 2014; Parikh et al., 2016; Paulus et al., 2017; Kim et al., 2017).
|
| 14 |
+
|
| 15 |
+
In Vaswani et al. (2017), the authors introduce the Transformer network, a novel architecture that avoids the recurrence equation and maps the input sequences into hidden states solely using attention. Specifically, the authors use positional encodings in conjunction with a multi-head attention mechanism. This allows for increased parallel computation and reduces time to convergence. The authors report results for neural machine translation that show the Transformer networks achieves state-of-the-art performance on the WMT 2014 English-to-German and English-to-French tasks while being orders-of-magnitude faster than prior approaches.
|
| 16 |
+
|
| 17 |
+
Transformer networks still require a large number of parameters to achieve state-of-the-art performance. In the case of the newstest2013 English-to-German translation task, the base model required 65M parameters, and the large model required 213M parameters. We propose a variant of the Transformer network which we call Weighted Transformer that uses self-attention branches in lieu of the multi-head attention. The branches replace the multiple heads in the attention mechanism of the original Transformer network, and the model learns to combine these branches during training. This branched architecture enables the network to achieve comparable performance at a significantly lower computational cost. Indeed, through this modification, we improve the state-of-the-art performance by 0.5 and 0.4 BLEU scores on the WMT 2014 English-to-German and English-to-French tasks, respectively. Finally, we present evidence that suggests a regularizing effect of the proposed architecture.
|
| 18 |
+
|
| 19 |
+
# 2 RELATED WORK
|
| 20 |
+
|
| 21 |
+
Most architectures for neural machine translation (NMT) use an encoder and a decoder that rely on deep recurrent neural networks like the LSTM (Luong et al., 2015; Sutskever et al., 2014; Bahdanau et al., 2014; Wu et al., 2016; Barone et al., 2017; Cho et al., 2014). Several architectures have been proposed to reduce the computational load associated with recurrence-based computation (Gehring et al., 2016; 2017; Kaiser & Bengio, 2016; Kalchbrenner et al., 2016). Self-attention, which relies on dot-products between elements of the input sequence to compute a weighted sum (Lin et al., 2017; Bahdanau et al., 2014; Parikh et al., 2016; Kim et al., 2017), has also been a critical ingredient in modern NMT architectures. The Transformer network (Vaswani et al., 2017) avoids the recurrence completely and uses only self-attention.
|
| 22 |
+
|
| 23 |
+
We propose a modified Transformer network wherein the multi-head attention layer is replaced by a branched self-attention layer. The contributions of the various branches is learned as part of the training procedure. The idea of multi-branch networks has been explored in several domains (Ahmed & Torresani, 2017; Gastaldi, 2017; Shazeer et al., 2017; Xie et al., 2016). To the best of our knowledge, this is the first model using a branched structure in the Transformer network. In Shazeer et al. (2017), the authors use a large network, with billions of weights, in conjunction with a sparse expert model to achieve competitive performance. Ahmed & Torresani (2017) analyze learned branching, through gates, in the context of computer vision while in Gastaldi (2017), the author analyzes a two-branch model with randomly sampled weights in the context of image classification.
|
| 24 |
+
|
| 25 |
+
# 2.1 TRANSFORMER NETWORK
|
| 26 |
+
|
| 27 |
+
The original Transformer network uses an encoder-decoder architecture with each layer consisting of a novel attention mechanism, which the authors call multi-head attention, followed by a feedforward network. We describe both these components below.
|
| 28 |
+
|
| 29 |
+
From the source tokens, learned embeddings of dimension $d _ { \mathrm { m o d e l } }$ are generated which are then modified by an additive positional encoding. The positional encoding is necessary since the network does not otherwise possess any means of leveraging the order of the sequence since it contains no recurrence or convolution. The authors use additive encoding which is defined as:
|
| 30 |
+
|
| 31 |
+
$$
|
| 32 |
+
\begin{array} { r } { \mathrm { P E } ( p o s , 2 i ) = \sin ( p o s / 1 0 0 0 0 ^ { 2 i / d _ { \mathrm { m o d e l } } } ) } \\ { \mathrm { P E } ( p o s , 2 i + 1 ) = \cos ( p o s / 1 0 0 0 0 ^ { 2 i / d _ { \mathrm { m o d e l } } } ) , } \end{array}
|
| 33 |
+
$$
|
| 34 |
+
|
| 35 |
+
where pos is the position of a word in the sentence and $i$ is the dimension of the vector. The authors also experiment with learned embeddings (Gehring et al., 2016; 2017) but found no benefit in doing so. The encoded word embeddings are then used as input to the encoder which consists of $N$ layers each containing two sub-layers: (a) a multi-head attention mechanism, and (b) a feed-forward network.
|
| 36 |
+
|
| 37 |
+
A multi-head attention mechanism builds upon scaled dot-product attention, which operates on a query $Q$ , key $K$ and a value $V$ :
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
{ \mathrm { A t t e n t i o n } } ( Q , K , V ) = { \mathrm { s o f t m a x } } \left( { \frac { Q K ^ { T } } { \sqrt { d _ { k } } } } \right) V
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $d _ { k }$ is the dimension of the key.
|
| 44 |
+
|
| 45 |
+
In the first layer, the inputs are concatenated such that each of $( Q , K , V )$ is equal to the word vector matrix. This is identical to dot-product attention except for the scaling factor $d _ { k }$ , which improves numerical stability.
|
| 46 |
+
|
| 47 |
+
Multi-head attention mechanisms obtain $h$ different representations of $( Q , K , V )$ , compute scaled dot-product attention for each representation, concatenate the results, and project the concatenation with a feed-forward layer. This can be expressed in the same notation as Equation (1):
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\begin{array} { c } { \mathrm { h e a d } _ { i } = \mathrm { A t t e n t i o n } ( Q W _ { i } ^ { Q } , K W _ { i } ^ { K } , V W _ { i } ^ { V } ) } \\ { \mathrm { M u l t i H e a d } ( Q , K , V ) = \mathrm { C o n c a t } _ { i } ( \mathrm { h e a d } _ { i } ) W ^ { O } } \end{array}
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where the $W _ { i }$ and $W ^ { O }$ are parameter projection matrices that are learned. Note that $W _ { i } ^ { Q } ~ \in$ $\mathbb { R } ^ { d _ { \mathrm { m o d e l } } \times d _ { k } }$ , $W _ { i } ^ { K } ~ \in ~ \mathbb { R } ^ { d _ { \mathrm { m o d e l } } \times d _ { k } }$ , $W _ { i } ^ { V } ~ \in ~ \mathbb { R } ^ { d _ { \mathrm { m o d e l } } \times d _ { v } }$ and $W ^ { O } ~ \in ~ \mathbb R ^ { h d _ { v } \times d _ { \mathrm { m o d e l } } }$ where $h$ denotes the number of heads in the multi-head attention. Vaswani et al. (2017) proportionally reduce $d _ { k } \ : = \ : d _ { v } \ : = \ : d _ { \mathrm { m o d e l } } / h$ so that the computational load of the multi-head attention is the same as simple self-attention.
|
| 54 |
+
|
| 55 |
+
The second component of each layer of the Transformer network is a feed-forward network. The authors propose using a two-layered network with a ReLU activation. Given trainable weights $W _ { 1 } , W _ { 2 } , b _ { 1 } , b _ { 2 }$ , the sub-layer is defined as:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\mathrm { F F N } ( x ) = \operatorname* { m a x } ( 0 , x W _ { 1 } + b _ { 1 } ) W _ { 2 } + b _ { 2 }
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
The dimension of the inner layer is $d _ { f f }$ which is set to 2048 in their experiments. For the sake of brevity, we refer the reader to Vaswani et al. (2017) for additional details regarding the architecture.
|
| 62 |
+
|
| 63 |
+
For regularization and ease of training, the network uses layer normalization (Ba et al., 2016) after each sub-layer and a residual connection around each full layer (He et al., 2016). Analogously, each layer of the decoder contains the two sub-layers mentioned above as well as an additional multi-head attention sub-layer that receives as inputs $( V , K )$ from the output of the corresponding encoding layer. In the case of the decoder multi-head attention sub-layers, the scaled dot-product attention is masked to prevent future positions from being attended to, or in other words, to prevent illegal leftward-ward information flow.
|
| 64 |
+
|
| 65 |
+
One natural question regarding the Transformer network is why self-attention should be preferred to recurrent or convolutional models. Vaswani et al. (2017) state three reasons for the preference: (a) computational complexity of each layer, (b) concurrency, and (c) path length between long-range dependencies. Assuming a sequence length of $n$ and vector dimension $d$ , the complexity of each layer is $\mathcal { O } ( n ^ { 2 } d )$ for self-attention layers while it is $\mathcal { O } ( n d ^ { 2 } )$ for recurrent layers. Given that typically $d > n$ , the complexity of self-attention layers is lower than that of recurrent layers. Further, the number of sequential computations is $\mathcal { O } ( 1 )$ for self-attention layers and ${ \mathcal { O } } ( n )$ for recurrent layers. This helps improved utilization of parallel computing architectures. Finally, the maximum path length between dependencies is $\mathcal { O } ( 1 )$ for the self-attention layer while it is ${ \mathcal { O } } ( n )$ for the recurrent layer. This difference is instrumental in impeding recurrent models’ ability to learn long-range dependencies.
|
| 66 |
+
|
| 67 |
+
# 3 PROPOSED NETWORK ARCHITECTURE
|
| 68 |
+
|
| 69 |
+
We now describe the proposed architecture, the Weighted Transformer, which is more efficient to train and makes better use of representational power.
|
| 70 |
+
|
| 71 |
+
In Equations (3) and (4), we described the attention layer proposed in Vaswani et al. (2017) comprising the multi-head attention sub-layer and a FFN sub-layer. For the Weighted Transformer, we propose a branched attention that modifies the entire attention layer in the Transformer network (including both the multi-head attention and the feed-forward network).
|
| 72 |
+
|
| 73 |
+
The proposed attention layer can be mathematically described as:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\begin{array} { c } { { \mathrm { h e a d } _ { i } = \mathrm { A t t e n t i o n } ( Q W _ { i } ^ { Q } , K W _ { i } ^ { K } , V W _ { i } ^ { V } ) , } } \\ { { \overline { { { \mathrm { h e a d } } } } _ { i } = \mathrm { h e a d } _ { i } W ^ { O _ { i } } \times \kappa _ { i } , } } \\ { { \mathrm { B r a n c h e d A t t e n t i o n } ( Q , K , V ) = \displaystyle \sum _ { i = 1 } ^ { M } \alpha _ { i } \mathrm { F F N } _ { i } ( \overline { { { \mathrm { h e a d } } } } _ { i } ) . } } \end{array}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $M$ denotes the total number of branches, $\kappa _ { i } , \alpha _ { i } \in \mathbb { R } ^ { + }$ are learned parameters and $W ^ { O _ { i } } \ \in$ $\mathbb { R } ^ { d _ { v } \times d _ { \mathrm { m o d e l } } }$ . The FFN functions above are identical in form to Equation (4) but since there are $M$ of
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
Figure 1: Our proposed network architecture.
|
| 83 |
+
|
| 84 |
+
them, they have commensurately reduced dimensionality to ensure that no additional parameters are added to the network. Further, we require that $\sum \kappa _ { i } = 1$ and $\sum \alpha _ { i } = 1$ so that Equation (7) is a weighted sum of the individual branch attention values.
|
| 85 |
+
|
| 86 |
+
We now briefly contrast the modified architecture with the base Transformer model. In the same notation as (5)–(7), the attention layer in the base model can be described as:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { c } { { \mathrm { h e a d } _ { i } = \mathrm { A t t e n t i o n } ( Q W _ { i } ^ { Q } , K W _ { i } ^ { K } , V W _ { i } ^ { V } ) , } } \\ { { \overline { { { \mathrm { h e a d } } } } _ { i } = \mathrm { h e a d } _ { i } W ^ { O _ { i } } , } } \\ { { \mathrm { B r a n c h e d A t t e n t i o n } ( Q , K , V ) = \mathrm { F F N } ( \displaystyle \sum _ { i = 1 } ^ { M } \overline { { { \mathrm { h e a d } } } } _ { i } ) . } } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
Instead of aggregating the contributions from the different heads through $W ^ { O }$ right away and using a feed-forward sub-layer, we retain $\overline { { \mathrm { h e a d } } } _ { i }$ for each of the $M$ heads, learn to amplify or diminish their contribution, use a feed-forward sub-layer and then aggregate them, again in a learned fashion. In the equations above, $\kappa$ can be interpreted as a learned concatenation weight and $\alpha$ as the learned addition weight. Indeed, $\kappa$ scales the contribution of the various branches before $\alpha$ is used to sum them in a weighted fashion. We ensure that the simplex constraint is respected during each training step by projection. Finally, note that our modification does not add depth (i.e., through the FFN sublayers) to any of the attention head transformation since the feed-forward computation is merely split and not stacked.
|
| 93 |
+
|
| 94 |
+
One interpretation of our proposed architecture is that it replaces the multi-head attention by a multibranch attention. Rather than concatenating the contributions of the different heads, they are instead treated as branches that a multi-branch network learns to combine. While it is possible that $\alpha$ and $\kappa$ could be merged into one variable and trained, we found better training outcomes by separating them. It also improves the interpretability of the models gives that $( \alpha , \kappa )$ can be thought of as probability masses on the various branches.
|
| 95 |
+
|
| 96 |
+
This mechanism adds $\mathcal { O } ( M )$ trainable weights. This is an insignificant increase compared to the total number of weights. Indeed, in our experiments, the proposed mechanism added 192 weights to a model containing $2 1 3 M$ weights already. Without these additional trainable weights, the proposed mechanism is identical to the multi-head attention mechanism in the Transformer. The proposed attention mechanism is used in both the encoder and decoder layers and is masked in the decoder layers as in the Transformer network. Similarly, the positional encoding, layer normalization, and residual connections in the encoder-decoder layers are retained. We eliminate these details from Figure 1 for clarity. Instead of using $( \alpha , \kappa )$ learned weights, it is possible to also use a mixture-ofexperts normalization via a softmax layer (Shazeer et al., 2017). However, we found this to perform worse than our proposal.
|
| 97 |
+
|
| 98 |
+
Unlike the Transformer, which weighs all heads equally, the proposed mechanism allows for ascribing importance to different heads. This in turn prioritizes their gradients and eases the optimization process. Further, as is known from multi-branch networks in computer vision (Gastaldi, 2017), such mechanisms tend to cause the branches to learn decorrelated input-output mappings. This reduces co-adaptation and improves generalization. This observation also forms the basis for mixture-ofexperts models (Shazeer et al., 2017).
|
| 99 |
+
|
| 100 |
+
# 4 EXPERIMENTS
|
| 101 |
+
|
| 102 |
+
# 4.1 TRAINING DETAILS
|
| 103 |
+
|
| 104 |
+
The weights $\kappa$ and $\alpha$ are initialized randomly, as with the rest of the Transformer weights.
|
| 105 |
+
|
| 106 |
+
In addition to the layer normalization and residual connections, we use label smoothing with $\epsilon _ { \mathrm { l s } } = 0 . 1$ , attention dropout, and residual dropout with probability $P _ { \mathrm { d r o p } } = 0 . 1$ . Attention dropout randomly drops out elements (Srivastava et al., 2014) from the softmax in (1).
|
| 107 |
+
|
| 108 |
+
As in Vaswani et al. (2017), we used the Adam optimizer (Kingma & Ba, 2014) with $( \beta _ { 1 } , \beta _ { 2 } ) =$ (0.9, 0.98) and $\epsilon = 1 0 ^ { - 9 }$ . We also use the learning rate warm-up strategy for Adam wherein the learning rate $l r$ takes on the form:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
l r = d _ { \mathrm { m o d e l } } ^ { - 0 . 5 } \cdot \mathrm { m i n } ( \mathrm { i t e r a t i o n s } ^ { - 0 . 5 } , \mathrm { i t e r a t i o n s } \cdot 4 0 0 0 ^ { - 1 . 5 } ) ,
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
for the all parameters except $( \alpha , \kappa )$ and
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
l r = \left( d _ { \mathrm { m o d e l } } / \mathrm { N } \right) ^ { - 0 . 5 } \cdot \mathrm { m i n } ( \mathrm { i t e r a t i o n s } ^ { - 0 . 5 } , \mathrm { i t e r a t i o n s } \cdot 4 0 0 ^ { - 1 . 5 } ) ,
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
for $( \alpha , \kappa )$
|
| 121 |
+
|
| 122 |
+
This corresponds to the warm-up strategy used for the original Transformer network except that we use a larger peak learning rate for $( \alpha , \kappa )$ to compensate for their bounds. Further, we found that freezing the weights $( \kappa , \alpha )$ in the last $1 0 K$ iterations aids convergence. During this time, we continue training the rest of the network. We hypothesize that this freezing process helps stabilize the rest of the network weights given the weighting scheme.
|
| 123 |
+
|
| 124 |
+
We note that the number of iterations required for convergence to the final score is substantially reduced for the Weighted Transformer. We found that Weighted Transformer converges $1 5 \mathrm { - } 4 0 \dot { \% }$ faster as measured by the total number of iterations to achieve optimal performance. We train the baseline model for 100K steps for the smaller variant and 300K for the larger. We train the Weighted Transformer for the respective variants for 60K and 250K iterations. We found that the objective did not significantly improve by running it for longer. Further, we do not use any averaging strategies employed in Vaswani et al. (2017) and simply return the final model for testing purposes.
|
| 125 |
+
|
| 126 |
+
In order to reduce the computational load associated with padding, sentences were batched such that they were approximately of the same length. All sentences were encoded using byte-pair encoding (Sennrich et al., 2015) and shared a common vocabulary. Weights for word embeddings were tied to corresponding entries in the final softmax layer (Inan et al., 2016; Press & Wolf, 2016). We trained all our networks on NVIDIA K80 GPUs with a batch containing roughly 25,000 source and target tokens.
|
| 127 |
+
|
| 128 |
+
# 4.2 RESULTS ON BENCHMARK DATA SETS
|
| 129 |
+
|
| 130 |
+
We benchmark our proposed architecture on the WMT 2014 English-to-German and English-toFrench tasks. The WMT 2014 English-to-German data set contains 4.5M sentence pairs. The English-to-French contains 36M sentence pairs.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 2: Testing v/s Training Loss for the newstest2013 English-to-German task. The Weighted Transformer has lower testing loss compared to the baseline Transformer for the same training loss, suggesting a regularizing effect.
|
| 134 |
+
|
| 135 |
+
Table 1: Experimental results on the WMT 2014 English-to-German (EN-DE) and English-toFrench (EN-FR) translation tasks. Our proposed model outperforms the state-of-the-art models including the Transformer (Vaswani et al., 2017). The small model corresponds to configuration (A) in Table 2 while large corresponds to configuration (B).
|
| 136 |
+
|
| 137 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>EN-DE BLEU</td><td rowspan=1 colspan=1>EN-FR BLEU</td></tr><tr><td rowspan=1 colspan=1>Transformer (small) (Vaswani et al., 2017)Weighted Transformer (small)</td><td rowspan=1 colspan=1>27.328.4</td><td rowspan=1 colspan=1>38.138.9</td></tr><tr><td rowspan=1 colspan=1>Transformer (large) (Vaswani et al., 2017)Weighted Transformer (large)</td><td rowspan=1 colspan=1>28.428.9</td><td rowspan=1 colspan=1>41.041.4</td></tr><tr><td rowspan=1 colspan=1>ByteNet (Kalchbrenner et al., 2016)Deep-Att+PosUnk (Zhou et al., 2016)GNMT+RL (Wu et al., 2016)ConvS2S (Gehring et al., 2017)MoE (Shazeer et al., 2017)</td><td rowspan=1 colspan=1>23.7124.625.226.0</td><td rowspan=1 colspan=1>139.239.940.540.6</td></tr></table>
|
| 138 |
+
|
| 139 |
+
Results of our experiments are summarized in Table 1. The Weighted Transformer achieves a 1.1 BLEU score improvement over the state-of-the-art on the English-to-German task for the smaller network and 0.5 BLEU improvement for the larger network. In the case of the larger English-toFrench task, we note a 0.8 BLEU improvement for the smaller model and a 0.4 improvement for the larger model. Also, note that the performance of the smaller model for Weighted Transformer is close to that of the larger baseline model, especially for the English-to-German task. This suggests that the Weighted Transformer better utilizes available model capacity since it needs only $3 0 \%$ of the parameters as the baseline transformer for matching its performance. Our relative improvements do not hinge on using the BLEU scores for comparison; experiments with the GLEU score proposed in Wu et al. (2016) also yielded similar improvements.
|
| 140 |
+
|
| 141 |
+
Finally, we comment on the regularizing effect of the Weighted Transformer. Given the improved results, a natural question is whether the results stem from improved regularization of the model. To investigate this, we report the testing loss of the Weighted Transformer and the baseline Transformer against the training loss in Figure 2. Models which have a regularizing effect tend to have lower testing losses for the same training loss. We see this effect in our experiments suggesting that the proposed architecture may have better regularizing properties. This is not unexpected given similar outcomes for other branching-based strategies such as Shake-Shake Gastaldi (2017) and mixtureof-experts Shazeer et al. (2017).
|
| 142 |
+
|
| 143 |
+
Table 2: Experimental comparison between different variants of the Transformer (Vaswani et al., 2017) architecture and our proposed Weighted Transformer. Reported BLEU scores are evaluated on the English-to-German translation development set, newstest2013.
|
| 144 |
+
|
| 145 |
+
<table><tr><td>Model</td><td colspan="7"> Setings</td><td>BLEU</td><td> params</td></tr><tr><td></td><td>N</td><td>dmodel</td><td>dff</td><td>h</td><td>M</td><td>Pdrop</td><td> train steps</td><td></td><td>×106</td></tr><tr><td>Transformer (C)</td><td>2</td><td>512</td><td>2048</td><td>8</td><td>NA</td><td>0.1</td><td>100K</td><td>23.7</td><td>36</td></tr><tr><td>Weighted Transformer (C)</td><td>2</td><td>512</td><td>2048</td><td>8</td><td>8</td><td>0.1</td><td>60K</td><td>24.8</td><td>36</td></tr><tr><td>Transformer</td><td>4</td><td>512</td><td>2048</td><td>8</td><td>NA</td><td>0.1</td><td>100K</td><td>25.3</td><td>50</td></tr><tr><td>Weighted Transformer</td><td>4</td><td>512</td><td>2048</td><td>8</td><td>8</td><td>0.1</td><td>60K</td><td>26.2</td><td>50</td></tr><tr><td>Transformer (A)</td><td>6</td><td>512</td><td>2048</td><td>8</td><td>NA</td><td>0.1</td><td>100K</td><td>25.8</td><td>65</td></tr><tr><td>Weighted Transformer (A)</td><td>6</td><td>512</td><td>2048</td><td>8</td><td>8</td><td>0.1</td><td>60K</td><td>26.5</td><td>65</td></tr><tr><td>Transformer</td><td>8</td><td>512</td><td>2048</td><td>8</td><td>NA</td><td>0.1</td><td>100K</td><td>25.5</td><td>80</td></tr><tr><td>Weighted Transformer</td><td>8</td><td>512</td><td>2048</td><td>8</td><td>8</td><td>0.3</td><td>60K</td><td>25.6</td><td>80</td></tr><tr><td>Transformer (B)</td><td>6</td><td>1024</td><td>4096</td><td>16</td><td>NA</td><td>0.3</td><td>300K</td><td>26.4</td><td>213</td></tr><tr><td>Weighted Transformer (B)</td><td>6</td><td>1024</td><td>4096</td><td>16</td><td>16</td><td>0.3</td><td>250K</td><td>27.2</td><td>213</td></tr></table>
|
| 146 |
+
|
| 147 |
+
Table 3: Model ablations of Weighted Transformer on the newstest2013 English-to-German task for configuration (C). This shows that the learning both $( \alpha , \kappa )$ and retaining the simplex constraints are critical for its performance.
|
| 148 |
+
|
| 149 |
+
<table><tr><td>Model</td><td>BLEU</td></tr><tr><td>Weighted Transformer</td><td>24.8</td></tr><tr><td>Train κ,α fixed to 1</td><td>24.5</td></tr><tr><td>Train α,κ fixed to 1</td><td>23.9</td></tr><tr><td>α, κ both fixed to 1</td><td>23.6</td></tr><tr><td>Without the simplex constraints</td><td>24.5</td></tr></table>
|
| 150 |
+
|
| 151 |
+
# 4.3 SENSITIVITY ANALYSIS
|
| 152 |
+
|
| 153 |
+
In Table 2, we report sensitivity results on the newstest2013 English-to-German task. Specifically, we vary the number of layers in the encoder/decoder and compare the performance of the Weighted Transformer and the Transformer baseline. Using the same notation as used in the original Transformer network, we label our configurations as (A), (B) and (C) with (C) being the smallest. The results clearly demonstrate the benefit of the branched attention; for every experiment, the Weighted Transformer outperforms the baseline transformer, in some cases by up to 1.3 BLEU points. As in the case of the baseline Transformer, increasing the number of layers does not necessarily improve performance; a modest improvement is seen when the number of layers $N$ is increased from 2 to 4 and 4 to 6 but the performance degrades when $N$ is increased to 8. Increasing the number of heads from 8 to 16 in configuration (A) yielded an even better BLEU score. However, preliminary experiments with $h = 1 6$ and $h = 3 2$ , like in the case with $N$ , degrade the performance of the model.
|
| 154 |
+
|
| 155 |
+
In Figure 3, we present the behavior of the weights $( \alpha , \kappa )$ for the second encoder layer of the configuration (C) for the English-to-German newstest2013 task. The figure shows that, in terms of relative weights, the network does prioritize some branches more than others; circumstantially by as much as $2 \times$ . Further, the relative ordering of the branches changes over time suggesting that the network is not purely exploitative. A purely exploitative network, which would learn to exploit a subset of the branches at the expense of the rest, would not be preferred since it would effectively reduce the number of available parameters and limit the representational power. Similar results are seen for other layers, including the decoder layers; we omit them for brevity.
|
| 156 |
+
|
| 157 |
+
Finally, we present an ablation study to highlight the ingredients of our proposal that assisted the improved BLEU score in Table 3. The results show that having both $\alpha$ and $\kappa$ as learned, in conjunction with the simplex constraint, was necessary for improved performance.
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 3: Convergence of the $( \alpha , \kappa )$ weights for the second encoder layer of Configuration (C) for the English-to-German newstest2013 task. We smoothen the curves using a mean filter. This shows that the network does prioritize some branches more than others and that the architecture does not exploit a subset of the branches while ignoring others.
|
| 161 |
+
|
| 162 |
+
<table><tr><td>Weights (α, κ)</td><td>BLEU</td></tr><tr><td>Learned</td><td>24.8</td></tr><tr><td>Random</td><td>21.1</td></tr><tr><td>Uniform</td><td>23.4</td></tr></table>
|
| 163 |
+
|
| 164 |
+
Table 4: Performance of the architecture with random and uniform normalization weights on the newstest2013 English-to-German task for configuration (C). This shows that the learned $( \alpha , \kappa )$ weights of the Weighted Transformer are crucial to its performance.
|
| 165 |
+
|
| 166 |
+
# 4.4 RANDOMIZATION BASELINE
|
| 167 |
+
|
| 168 |
+
The proposed modification can also be interpreted as a form of Shake-Shake regularization proposed in Gastaldi (2017). In this regularization strategy, random weights are sampled during forward and backward passes for weighing the various branches in a multi-branch network. During test time, they are weighed equally. In our strategy, the weights are learned instead of being sampled randomly. Consequently, no changes to the model are required during test time.
|
| 169 |
+
|
| 170 |
+
In order to better understand whether the network benefits from the learned weights or if, at test time, random or uniform weights suffice, we propose the following experiment: the weights for the Weighted Transformer, including $( \alpha , \kappa )$ are trained as before, but, during test time, we replace them with (a) randomly sampled weights, and (b) $1 / M$ where $M$ is the number of incoming branches. In Table 4, we report experimental results on the configuration (C) of the Weighted Transformer on the English-to-German newstest2013 data set (see Table 2 for details regarding the configuration). It is evident that random or uniform weights cannot replace the learned weights during test time. Preliminary experiments suggest that a Shake-Shake-like strategy where the weights are sampled randomly during training also leads to inferior performance.
|
| 171 |
+
|
| 172 |
+
# 4.5 GATING
|
| 173 |
+
|
| 174 |
+
In order to analyze whether a hard (discrete) choice through gating will outperform our normalization strategy, we experimented with using gates instead of the proposed concatenation-addition strategy. Specifically, we replaced the summation in Equation (7) by a gating structure that sums up the contributions of the top $k$ branches with the highest probabilities. This is similar to the sparselygated mixture of experts model in Shazeer et al. (2017). Despite significant hyper-parameter tuning of $k$ and $M$ , we found that this strategy performs worse than our proposed mechanism by a large margin. We hypothesize that this is due to the fact that the number of branches is low, typically less than 16. Hence, sparsely-gated models lose representational power due to reduced capacity in the model. We plan to investigate the setup with a large number of branches and sparse gates in future work.
|
| 175 |
+
|
| 176 |
+
# 5 CONCLUSIONS
|
| 177 |
+
|
| 178 |
+
We present the Weighted Transformer that trains faster and achieves better performance than the original Transformer network. The proposed architecture replaces the multi-head attention in the Transformer network by a multiple self-attention branches whose contributions are learned as a part of the training process. We report numerical results on the WMT 2014 English-to-German and English-to-French tasks and show that the Weighted Transformer improves the state-of-the-art BLEU scores by 0.5 and 0.4 points respectively. Further, our proposed architecture trains $1 5 - 4 0 \%$ faster than the baseline Transformer. Finally, we present evidence suggesting the regularizing effect of the proposal and emphasize that the relative improvement in BLEU score is observed across various hyper-parameter settings for both small and large models.
|
| 179 |
+
|
| 180 |
+
# REFERENCES
|
| 181 |
+
|
| 182 |
+
Karim Ahmed and Lorenzo Torresani. BranchConnect: Large-Scale Visual Recognition with Learned Branch Connections. arXiv preprint arXiv:1704.06010, 2017.
|
| 183 |
+
|
| 184 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 185 |
+
|
| 186 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
|
| 187 |
+
|
| 188 |
+
Antonio Valerio Miceli Barone, Jindˇrich Helcl, Rico Sennrich, Barry Haddow, and Alexandra Birch. Deep architectures for neural machine translation. arXiv preprint arXiv:1707.07631, 2017.
|
| 189 |
+
|
| 190 |
+
James Bradbury, Stephen Merity, Caiming Xiong, and Richard Socher. Quasi-recurrent neural networks. arXiv preprint arXiv:1611.01576, 2016.
|
| 191 |
+
|
| 192 |
+
Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
|
| 193 |
+
|
| 194 |
+
Xavier Gastaldi. Shake-Shake regularization. arXiv preprint arXiv:1705.07485, 2017.
|
| 195 |
+
|
| 196 |
+
Jonas Gehring, Michael Auli, David Grangier, and Yann N Dauphin. A convolutional encoder model for neural machine translation. arXiv preprint arXiv:1611.02344, 2016.
|
| 197 |
+
|
| 198 |
+
Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional Sequence to Sequence Learning. arXiv preprint arXiv:1705.03122, 2017.
|
| 199 |
+
|
| 200 |
+
Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In Acoustics, speech and signal processing (icassp), 2013 ieee international conference on, pp. 6645–6649. IEEE, 2013.
|
| 201 |
+
|
| 202 |
+
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.
|
| 203 |
+
|
| 204 |
+
Sepp Hochreiter. The vanishing gradient problem during learning recurrent neural nets and problem solutions. International Journal of Uncertainty, Fuzziness and Knowledge-Based Systems, 6(02): 107–116, 1998.
|
| 205 |
+
|
| 206 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 207 |
+
|
| 208 |
+
Sepp Hochreiter, Yoshua Bengio, Paolo Frasconi, Jurgen Schmidhuber, et al. Gradient flow in ¨ recurrent nets: the difficulty of learning long-term dependencies, 2001.
|
| 209 |
+
|
| 210 |
+
Hakan Inan, Khashayar Khosravi, and Richard Socher. Tying Word Vectors and Word Classifiers: A Loss Framework for Language Modeling. arXiv preprint arXiv:1611.01462, 2016.
|
| 211 |
+
|
| 212 |
+
Łukasz Kaiser and Samy Bengio. Can active memory replace attention? In Advances in Neural Information Processing Systems, pp. 3781–3789, 2016.
|
| 213 |
+
|
| 214 |
+
Nal Kalchbrenner, Lasse Espeholt, Karen Simonyan, Aaron van den Oord, Alex Graves, and Koray Kavukcuoglu. Neural machine translation in linear time. arXiv preprint arXiv:1610.10099, 2016.
|
| 215 |
+
|
| 216 |
+
Yoon Kim, Carl Denton, Luong Hoang, and Alexander M Rush. Structured attention networks. arXiv preprint arXiv:1702.00887, 2017.
|
| 217 |
+
|
| 218 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 219 |
+
|
| 220 |
+
Tan Lee, Pak-Chung Ching, and Lai-Wan Chan. Recurrent neural networks for speech modeling and speech recognition. In Acoustics, Speech, and Signal Processing, 1995. ICASSP-95., 1995 International Conference on, volume 5, pp. 3319–3322. IEEE, 1995.
|
| 221 |
+
|
| 222 |
+
Tao Lei and Yu Zhang. Training RNNs as fast as CNNs. arXiv preprint arXiv:1709.02755, 2017.
|
| 223 |
+
|
| 224 |
+
Zhouhan Lin, Minwei Feng, Cicero Nogueira dos Santos, Mo Yu, Bing Xiang, Bowen Zhou, and Yoshua Bengio. A structured self-attentive sentence embedding. arXiv preprint arXiv:1703.03130, 2017.
|
| 225 |
+
|
| 226 |
+
Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attentionbased neural machine translation. arXiv preprint arXiv:1508.04025, 2015.
|
| 227 |
+
|
| 228 |
+
Gabor Melis, Chris Dyer, and Phil Blunsom. On the state of the art of evaluation in neural language ´ models. arXiv preprint arXiv:1707.05589, 2017.
|
| 229 |
+
|
| 230 |
+
Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and optimizing LSTM language models. arXiv preprint arXiv:1708.02182, 2017.
|
| 231 |
+
|
| 232 |
+
Tomas Mikolov. Recurrent neural network based language model.
|
| 233 |
+
|
| 234 |
+
Ankur P Parikh, Oscar Tackstr ¨ om, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention ¨ model for natural language inference. arXiv preprint arXiv:1606.01933, 2016.
|
| 235 |
+
|
| 236 |
+
Romain Paulus, Caiming Xiong, and Richard Socher. A deep reinforced model for abstractive summarization. arXiv preprint arXiv:1705.04304, 2017.
|
| 237 |
+
|
| 238 |
+
Ofir Press and Lior Wolf. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016.
|
| 239 |
+
|
| 240 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015.
|
| 241 |
+
|
| 242 |
+
Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv preprint arXiv:1701.06538, 2017.
|
| 243 |
+
|
| 244 |
+
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.
|
| 245 |
+
|
| 246 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
|
| 247 |
+
|
| 248 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
|
| 249 |
+
|
| 250 |
+
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
|
| 251 |
+
|
| 252 |
+
Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans- ´ formations for deep neural networks. arXiv preprint arXiv:1611.05431, 2016.
|
| 253 |
+
|
| 254 |
+
Wayne Xiong, Jasha Droppo, Xuedong Huang, Frank Seide, Mike Seltzer, Andreas Stolcke, Dong Yu, and Geoffrey Zweig. The Microsoft 2016 conversational speech recognition system. In Acoustics, Speech and Signal Processing (ICASSP), 2017 IEEE International Conference on, pp. 5255–5259. IEEE, 2017.
|
| 255 |
+
|
| 256 |
+
Jie Zhou, Ying Cao, Xuguang Wang, Peng Li, and Wei Xu. Deep recurrent models with fast-forward connections for neural machine translation. arXiv preprint arXiv:1606.04199, 2016.
|
md/train/SyevDaVYwr/SyevDaVYwr.md
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CONFIDENCE SCORES MAKE INSTANCE-DEPENDENTLABEL-NOISE LEARNING POSSIBLE
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Learning with noisy labels has drawn a lot of attention. In this area, most of recent works only consider class-conditional noise, where the label noise is independent of its input features. This noise model may not be faithful to many real-world applications. Instead, few pioneer works have studied instance-dependent noise, but these methods are limited to strong assumptions on noise models. To alleviate this issue, we introduce confidence-scored instance-dependent noise (CSIDN), where each instance-label pair is associated with a confidence score. The confidence scores are sufficient to estimate the noise functions of each instance with minimal assumptions. Moreover, such scores can be easily and cheaply derived during the construction of the dataset through crowdsourcing or automatic annotation. To handle CSIDN, we design a benchmark algorithm termed instance-level forward correction. Empirical results on synthetic and real-world datasets demonstrate the utility of our proposed method.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The recent success of deep neural networks has increased the need for high-quality labeled data. However, such a labelling process can be time-consuming and costly. A compromise is to resort to weakly-supervised annotations, using crowdsourcing platforms or trained classifiers that annotate the data automatically. These weakly-supervised annotations tend to be low-quality and noisy, which negatively affects the accuracy of high-capacity models due to memorization effects (Zhang et al., 2017). Thus, learning with noisy labels has often drawn a lot of attention.
|
| 12 |
+
|
| 13 |
+
Early works on noisy labels studied random classification noise (RCN) for binary classification (Angluin & Laird, 1988; Kearns, 1993). In the RCN model, each instance has its label flipped with a fixed noise rate $\rho \in [ 0 , \frac { 1 } { 2 } )$ . A natural extension of RCN is class-conditional noise (CCN) for multiclass classification (Stempfel & Ralaivola, 2009; Natarajan et al., 2013; Scott et al., 2013; Menon et al., 2015; van Rooyen & Williamson, 2015; Patrini et al., 2016) (Appendix A). In the CCN model, each instance from class $i$ has a fixed probability $\rho _ { i , j }$ of being assigned to class $j$ . Thus, it is possible to encode some similarity information between classes. For example, we can expect that the image of a “dog” is more likely to be erroneously labelled as “cat” than “boat”.
|
| 14 |
+
|
| 15 |
+
To handle the CCN model, a common method is the loss correction, which aims to correct the prediction or the loss of the classifier using an estimated noise transition matrix (Patrini et al., 2017; Sukhbaatar et al., 2015; Goldberger & Ben-Reuven, 2017; Ma et al., 2018). Another common approach is the label correction, which aims to improve the label quality during training. For example, Reed et al. (2015) introduced a bootstrapping scheme. Similarly, Tanaka et al. (2018) proposed to update the weights of a classifier iteratively using noisy labels, and use the updated classifier to yield more high-quality pseudo-labels for the training set. Although these methods have theoretical guarantees, they are unable to cope with real-world noise, e.g., instance-dependent noise (IDN).
|
| 16 |
+
|
| 17 |
+
The IDN model considers a more general noise (Manwani & Sastry, 2013; Ghosh et al., 2014; Menon et al., 2016; Cheng et al., 2017; Menon et al., 2018), where the probability that an instance is mislabeled depends on both its class and features. Intuitively, this noise is quite realistic, as poorquality or ambiguous instances are more likely to be mislabeled in real-world datasets. However, it is much more complex to formulate the IDN model, since the probability of a mislabeled instance is a function of not only the label space but also the input space that can be very high dimensional.
|
| 18 |
+
|
| 19 |
+
Table 1: Comparisons between baselines and our work for handling the IDN model. Rate identifiability denotes whether the transition matrix is identifiable.
|
| 20 |
+
|
| 21 |
+
<table><tr><td rowspan=1 colspan=1>Approaches</td><td rowspan=1 colspan=1>Multi-class</td><td rowspan=1 colspan=1>Rate-identifiability</td><td rowspan=1 colspan=1>Unbounded-noise</td></tr><tr><td rowspan=1 colspan=1>Du&Cai(2015)</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Menon et al. (2018)</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Bootkrajang& Chaijaruwanich (2018)</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Cheng et al. (2017)</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1>Our work</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td></tr></table>
|
| 22 |
+
|
| 23 |
+
As a result, several pioneer works have considered stronger assumptions on noise functions. However, stronger assumptions tend to restrict the utility of these works (Table 1). For instance, the boundary-consistent noise model considers stronger noise for samples closer to the decision boundary of the Bayesian optimal classifier (Du & Cai, 2015; Menon et al., 2018). However, such a model is restricted to binary and cannot estimate noise functions. Cheng et al. (2017) recently studied a particular case of the IDN model, where noise functions are upper-bounded. Nonetheless, their method is limited to binary classification and has only been tested on small datasets.
|
| 24 |
+
|
| 25 |
+
Instead of simplifying assumptions on noise functions, we propose to tackle the IDN model from the source, by considering confidence scores to be available for the label of each instance. We term this new setting confidence-scored instance-dependent noise (CSIDN, Figure 1c). The confidence scores denote how likely an instance is to be correctly labeled. Assuming that (i) confidence scores are available for each instance, (ii) transitions probabilities to other classes are independent of the instance conditionally on the assigned label being erroneous and (iii) a set of anchor points is available, we derive an instance-level forward correction algorithm which can fully estimate the transition probability for each instance, and subsequently train a robust classifier with a loss-correction method similarly to Patrini et al. (2017).
|
| 26 |
+
|
| 27 |
+
It is noted that confidence scores can be easily and cheaply derived during the construction of the dataset. For example, in crowdsourcing platforms, simply counting how many annotators agree on a given instance can give a notion of how confident a label is. Besides, many real-world datasets are automatically annotated using a trained classifier, such as web-scraped datasets (Tong Xiao et al., 2015) and physiological features inferred from medical records (Agarwal et al., 2016). In these cases, the class-probabilities of the labels assigned by the classifier can be seen as confidence scores, provided that the classifier is well calibrated (Guo et al., 2017).
|
| 28 |
+
|
| 29 |
+
To sum up, we first formulate instance-dependent noise in Section 2.1, and expose its robustness challenge in Section 2.2. Then, we explain our motivation to use confidence scores, and propose the confidence-scored instance-dependent noise (CSIDN) model in Section 2.3. Lastly, to handle this new noise model, we present the first practical algorithm termed instance-level forward correction in Section 3, and validate the proposed algorithm through extensive experiments in Section 4.
|
| 30 |
+
|
| 31 |
+
# 2 TACKLING INSTANCE-DEPENDENT NOISE FROM THE SOURCE
|
| 32 |
+
|
| 33 |
+
In this section, we present the IDN model along with the limitations of existing approaches, and introduce the CSIDN model as a tractable instance-dependent noise model.
|
| 34 |
+
|
| 35 |
+
# 2.1 NOISE MODELS: FROM CLASS-CONDITIONAL TO INSTANCE-DEPENDENT NOISE
|
| 36 |
+
|
| 37 |
+
We formulate the problem of learning with noisy labels in this section. Let $D$ be the distribution of a pair of random variables $( X , Y ) \in { \mathcal { X } } \times { \mathcal { Y } }$ , where $\boldsymbol { \mathcal { X } } \in \mathbb { R } ^ { d }$ , $\mathcal { Y } = \{ 1 , 2 , \dots , K \}$ and $K$ is the number of classes. In the classification task with noisy labels, we hope to train a classifier while having only access to samples from a noisy distribution $\bar { D }$ of random variables $( X , { \bar { Y } } ) \in { \mathcal { X } } \times { \mathcal { Y } }$ . Given a point $x$ sampled from $X$ , $\bar { Y }$ is derived from the random variable $Y$ via a noise transition matrix $\bar { T ( x ) } = ( T _ { i , j } \bar { ( x ) } ) _ { i , j = 1 } ^ { K } \in [ 0 , 1 ] ^ { K \times K }$ :
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\forall 1 \leq j \leq K , P ( \bar { Y } = j | X = x ) = \sum _ { i = 1 } ^ { K } T _ { i , j } ( x ) P ( Y = i | X = x ) .
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 1: Illustration of different noise models. Each color represents an observed class $\bar { y }$ : circles indicate ${ \bar { y } } = y$ , while crosses indicate $\bar { y } \ne y$ . The size of each point represents the confidence scores in the label $\bar { y }$ : the bigger the point is, the more confident it is. In the CCN model, the noise function only depends on the label of each instance. In the IDN and CSIDN models, the noise function depends on the observed instance $x$ . To illustrate the IDN model, we show a special case called boundary-consistent noise, i.e., points that lie close to the decision boundary are more likely to be mislabelled. Note the CSIDN model varies from the IDN model via confidence scores (Section 2.3).
|
| 45 |
+
|
| 46 |
+
Each noise function $T _ { i , j } : \mathcal { X } \mapsto [ 0 , 1 ]$ is defined as $T _ { i , j } ( x ) = P ( \bar { Y } = j | Y = i , X = x )$ . In the class-conditional noise (CNN) model (Figure 1a), the transition matrix does not depend on the instance $x$ and the noise is entirely characterized by the $K ^ { 2 }$ constants $T _ { i , j }$ . However, in the instancedependent noise (IDN) model (Figure 1b), the transition matrix depends on the actual instance. This tremendously complicates the problem, as the noise is now characterized by $K ^ { 2 }$ functions over the latent space $\mathcal { X }$ , which can be very high dimensional (e.g., $d \sim 1 0 ^ { 4 } – 1 0 ^ { 6 }$ for an object recognition dataset).
|
| 47 |
+
|
| 48 |
+
# 2.2 CHALLENGES FROM INSTANCE-DEPENDENT NOISE
|
| 49 |
+
|
| 50 |
+
Limitation of existing CCN methods. Due to the complexity of the IDN model, most recent works in learning with noisy labels have focused on the CCN model (Figure 1a), and the CCN model can be seen as a simplified IDN model (Figure 1b) free of feature information.
|
| 51 |
+
|
| 52 |
+
In addition to loss correction and label correction mentioned before, another method for the CCN model is sample selection, which aims to find reliable samples during training, such as the smallloss approaches (Jiang et al., 2018; Han et al., 2018). Inspired by the memorization in deep learning (Arpit et al., 2017), those methods first run a standard classifier on a noisy dataset, then select the small-loss samples for reliable training.
|
| 53 |
+
|
| 54 |
+
However, all approaches cannot handle the IDN model directly. Specifically, loss correction considers the noise model to be characterized by a fixed transition matrix, which does not include any instance-level information. Meanwhile, label correction is vulnerable to the IDN model, since the classifier will be much weaker on noisy regions and labels corrected by the current prediction would likely be erroneous. Similarly, sample selection is easily affected by the IDN model.
|
| 55 |
+
|
| 56 |
+
For example, in the small-loss approaches, instance-dependent noise functions can leave partial regions of the input space clean and other regions very noisy (e.g., in an object recognition dataset, poor-quality pictures will tend to receive more noisy labels than high-quality ones). Since clean regions will tend to receive smaller losses than noisy regions, the small-loss approaches, which only trains on points with the smallest-losses, will focus on clean regions and neglect harder noisy regions. Then, since the distribution of clean regions will subsequently be different from the global distribution, this will introduce a covariate-shift (Shimodaira, 2000), which greatly degrades performances. Moreover, it is hard to use importance reweighting (Sugiyama et al., 2007) for alleviate the issue, since importance reweighting would require estimating the clean posterior probability that is intractable for the IDN model.
|
| 57 |
+
|
| 58 |
+
To validate this fact, we generate a 3-class distribution of concentric circles (cf. Figure 2a), with $\forall ( x , y ) \in \mathbb { R } ^ { 2 } \times \{ 1 , 2 , 3 \}$ , $\begin{array} { r } { P ( \bar { y } \neq y | x ) = \frac { 1 } { 2 } \left( \frac { w \cdot x } { \| w \| \| x \| } + 1 \right) } \end{array}$ with $w = ( 0 , 1 )$ (cf. Figure 2b). We then train a network on the top $R ( T )$ small-loss instances at each epoch $T$ based on the losses of the previous epoch, with $R ( T )$ decreasing in $T$ as described in Han et al. (2018). Figure 2c shows the density of the top $5 0 \%$ small-loss instances selected after 10 epochs: since noisy regions are associated to higher losses, the network eventually tends to select instances from the clean region and neglect the noisy region. This leads to covariate-shift, which is associated with decreased performances (Shimodaira, 2000).
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: The limitation of the small-loss approaches in the IDN model. (a) Clean distribution. (b) instance-dependent noise in the direction $w = ( 0 , 1 )$ with an average corruption rate of $40 \%$ : points towards the upper region are more likely to be corrupted than points towards the bottom region. (c) Density map of the instances selected by a small-loss approach at epoch 10. The sample selection gets biased towards clean regions. Since the clean and noisy regions have different distributions, selecting most instances from clean regions creates a covariate-shift between the training and test distributions, which can greatly degrades performances.
|
| 62 |
+
|
| 63 |
+
Limitation of pioneer IDN methods. The main challenge of the IDN model is the wide range of possible noise functions included in its formulation. Since each $T _ { i , j } ( \cdot )$ is a function of the highdimensional input space $\mathcal { X }$ , it is challenging for a model to be flexible enough to fit any real-world noise function while being trainable on corrupted datasets, let alone derive theoretical results. Instead, various recent works have considered stronger assumptions on noise functions.
|
| 64 |
+
|
| 65 |
+
For instance, boundary-consistent noise (BCN), first introduced by (Du & Cai, 2015) and generalized in Menon et al. (2018), considers stronger noise for samples closer to the decision boundary of the Bayesian optimal classifier. This is a reasonable model for noise from human annotators, since “harder” instances (i.e., instances closer to the decision boundary) are more likely to be corrupted. Moreover, it is simple enough to derive some theoretical guarantees, as done in Menon et al. (2018). Additionally, an extension of the BCN model was studied in Bootkrajang & Chaijaruwanich (2018), where the noise function is a Gaussian mixture of the distance to the Bayesian optimal boundary. However, the BCN model and its extension are restricted to binary classification, and their geometry-based assumption becomes difficult to fathom for high-dimensional input spaces.
|
| 66 |
+
|
| 67 |
+
Furthermore, Cheng et al. (2017) recently studied a particular case of the IDN model, where the probabilities that the true labels of samples flip into corrupted ones have upper bounds. They proposed a method based on distilled samples, where noisy labels agree with the optimal Bayesian classifier on the clean distribution. However, their method is limited to binary classification and has only been tested on small UCI datasets. Table 1 summarizes the characteristics of those approaches.
|
| 68 |
+
|
| 69 |
+
# 2.3 CONFIDENCE-SCORED INSTANCE-DEPENDENT NOISE
|
| 70 |
+
|
| 71 |
+
Instead of simplifying assumptions on noise functions, we propose to tackle the IDN model from the source. Namely, we consider that, for each instance, we have access to a measure of confidence in the assigned label. As most of noisy datasets arise from crowdsourcing or automatic annotation, such confidence scores can be easily derived during the dataset construction, often with no extra cost. This allows for a good approximation of noise functions with weaker assumptions.
|
| 72 |
+
|
| 73 |
+
Before introducing our proposed noise model confidence-scored instance-dependent noise (CSIDN, Figure 1c), we first define what are the confidence scores, and explain why the confidence scores are available in real-world applications.
|
| 74 |
+
|
| 75 |
+
Definition of confidence scores. For any data point $( x , { \bar { y } } )$ sampled from the joint distribution $( X , { \bar { Y } } )$ , we define the confidence score $r _ { x }$ as follows.
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
r _ { x } = P ( Y = \bar { y } | \bar { Y } = \bar { y } , X = x ) .
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
Namely, the probability that the assigned label is correct.
|
| 82 |
+
|
| 83 |
+
Availability of confidence scores. Our rationale is that in tasks involving instance-dependent noise, the confidence information can be easily derived with no extra cost.
|
| 84 |
+
|
| 85 |
+
Firstly, in crowdsourcing platforms, when multiple workers manually annotate datasets, an aggregation step is often took to aggregate answers of different workers for each instance (e.g., majority vote). An estimation of $r _ { x }$ could then be derived by taking the ratio of votes for the assigned label on the total number of workers. Moreover, since this estimation would of course be less reliable as the number of workers decreases, an alternative could be to directly ask workers for self-reported confidence scores of their responses (Cosmides & Tooby, 1996; Oyama et al., 2013).
|
| 86 |
+
|
| 87 |
+
Secondly, the confidence information can also be available in automatic annotation via a softmax output layer of deep neural networks. This layer outputs an estimation of the probability that each class is the true label: when a model outputs a given class with probability 0.9, we expect the predicted class to be true 9 times out of 10 on average. A model that estimates the accurate probability is well-calibrated. Therefore, in the case of labels generated by a well-calibrated model, the softmax probability of the assigned label can be directly interpreted as a confidence measure that the label is correct. Even though Guo et al. (2017) showed that recent deep neural networks are not usually well-calibrated (whereas early shallower networks were, as shown in Niculescu-Mizil & Caruana (2005)), model calibration can be achieved in a relatively straightforward way at the validation time, e.g., using temperature scaling (Section 4.2 in Guo et al. (2017)).
|
| 88 |
+
|
| 89 |
+
CSIDN: a tractable instance-dependent noise model. Recall the intrinsic difficulty of the IDN model: to fully characterize this noise, one would need to estimate $K ^ { 2 }$ functions $T _ { i , j } ( \cdot )$ over the input space $\mathcal { X }$ . This is of course intractable with a finite noisy dataset. This is why pioneer solutions to the IDN model have been so far limited by very strong assumptions.
|
| 90 |
+
|
| 91 |
+
However, considering additional confidence scores, one can wonder whether such information would make the IDN model tractable with less restrictive assumptions. Hence, we introduce a new and tractable instance-dependent noise model: confidence-scored instance-dependent noise (CSIDN, Figure 1c). In this noise model, the training data takes the form ${ \cal S } : = \{ ( x _ { i } , \bar { y } _ { i } , r _ { x _ { i } } ) , i =$ $1 , \ldots , N \}$ , where $\{ ( x _ { i } , { \bar { y } } _ { i } ) \} _ { i }$ i.i.d. ∼ $\bar { D }$ and $r _ { x _ { i } } = P ( Y = \bar { y } _ { i } | \bar { Y } = \bar { y } _ { i } , X = x _ { i } ) $ is the previously defined confidence scores in the assigned label of a given instance (Eq. (2)). The confidence information $r _ { x }$ is decisive for robustness to instance-dependent noise, as it provides a proxy for the noise functions $T _ { i , j }$ of the training data that are often intractable otherwise.
|
| 92 |
+
|
| 93 |
+
# 3 BENCHMARK SOLUTION FOR HANDLING THE CSIDN MODEL
|
| 94 |
+
|
| 95 |
+
To tackle the CSIDN model, we propose a benchmark solution. Inspired by forward correction (Patrini et al., 2017) for the CCN model, we want to correct each prediction $P ( { \bar { y } } | x )$ with the noise transition matrix $T ( x )$ . However, the transition matrix for the CSIDN model is instance-dependent, and has to be estimated for each instance $x$ . We term our solution instance-level forward correction.
|
| 96 |
+
|
| 97 |
+
# 3.1 ESTIMATING INSTANCE-DEPENDENT TRANSITION MATRIX
|
| 98 |
+
|
| 99 |
+
Using the confidence scores, we will first estimate the diagonal terms $( T _ { i , i } ( \cdot ) ) _ { i = 1 } ^ { K }$ of the transition matrix, and then estimate the non-diagonal ones.
|
| 100 |
+
|
| 101 |
+
Diagonal terms. The diagonal terms of the transition matrix correspond to the probabilities that assigned labels are equal to true labels. However, the confidence scores available are only relevant
|
| 102 |
+
|
| 103 |
+
to the class corresponding to the observed label. Therefore, we need to proceed differently whether the confidence scores are available for the considered class or not.
|
| 104 |
+
|
| 105 |
+
First, note that for each sample $( x , \bar { y } , r _ { x } ) \in S _ { i } : = \{ ( x , \bar { y } , r _ { x } ) \in S | \bar { y } = i \} ,$ , $T _ { i , i } ( x )$ can be derived for the most part from the confidence scores alone:
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\begin{array} { r l } & { \forall ( x , \bar { y } , r _ { x } ) \in S _ { i } , \ T _ { i , i } ( x ) = P ( \bar { Y } = i | Y = i , X = x ) } \\ & { \qquad = P ( Y = i | \bar { Y } = i , X = x ) \frac { P ( \bar { Y } = i | X = x ) } { P ( Y = i | X = x ) } } \\ & { \qquad = r _ { x } \ \beta _ { i } ( x ) , } \end{array}
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
$\begin{array} { r } { \beta _ { i } ( x ) = \frac { P ( \bar { Y } = i | X = x ) } { P ( Y = i | X = x ) } } \end{array}$
|
| 112 |
+
|
| 113 |
+
In practice, we use an iterative procedure to estimate in turn $\beta _ { i } ( \cdot )$ and $T _ { i , i } ( \cdot )$ (see Section 3.2 for details). Then, for the rest of samples $( x , \bar { y } , r _ { x } ) \in S \backslash S _ { i }$ , $r _ { x }$ does not give any direct information on $T _ { i , i } ( \cdot )$ . Hence, we simply set each function $T _ { i , i } ( \cdot )$ as its empirical mean $\mu _ { i }$ estimated using samples from $S _ { i }$ at the current epoch:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\forall ( x , y , r _ { x } ) \in S \backslash S _ { i } , \ \hat { T } _ { i , i } ( x ) = \frac { 1 } { | S _ { i } | } \sum _ { ( x ^ { \prime } , \bar { y } ^ { \prime } , r _ { x } ^ { \prime } ) \in S _ { i } } T _ { i , i } ( x ^ { \prime } ) = \mu _ { i } ,
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
where $| S |$ denotes the cardinality of $S$ .
|
| 120 |
+
|
| 121 |
+
Non-diagonal terms. For non-diagonal terms, we have:
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
\begin{array} { r l } & { \forall i \neq j , \forall x \in \mathcal { X } , T _ { i , j } ( x ) = P ( \hat { Y } = j | Y = i , X = x ) } \\ & { \qquad = P ( \hat { Y } = j , \hat { Y } \neq i | Y = i , X = x ) } \\ & { \qquad = P ( \hat { Y } = j | \hat { Y } \neq i , Y = i , X = x ) P ( \hat { Y } \neq i | Y = i , X = x ) } \\ & { \qquad = \alpha _ { i , j } ( x ) ( 1 - T _ { i , i } ( x ) ) , } \end{array}
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
where $\alpha _ { i , j } ( x ) = P ( \bar { Y } = j | \bar { Y } \neq i , Y = i , X = x )$ .
|
| 128 |
+
|
| 129 |
+
In Eq. (4), $\alpha _ { i , j } ( x )$ refers to the probability that an instance $x$ with true label $i$ has an observed label $j$ , once we know that the observed label is different from the true one. Then, a reasonable assumption is that $\forall i \neq j , \forall x \in \mathcal { X } , \alpha _ { i , j } ( x ) = \alpha _ { i , j }$ : conditionally on the observed label being erroneous, the class transitions are not influenced by the instance $x$ . In other words, the dependence in $x$ of the noise function only impacts the “magnitude” of the noise and not the class transitions.
|
| 130 |
+
|
| 131 |
+
To illustrate this assumption, consider a crowdsourcing task of object recognition with adjacent classes which annotators can only differentiate with details that can be more or less visible depending on the instance. For example, objects from a given class may have distinctive traits, but those can be more or less visible in the pictures. When those traits are present, the annotators can confidently predict the right class. Otherwise, they will make errors towards adjacent classes. In this case, the probability that the assigned label is wrong highly depends the instance (with distinctive traits being visible or not). Nonetheless, conditionally on the instance being corrupted, i.e., because those traits were not visible enough on the image, the transition probabilities to the adjacent classes are not influenced by the instance itself.
|
| 132 |
+
|
| 133 |
+
With the previous assumption, we obtain $\forall i \neq j , \forall x \in \mathcal { X } , T _ { i , j } ( x ) = \alpha _ { i , j } ( 1 - T _ { i , i } ( x ) )$ with $\alpha _ { i , j } \in$ $[ 0 , 1 ]$ . This allows us to estimate the $K ( K { - } 1 )$ constants $( \alpha _ { i , j } ) _ { i \neq j }$ once, and derive the non-diagonal noise functions of $T ( x )$ directly from our estimates of the diagonal noise functions (Eq. (5)).
|
| 134 |
+
|
| 135 |
+
3.2 OVERALL ALGORITHM: INSTANCE-LEVEL FORWARD CORRECTION
|
| 136 |
+
|
| 137 |
+
Estimating $T _ { i , i }$ and $\beta _ { i }$ . To train a classifier $h$ with the instance-level forward correction method, we need to estimate both $T _ { i , i } ( x )$ and $\begin{array} { r } { \beta _ { i } ( x ) = \frac { P ( \bar { Y } = i | X = x ) } { P ( Y = i | X = x ) } } \end{array}$ from Eq. (3), for all $x \in S _ { i }$ . Firstly, the noisy posterior $P ( \bar { Y } = i \vert X = x )$ can be easily estimated by training a naive classifier on the noisy dataset. Secondly, the true posterior $P ( Y = i \vert X = x )$ can be estimated using the output of the classifier $h ( x ) = \hat { P } ( Y = i \vert X = x )$ at the previous epoch.
|
| 138 |
+
|
| 139 |
+
Therefore, we iteratively update $\hat { \beta }$ and $\hat { T }$ with the following steps: 1) $\forall x \in { \mathcal { X } }$ , initialize $\hat { \beta } _ { i } ( x ) = 1$ and train a naive classifier $h _ { \mathrm { n o i s y } }$ on the noisy data $\bar { D }$ to obtain $h _ { \mathrm { n o i s y } } ( x ) = \hat { P } ( \bar { Y } | X = x )$ . 2) $\forall i \in [ 1 , K ]$ , for each sample $( x , { \bar { y } } , r _ { x } ) \in S _ { i }$ , compute $\hat { T } _ { i , i } ( x ) = r _ { x } \hat { \beta } _ { i } ( x )$ and train classifier $h$ for one epoch. 3) $\forall i \in [ 1 , K ]$ , for each sample $( x , \bar { y } , r _ { x } ) \in S _ { i }$ , update $\begin{array} { r } { \hat { \beta } _ { i } ( x ) = \frac { h _ { \mathrm { n o i s y } } ( x ) _ { i } } { h ( x ) _ { i } } } \end{array}$ . Then, we repeat steps 2) and 3) through training. In this way, for every epoch, each function $T _ { i , i } ( \cdot )$ is estimated for the samples from $S _ { i }$ . Lastly, for the rest of samples with noisy label $j \neq i , T _ { i , i } ( \cdot )$ is estimated at each epoch using Eq. (4):
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
\forall ( x , y , r _ { x } ) \in S \backslash S _ { i } , \ \hat { T } _ { i , i } ( x ) = \frac { 1 } { | S _ { i } | } \sum _ { ( x ^ { \prime } , \bar { y } ^ { \prime } , r _ { x } ^ { \prime } ) \in S _ { i } } r _ { x } ^ { \prime } \hat { \beta } _ { i } ( x ^ { \prime } ) = \mu _ { i } .
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
Computing $\alpha _ { i , j }$ . The computation of $\alpha _ { i , j }$ boils down to approximating non-diagonal terms of the transition matrix in the CCN model. As $\forall i \neq j , \forall x \in \mathcal { X }$ , $\bar { T _ { i , j } } ( x ) = \alpha _ { i , j } \bar { ( 1 - T _ { i , i } ( x ) ) }$ , we have:
|
| 146 |
+
|
| 147 |
+
$$
|
| 148 |
+
\mathbb { E } _ { x } \left[ T _ { i , j } ( x ) \right] = \alpha _ { i , j } \left( 1 - \mathbb { E } _ { x } \left[ T _ { i , i } ( x ) \right] \right) \Leftrightarrow \alpha _ { i , j } = \frac { \mathbb { E } _ { x } \left[ T _ { i , j } ( x ) \right] } { 1 - \mathbb { E } _ { x } \left[ T _ { i , i } ( x ) \right] } .
|
| 149 |
+
$$
|
| 150 |
+
|
| 151 |
+
A simple and reliable way is to use anchor points, i.e., points for which we can know the true class almost surely. These points may be directly available when some training data has been curated, or they can be identified either theoretically as in Liu & Tao (2015) or heuristically as in Patrini et al. (2017). Having $S _ { i } ^ { * } : = \{ ( x , \bar { y } , r _ { x } ) \in S \dot { | } P ( Y = i | X = x ) \approx 1 \}$ a set of class $i$ anchor points, we simply need compute:
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
\forall ( x , \bar { y } , r _ { x } ) \in S _ { i } ^ { * } , \forall j \neq i , T _ { i , i } ( x ) = r _ { x } P ( \bar { Y } = i | X = x ) \mathrm { ~ a n d ~ } T _ { i , j } ( x ) = P ( \bar { Y } = j | X = x ) .
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
Two noisy posteriors can be estimated using the same classifier $h _ { \mathrm { n o i s y } }$ trained on the noisy distribution $h _ { \mathrm { n o i s y } } ( x ) = \hat { P } ( \bar { Y } | X = x )$ aforementioned. Thus, $\alpha _ { i , j }$ can be estimated as follows:
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\forall 1 \leq i , j \leq K , j \neq i , \alpha _ { i , j } = \frac { \frac { 1 } { | S _ { i } ^ { * } | } \displaystyle \sum _ { ( x , \bar { y } , r _ { x } ) \in S _ { i } ^ { * } } h _ { \sf n o i s y } ( x ) _ { j } } { 1 - \frac { 1 } { | S _ { i } ^ { * } | } \displaystyle \sum _ { ( x , \bar { y } , r _ { x } ) \in S _ { i } ^ { * } } r _ { x } h _ { \sf n o i s y } ( x ) _ { i } } .
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
Summary of the training procedure. Given samples $S$ and $K$ sets of anchor points $( S _ { i } ^ { * } ) _ { i = 1 } ^ { K }$ , we want to train a classifier $h ( \cdot )$ equipped with a loss . For any loss $l : y , \hat { y } \mapsto l ( y , \hat { y } )$ , we define the $T$ -corrected loss as $l _ { T } : y , \hat { y } \mapsto l ( y , T \hat { y } )$ . The overall procedure is in Algorithm 1 (Appendix C).
|
| 164 |
+
|
| 165 |
+
# 4 EXPERIMENTS
|
| 166 |
+
|
| 167 |
+
We compare our instance-level forward correction (ILFC) method with four representative baselines: forward correction (FC) (Patrini et al., 2017), mean absolute error (MAE) (Ghosh et al., 2017), $L _ { q }$ - norm (LQ) (Zhang & Sabuncu, 2018) and $^ { c o }$ -teaching (CT) (Han et al., 2018). Details are shown in Appendix D. Note that the pioneer IDN methods cannot work for multi-class cases.
|
| 168 |
+
|
| 169 |
+
# 4.1 SYNTHETIC DATASET
|
| 170 |
+
|
| 171 |
+
Generation process. We generate a synthetic dataset (Appendix E) consisting in three classes of concentric circles (Figure 6a). We then apply the following instance-dependent noise to each label: $\begin{array} { r } { P ( \bar { Y } \neq Y | X = x ) = \rho \left( \frac { w \cdot x } { \| w \| \| x \| } + 1 \right) / 2 } \end{array}$ with $w = ( 0 , 1 )$ and $\rho$ controlling the mean noise rate. If corrupted, each label is flipped to another class uniformly.
|
| 172 |
+
|
| 173 |
+
Empirical results. Figure 3 shows the test accuracy of different methods on the synthetic dataset. Each experiment is repeated 5 times and we plot the confidence intervals of each curve. On low-level noise, all methods show good performances (Figure 3a). On mild-level noise, both Co-teaching and ILFC show good performances and outperform other baselines (Figure 3b). On high-level noise, the performance of all the baselines collapse, whereas ILFC constantly maintains good performances (Figures 3c and 3d). More experiments are shown in Appendix B and F.
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 3: The test accuracy on synthetic datasets with different levels of IDN noise.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 4: The test accuracy on real-world datasets with different levels of IDN noise.
|
| 180 |
+
|
| 181 |
+
# 4.2 REAL-WORLD DATASET
|
| 182 |
+
|
| 183 |
+
Generation process. In order to corrupt labels from clean datasets such as SVHN and CIFAR10, we adopt the following procedure: (1) train a classifier $h : x \mapsto \sigma ( g ( x ) )$ on a small subset of the clean dataset; (2) using a small validation set, calibrate the classifier by selecting the temperature $t$ that maximizes the expected calibration error as in Guo et al. (2017); (3) for each instance $x$ , set: ${ \bar { y } } = \operatorname { a r g m a x } _ { i }$ $h _ { t } ( x ) _ { i }$ and $r _ { x } = \operatorname* { m a x } _ { i } h _ { t } ( x ) _ { i }$ . With this process, we attempt to emulate the construction of a real-world dataset (Appendix G).
|
| 184 |
+
|
| 185 |
+
Empirical results. Figures 4a and 4b show the test accuracy on SVHN with $2 5 \%$ and $4 5 \%$ instance-dependent noise, respectively. We can clearly observe that, on both low-level and highlevel noise, ILFC shows good performances with a fast convergence rate, and outperforms other baselines. Figures $_ \mathrm { 4 c }$ and 4d show the test accuracy on CIFAR10 with $2 5 \%$ and $4 5 \%$ instancedependent noise, respectively. On low-level noise, all methods show good performances. However, on high-level noise, ILFC shows a fast convergence rate and outperforms other baselines.
|
| 186 |
+
|
| 187 |
+
# 5 CONCLUSION
|
| 188 |
+
|
| 189 |
+
In this paper, we give an overview of label-noise learning from class-conditional noise (easier) to instance-dependent noise (harder). We explain why existing approaches cannot handle instancedependent noise well, and try to address this challenge via confidence scores. Thus, we formally propose the confidence-scored instance-dependent noise (CSIDN) model. To tackle the CSIDN model, we design a practical algorithm termed instance-level forward correction (ILFC). Our ILFC method robustly outperforms existing methods, especially in the case of high-level noise. In future works, we would like to extend label correction and sample selection approaches with the confidence scores from the CSIDN model.
|
| 190 |
+
|
| 191 |
+
# REFERENCES
|
| 192 |
+
|
| 193 |
+
Vibhu Agarwal, Tanya Podchiyska, Juan M Banda, Veena Goel, Tiffany I Leung, Evan P Minty, Timothy E Sweeney, Elsie Gyang, and Nigam H Shah. Learning statistical models of phenotypes using noisy labeled training data. Journal of the American Medical Informatics Association, 23 (6):1166–1173, 2016.
|
| 194 |
+
|
| 195 |
+
Dana Angluin and Philip Laird. Learning from noisy examples. Machine Learning, 2(4):343–370, 1988.
|
| 196 |
+
|
| 197 |
+
Devansh Arpit, Stanisław Jastrzebski, Nicolas Ballas, David Krueger, Emmanuel Bengio, Maxinder S Kanwal, Tegan Maharaj, Asja Fischer, Aaron Courville, Yoshua Bengio, et al. A closer look at memorization in deep networks. In ICML, 2017.
|
| 198 |
+
|
| 199 |
+
Jakramate Bootkrajang and Jeerayut Chaijaruwanich. Towards instance-dependent label noisetolerant classification: a probabilistic approach. Pattern Analysis and Applications, pp. 1–17, 2018.
|
| 200 |
+
|
| 201 |
+
Steve Branson, Grant Van Horn, and Pietro Perona. Lean crowdsourcing: Combining humans and machines in an online system. In CVPR, 2017.
|
| 202 |
+
|
| 203 |
+
Nontawat Charoenphakdee, Jongyeong Lee, and Masashi Sugiyama. On Symmetric Losses for Learning from Corrupted Labels. ICML, 2019.
|
| 204 |
+
|
| 205 |
+
Jiacheng Cheng, Tongliang Liu, Kotagiri Ramamohanarao, and Dacheng Tao. Learning with bounded instance-and label-dependent label noise. stat, 1050:12, 2017.
|
| 206 |
+
|
| 207 |
+
Leda Cosmides and John Tooby. Are humans good intuitive statisticians after all? rethinking some conclusions from the literature on judgment under uncertainty. Cognition, 58(1):1–73, 1996.
|
| 208 |
+
|
| 209 |
+
Jun Du and Zhihua Cai. Modelling class noise with symmetric and asymmetric distributions. In AAAI, 2015.
|
| 210 |
+
|
| 211 |
+
Aritra Ghosh, Naresh Manwani, and P S. Sastry. Making risk minimization tolerant to label noise. Neurocomputing, 160, 2014.
|
| 212 |
+
|
| 213 |
+
Aritra Ghosh, Himanshu Kumar, and PS Sastry. Robust loss functions under label noise for deep neural networks. In AAAI, 2017.
|
| 214 |
+
|
| 215 |
+
Jacob Goldberger and Ehud Ben-Reuven. Training deep neural-networks using a noise adaptation layer. In ICLR, 2017.
|
| 216 |
+
|
| 217 |
+
Melody Y Guan, Varun Gulshan, Andrew M Dai, and Geoffrey E Hinton. Who said what: Modeling individual labelers improves classification. In AAAI, 2018.
|
| 218 |
+
|
| 219 |
+
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In ICML, 2017.
|
| 220 |
+
|
| 221 |
+
Bo Han, Quanming Yao, Xingrui Yu, Gang Niu, Miao Xu, Weihua Hu, Ivor Tsang, and Masashi Sugiyama. Co-teaching: Robust training of deep neural networks with extremely noisy labels. In NeurIPS, 2018.
|
| 222 |
+
|
| 223 |
+
Takashi Ishida, Gang Niu, and Masashi Sugiyama. Binary classification from positive-confidence data. In NeurIPS, 2018.
|
| 224 |
+
|
| 225 |
+
Lu Jiang, Zhengyuan Zhou, Thomas Leung, Li-Jia Li, and Li Fei-Fei. Mentornet: Learning datadriven curriculum for very deep neural networks on corrupted labels. In ICML, 2018.
|
| 226 |
+
|
| 227 |
+
Michael Kearns. Efficient noise-tolerant learning from statistical queries. Proceedings of the twentyfifth annual ACM symposium on Theory of computing - STOC 93, 1993.
|
| 228 |
+
|
| 229 |
+
Ashish Khetan, Zachary C. Lipton, and Anima Anandkumar. Learning from noisy singly-labeled data. In ICLR, 2018.
|
| 230 |
+
|
| 231 |
+
Samuli Laine and Timo Aila. Temporal Ensembling for Semi-Supervised Learning. ICLR, 2017.
|
| 232 |
+
|
| 233 |
+
Tongliang Liu and Dacheng Tao. Classification with noisy labels by importance reweighting. IEEE Transactions on pattern analysis and machine intelligence, 38(3):447–461, 2015.
|
| 234 |
+
|
| 235 |
+
Xingjun Ma, Yisen Wang, Michael E. Houle, Shuo Zhou, Sarah Erfani, Shutao Xia, Sudanthi Wijewickrema, and James Bailey. Dimensionality-driven learning with noisy labels. In ICML, 2018.
|
| 236 |
+
|
| 237 |
+
Naresh Manwani and P. S. Sastry. Noise tolerance under risk minimization. IEEE Transactions on Cybernetics, 43:1146–1151, 2013.
|
| 238 |
+
|
| 239 |
+
Hamed Masnadi-shirazi and Nuno Vasconcelos. On the Design of Loss Functions for Classification: theory, robustness to outliers, and SavageBoost. In NeurIPS. 2009.
|
| 240 |
+
|
| 241 |
+
Aditya Menon, Brendan Van Rooyen, Cheng Soon Ong, and Bob Williamson. Learning from corrupted binary labels via class-probability estimation. In ICML, pp. 125–134, 2015.
|
| 242 |
+
|
| 243 |
+
Aditya Krishna Menon, Brendan Van Rooyen, and Nagarajan Natarajan. Learning from binary labels with instance-dependent corruption. arXiv preprint arXiv:1605.00751, 2016.
|
| 244 |
+
|
| 245 |
+
Aditya Krishna Menon, Brendan van Rooyen, and Nagarajan Natarajan. Learning from binary labels with instance-dependent noise. Machine Learning, 107(8-10):1561–1595, September 2018.
|
| 246 |
+
|
| 247 |
+
Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 41(8):1979–1993, 2018.
|
| 248 |
+
|
| 249 |
+
Nagarajan Natarajan, Inderjit S Dhillon, Pradeep K Ravikumar, and Ambuj Tewari. Learning with Noisy Labels. In NeurIPS. 2013.
|
| 250 |
+
|
| 251 |
+
Alexandru Niculescu-Mizil and Rich Caruana. Predicting good probabilities with supervised learning. In ICML, 2005.
|
| 252 |
+
|
| 253 |
+
Satoshi Oyama, Yukino Baba, Yuko Sakurai, and Hisashi Kashima. Accurate integration of crowdsourced labels using workers’ self-reported confidence scores. In IJCAI, 2013.
|
| 254 |
+
|
| 255 |
+
Giorgio Patrini, Frank Nielsen, Richard Nock, and Marcello Carioni. Loss factorization, weakly supervised learning and label noise robustness. In ICML, 2016.
|
| 256 |
+
|
| 257 |
+
Giorgio Patrini, Alessandro Rozza, Aditya Krishna Menon, Richard Nock, and Lizhen Qu. Making deep neural networks robust to label noise: A loss correction approach. In CVPR, 2017.
|
| 258 |
+
|
| 259 |
+
Vikas C Raykar, Shipeng Yu, Linda H Zhao, Anna Jerebko, Charles Florin, Gerardo Hermosillo Valadez, Luca Bogoni, and Linda Moy. Supervised learning from multiple experts: whom to trust when everyone lies a bit. In ICML, 2009.
|
| 260 |
+
|
| 261 |
+
Scott Reed, Honglak Lee, Dragomir Anguelov, Christian Szegedy, Dumitru Erhan, and Andrew Rabinovich. Training deep neural networks on noisy labels with bootstrapping. ICLR, 2015.
|
| 262 |
+
|
| 263 |
+
Clayton Scott, Gilles Blanchard, and Gregory Handy. Classification with asymmetric label noise: Consistency and maximal denoising. In COLT, pp. 489–511, 2013.
|
| 264 |
+
|
| 265 |
+
Yanyao Shen and Sujay Sanghavi. Learning with bad training data via iterative trimmed loss minimization. In ICML, 2019.
|
| 266 |
+
|
| 267 |
+
Hidetoshi Shimodaira. Improving predictive inference under covariate shift by weighting the loglikelihood function. Journal of statistical planning and inference, 90(2):227–244, 2000.
|
| 268 |
+
|
| 269 |
+
Rion Snow, Brendan O’Connor, Daniel Jurafsky, and Andrew Ng. Cheap and fast – but is it good? evaluating non-expert annotations for natural language tasks. In EMNLP, 2008.
|
| 270 |
+
|
| 271 |
+
Guillaume Stempfel and Liva Ralaivola. Learning SVMs from sloppily labeled data. In International Conference on Artificial Neural Networks, pp. 884–893, 2009.
|
| 272 |
+
|
| 273 |
+
Masashi Sugiyama, Matthias Krauledat, and Klaus-Robert MA˜ zller. Covariate shift adaptation by ˇ importance weighted cross validation. Journal of Machine Learning Research, 8(May):985–1005, 2007.
|
| 274 |
+
|
| 275 |
+
Sainbayar Sukhbaatar, Joan Bruna, Manohar Paluri, Lubomir Bourdev, and Rob Fergus. Training convolutional networks with noisy labels. ICLR workshop, 2015.
|
| 276 |
+
Daiki Tanaka, Daiki Ikami, Toshihiko Yamasaki, and Kiyoharu Aizawa. Joint optimization framework for learning with noisy labels. In CVPR, 2018.
|
| 277 |
+
Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NeurIPS, 2017.
|
| 278 |
+
Tong Xiao, Tian Xia, Yi Yang, Chang Huang, and Xiaogang Wang. Learning from massive noisy labeled data for image classification. In CVPR, 2015.
|
| 279 |
+
Brendan van Rooyen and Robert C. Williamson. Learning in the Presence of Corruption. arXiv e-prints, art. arXiv:1504.00091, Mar 2015.
|
| 280 |
+
Yan Yan, Romer Rosales, Glenn Fung, Mark Schmidt, Gerardo Hermosillo, Luca Bogoni, Linda ´ Moy, and Jennifer Dy. Modeling annotator expertise: Learning when everybody knows a bit of something. In AISTATS, 2010.
|
| 281 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017.
|
| 282 |
+
Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. ICLR, 2018.
|
| 283 |
+
Zhilu Zhang and Mert Sabuncu. Generalized Cross Entropy Loss for Training Deep Neural Networks with Noisy Labels. In NeurIPS. 2018.
|
| 284 |
+
|
| 285 |
+
# A RELATED WORKS
|
| 286 |
+
|
| 287 |
+
Besides the works aforementioned, we survey other approaches to learning with noisy labels.
|
| 288 |
+
|
| 289 |
+
Robust losses. Various approaches propose to use a provably robust loss function in the learning process. In the case of class-dependent label noise, Natarajan et al. (2013) constructed an unbiased estimator of any loss function under the noisy distribution. Masnadi-shirazi & Vasconcelos (2009) introduced a robust non-convex loss. Recently, works on symmetric losses showed that such loss offer theoretical robustness results to various types of noise (Ghosh et al., 2017; Charoenphakdee et al., 2019). Motivated by the robustness to noise of the mean absolute error loss (MAE) shown in Ghosh et al. (2017), Zhang & Sabuncu (2018) introduced generalized cross entropy loss that allows for a trade-off between the efficient learning properties of the CCE loss and the noise-robustness of MAE. Shen & Sanghavi (2019) introduced a trimmed loss with an iterative minimization process that allows for theoretical guarantees in the simpler setting of generalized linear models.
|
| 290 |
+
|
| 291 |
+
Annotator-level modelling. Another recent line of related works attempts to model labels and worker’s quality directly during the crowdsourcing annotation process, in order to produce more accurate labels efficiently. Branson et al. (2017) modeled the annotators’ skill and instances difficulty while incrementally training a computer vision model during the annotation process, effectively reducing the time burden of the annotation process as well as the error rate in the assigned labels. Guan et al. (2018) modeled each annotator individually in order to better aggregate labels based on each worker’s skill and area of expertise. Khetan et al. (2018) introduced a method that allows to learn each workers’ skill even when each example is only annotated once, by jointly modelling the assigned labels and the workers during the annotation process.
|
| 292 |
+
|
| 293 |
+
Learning with multiple noisy labels. A closely related setting is learning from multiple noisy labels, where the aim is to predict an unknown ground-truth label from $( X , ( Y ^ { \bar { j } } ) _ { j } )$ , each $Y ^ { j }$ referring to a noisy annotation. This setting can arise for example from crowdsourcing tasks; Snow et al. (2008) showed that using multiple non-expert annotators to train a classifier can be as effective as using gold standard annotations from experts. In Raykar et al. (2009), the authors derive a Bayesian approach to jointly learn the expertise of each annotator, the actual true label and the classifier. Yan et al. (2010) extends this Bayesian approach by considering that each annotator’s expertise varies across the input space. This setting differs from ours as it takes place before the aggregation of multiple annotations, which, for CSIDN, is only a way among others to obtain a confidence score for each noisy label.
|
| 294 |
+
|
| 295 |
+
Explicit/implicit regularizers. Recently, several other regularization techniques have shown good robustness in weakly-supervised settings. Temporal Ensembling (TE) (Laine & Aila, 2017) method labels some additional unlabeled instances using a consensus of predictions from models from previous epochs and with different regularizations and input augmentation conditions. Mean-teacher (MT) (Tarvainen & Valpola, 2017) instead uses predictions from a model obtained by averaging the weights of a set of models similar to TE, as using the prediction from a unique model is more efficient when a large amount of unlabeled data is available. Virtual Adversarial Training (Miyato et al., 2018) regularizes the network using a measure of local smoothness of the conditional label distribution given the input, defined as the robustness of the prediction to local adversarial perturbations in the input space. Introduced in Zhang et al. (2018), mixup trains a neural network on convex combinations of instance pairs and their respective labels, and has been shown to reduce the memorization of corrupted labels.
|
| 296 |
+
|
| 297 |
+
# B SENSITIVITY ANALYSIS
|
| 298 |
+
|
| 299 |
+
In practice, the confidence scores obtained may not be accurate. Therefore, we run a sensitivity analysis to assess the robustness of ILFC: similarly to Ishida et al. (2018), we add a zero-mean Gaussian noise with standard deviation $\sigma \in \{ 0 . 0 , 0 . 3 , 0 . 6 \}$ to each confidence score and clip the values between 0 and 1. Figure 5 shows the resulting performances on the synthetic dataset. ILFC shows good robustness to inaccurate confidence scores even with high standard deviation on a highly noisy dataset.
|
| 300 |
+
|
| 301 |
+

|
| 302 |
+
Figure 5: Sensitivity analysis on the synthetic dataset: a zero-mean Gaussian noise of standard deviation $\sigma \in \{ 0 . 0 , 0 . 3 , 0 . 6 \}$ is added to each confidence score before running ILFC with the noisy confidence scores.
|
| 303 |
+
|
| 304 |
+
# C ALGORITHM
|
| 305 |
+
|
| 306 |
+
We present Algorithm 1 here, which can be referred to Section 3.2 in details.
|
| 307 |
+
|
| 308 |
+
# D BASELINES
|
| 309 |
+
|
| 310 |
+
Forward correction. Introduced in Patrini et al. (2017), forward correction estimates a fixed transition matrix $T$ before training, and trains a classifier with the corrected loss $l _ { T } : ( y , \hat { y } ) \mapsto l ( y , T \hat { y } )$ .
|
| 311 |
+
|
| 312 |
+
Mean absolute error loss. Due to its symmetric property, the Mean Absolute Error (MAE) has been theoretically justified to be robust to label noise under assumptions (Ghosh et al., 2017). However, this loss is more difficult to train, especially on complex datasets.
|
| 313 |
+
|
| 314 |
+
$L _ { q }$ norm. Introduced in Zhang & Sabuncu (2018), $L _ { q }$ norm attempts to bring the best of both worlds between the CCE and the MAE loss: the CCE is easy to train, while the MAE is robust to label noise. The authors therefore define this loss using the negative box-cox transformation:
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
L _ { q } \left( h ( \pmb { x } ) , \pmb { e } _ { j } \right) = \frac { \left( 1 - h _ { j } ( \pmb { x } ) ^ { q } \right) } { q } ,
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
so that the $L _ { q }$ tends to the CCE when $q 0$ and to the MAE when $q \ : = \ : 1$ . In the following experiments, we set $q = 0 . 7$ , suggested by authors.
|
| 321 |
+
|
| 322 |
+
Co-teaching (Han et al., 2018). Co-teaching algorithm is a small-loss approach where two classifiers are trained in parallel. At each epoch, each classifier selects the instances with the smallest
|
| 323 |
+
|
| 324 |
+
# Algorithm 1: Instance-level Forward Correction
|
| 325 |
+
|
| 326 |
+
Input confidence-annotated samples $S : = \{ ( x _ { i } , \bar { y } _ { i } , r _ { x _ { i } } ) , i = 1 , \ldots , N \}$ , any loss $l$ , classifier $h ( \cdot )$ , anchor
|
| 327 |
+
points sets $( S _ { i } ^ { * } ) _ { i = 1 } ^ { K }$ ;
|
| 328 |
+
(1) Train naive classifier $h _ { \mathrm { n o i s y } }$ on samples $\{ ( x _ { i } , \bar { y } _ { i } ) \} _ { i = 1 } ^ { N }$ ;
|
| 329 |
+
(2) $\forall 1 \leq i , j \leq K , i \neq j$ , compute $\alpha [ i , j ]$ from Eq. 7 with anchor points set $S _ { i } ^ { * }$ ;
|
| 330 |
+
(3) $\forall 1 \leq i \leq K$ , initialize $\beta _ { i } ( \cdot ) = 1$ ;
|
| 331 |
+
for epoch $N = 1 , \dots , N _ { \mathrm { m a x } }$ do // Update diagonal constants (4) $\forall 1 \leq i \leq K$ , compute $\mu [ i ]$ from Eq. 6; for $( x , \bar { y } , r _ { x } ) \in S$ do Set $i = \bar { y }$ ; // Compute diagonal terms (5) Set $T [ i , i ] = r _ { x } \beta _ { i } ( x )$ and $\forall k \in [ [ 1 , K ] \backslash \{ i \} , T [ k , k ] = \mu [ k ]$ ; // Compute non-diagonal terms (6) Set $\forall 1 \leq i , j \leq K$ , s.t. $i \neq j$ , $T [ i , j ] = \alpha [ i , j ] ( 1 - T [ i , i ] )$ ; // Train classifier with instance-level corrected loss (7) Train $h ( \cdot )$ on sample $( x , \bar { y } , r _ { x } )$ with loss $l _ { T }$ ; // Update density ratio estimate (8) Update $\begin{array} { r } { \forall 1 \leq i \leq K , \forall x \in S _ { i } , \beta _ { i } ( x ) = \frac { h _ { \mathrm { n o i s y } _ { i } } ( x ) } { h _ { i } ( x ) } ; } \end{array}$ end
|
| 332 |
+
end
|
| 333 |
+
|
| 334 |
+
loss, and feed them to the other network as a training set for the next iteration. This recent work has proved to be a leading benchmark in the field of noisy labels.
|
| 335 |
+
|
| 336 |
+
# E SYNTHETIC DATASET
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
(9) Output classifier $h ( \cdot )$ .
|
| 340 |
+
Figure 6 shows three synthetic datasets, which cover clean, IDN and CSIDN models.
|
| 341 |
+
Figure 6: Synthetic dataset. The clean distribution (a) consists in three classes of concentric circles. In the IDN setting (b), each point $x$ has a probability $\begin{array} { r } { P ( \bar { Y } \ne Y | x ) = \rho \left( \frac { w \cdot x } { \| w \| \| x \| } + 1 \right) / 2 } \end{array}$ $w = ( 0 , 1 )$ of being corrupted, where $\rho$ is a parameter controlling the mean noise rate. Therefore the noise is the strongest towards the direction $( 0 , 1 )$ and the weakest in the direction $( 0 , - 1 )$ . If corrupted, the label is flipped to another class uniformly. The CSIDN setting (c) is similar to the IDN setting, but each point is associated with measure of the confidence in the assigned label. A lower confidence is represented by a lower opacity in the figure.
|
| 342 |
+
|
| 343 |
+
# F DECISION BOUNDARIES
|
| 344 |
+
|
| 345 |
+
Figure 7 shows the decision boundaries of our approach versus the ones of a benchmark model, for different levels of noise. With high levels of noise, a model that does not include any instance-level
|
| 346 |
+
|
| 347 |
+
modelling will degenerate around the most noisy region of the input space. On the other hand, our model successfully accounts for the high noise in this region and is able to keep consistent predictions.
|
| 348 |
+
|
| 349 |
+
# G EXAMPLES OF REAL-WORLD DATASETS
|
| 350 |
+
|
| 351 |
+
For example, the method would be similar to constructing a dataset with images scraped from the web, and automatically labelling them from neighbouring text fields using a classifier such as a recurrent neural network. Then, a small subset of curated images could be used at the beginning of the process to calibrate the classifier, in order to make the predictions of the softmax output faithful to the confidence in each label. This way, we could construct a very large dataset for a very low-cost that, while involving some instance-dependent noise, would be equipped with confidence information and therefore could be tackled with our proposed algorithm.
|
| 352 |
+
|
| 353 |
+

|
| 354 |
+
Figure 7: Decision boundaries of the learned classifier for the ILFC model (left column) and the $L _ { q }$ norm model (right column). In the presence of highly noisy regions, a classifier that does not include any instance-level information will degenerate in those regions, while the ILFC approach stays consistent with the clean distribution.
|
md/train/SylOlp4FvH/SylOlp4FvH.md
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# V-MPO: ON-POLICY MAXIMUM A POSTERIORI POLICY OPTIMIZATION FOR DISCRETE AND CONTINUOUS CONTROL
|
| 2 |
+
|
| 3 |
+
H. Francis Song∗, Abbas Abdolmaleki∗, Jost Tobias Springenberg, Aidan Clark, Hubert Soyer, Jack W. Rae, Seb Noury, Arun Ahuja, Siqi Liu, Dhruva Tirumala, Nicolas Heess, Dan Belov, Martin Riedmiller, Matthew M. Botvinick
|
| 4 |
+
|
| 5 |
+
DeepMind, London, UK {songf,aabdolmaleki,springenberg,aidanclark, soyer,jwrae,snoury,arahuja,liusiqi,dhruvat, heess,danbelov,riedmiller,botvinick}@google.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Some of the most successful applications of deep reinforcement learning to challenging domains in discrete and continuous control have used policy gradient methods in the on-policy setting. However, policy gradients can suffer from large variance that may limit performance, and in practice require carefully tuned entropy regularization to prevent policy collapse. As an alternative to policy gradient algorithms, we introduce V-MPO, an on-policy adaptation of Maximum a Posteriori Policy Optimization (MPO) that performs policy iteration based on a learned statevalue function. We show that V-MPO surpasses previously reported scores for both the Atari-57 and DMLab-30 benchmark suites in the multi-task setting, and does so reliably without importance weighting, entropy regularization, or population-based tuning of hyperparameters. On individual DMLab and Atari levels, the proposed algorithm can achieve scores that are substantially higher than has previously been reported. V-MPO is also applicable to problems with high-dimensional, continuous action spaces, which we demonstrate in the context of learning to control simulated humanoids with 22 degrees of freedom from full state observations and 56 degrees of freedom from pixel observations, as well as example OpenAI Gym tasks where V-MPO achieves substantially higher asymptotic scores than previously reported.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Deep reinforcement learning (RL) with neural network function approximators has achieved superhuman performance in several challenging domains (Mnih et al., 2015; Silver et al., 2016; 2018). Some of the most successful recent applications of deep RL to difficult environments such as Dota 2 (OpenAI, 2018a), Capture the Flag (Jaderberg et al., 2019), Starcraft II (Vinyals et al., 2019), and dexterous object manipulation (OpenAI, 2018b) have used policy gradient-based methods such as Proximal Policy Optimization (PPO) (Schulman et al., 2017) and the Importance-Weighted Actor-Learner Architecture (IMPALA) (Espeholt et al., 2018), both in the approximately on-policy setting.
|
| 14 |
+
|
| 15 |
+
Policy gradients, however, can suffer from large variance that may limit performance, especially for high-dimensional action spaces (Wu et al., 2018). In practice, moreover, policy gradient methods typically employ carefully tuned entropy regularization in order to prevent policy collapse. As an alternative to policy gradient-based algorithms, in this work we introduce an approximate policy iteration algorithm that adapts Maximum a Posteriori Policy Optimization (MPO) (Abdolmaleki et al., 2018a;b) to the on-policy setting. The modified algorithm, V-MPO, relies on a learned state-value function $V ( s )$ instead of the state-action value function used in MPO. Like MPO, rather than directly updating the parameters in the direction of the policy gradient, V-MPO first constructs a target distribution for the policy update subject to a sample-based KL constraint, then calculates the gradient that partially moves the parameters toward that target, again subject to a KL constraint.
|
| 16 |
+
|
| 17 |
+
As we are particularly interested in scalable RL algorithms that can be applied to multi-task settings where a single agent must perform a wide variety of tasks, we show for the case of discrete actions that the proposed algorithm surpasses previously reported performance in the multi-task setting for both the Atari-57 (Bellemare et al., 2012) and DMLab-30 (Beattie et al., 2016) benchmark suites, and does so reliably without population-based tuning of hyperparameters (Jaderberg et al., 2017a). For a few individual levels in DMLab and Atari we also show that V-MPO can achieve scores that are substantially higher than has previously been reported in the single-task setting, especially in the challenging Ms. Pacman.
|
| 18 |
+
|
| 19 |
+
V-MPO is also applicable to problems with high-dimensional, continuous action spaces. We demonstrate this in the context of learning to control both a 22-dimensional simulated humanoid from full state observations—where V-MPO reliably achieves higher asymptotic performance than previous algorithms—and a 56-dimensional simulated humanoid from pixel observations (Tassa et al., 2018; Merel et al., 2019). In addition, for several OpenAI Gym tasks (Brockman et al., 2016) we show that V-MPO achieves higher asymptotic performance than has previously been reported.
|
| 20 |
+
|
| 21 |
+
# 2 BACKGROUND AND SETTING
|
| 22 |
+
|
| 23 |
+
We consider the discounted RL setting, where we seek to optimize a policy $\pi$ for a Markov Decision Process described by states $s$ , actions $a$ , initial state distribution $\rho _ { 0 } ^ { \mathrm { e n v } } ( s _ { 0 } )$ , transition probabilities $\mathcal { P } ^ { \mathrm { e n v } } ( s _ { t + 1 } \vert s _ { t } , a _ { t } )$ , reward function $r ( s _ { t } , a _ { t } )$ , and discount factor $\gamma \in ( 0 , 1 )$ . In deep $\mathrm { R L }$ , the policy $\pi _ { \boldsymbol { \theta } } \big ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } \big )$ , which specifies the probability that the agent takes action $a _ { t }$ in state $s _ { t }$ at time $t$ , is described by a neural network with parameters $\theta$ . We consider problems where both the states state-value function V π(st) = Eat,st+1,at+1,... $s$ and actions $a$ may be discrete or continuous. Two functions play a central role in RL: the $\begin{array} { r } { \mathbf { \bar { \psi } } ^ { \pi } ( s _ { t } ) = \mathbb { E } _ { a _ { t } , s _ { t + 1 } , a _ { t + 1 } , \dots } \Big [ \sum _ { k = 0 } ^ { \infty } \gamma ^ { k } r ( s _ { t + k } , a _ { t + k } ) \Big ] } \end{array}$ and the state-action value function $\begin{array} { r } { Q ^ { \pi } ( s _ { t } , a _ { t } ) = \mathbb { E } _ { s _ { t + 1 } , a _ { t + 1 } , \ldots } \bigl [ \sum _ { k = 0 } ^ { \infty } \gamma ^ { k } r ( s _ { t + k } , a _ { t + k } ) \bigr ] = r ( s _ { t } , a _ { t } ) + \gamma \mathbb { E } _ { s _ { t + 1 } } \bigl [ V ^ { \pi } ( s _ { t + 1 } ) \bigr ] } \end{array}$ where $s _ { 0 } \sim \rho _ { 0 } ^ { \mathrm { e n v } } ( s _ { 0 } )$ , $a _ { t } \sim \pi ( a _ { t } | s _ { t } )$ , and $s _ { t + 1 } \sim \mathcal { P } ^ { \mathrm { e n v } } \bigl ( s _ { t + 1 } \vert s _ { t } , a _ { t } \bigr )$ .
|
| 24 |
+
|
| 25 |
+
In the usual forreturn given by nd a policy . In policy $\pi$ that maximizes the expectedadient algorithms (Williams, J (π) = Es0,a0,s1,a1,... $\begin{array} { r } { J ( \pi ) = \mathbb { E } _ { s _ { 0 } , a _ { 0 } , s _ { 1 } , a _ { 1 } , \dots } \Big [ \sum _ { t = 0 } ^ { \infty } \breve { \gamma ^ { t } } r ( s _ { t } , a _ { t } ) \Big ] } \end{array}$
|
| 26 |
+
1992; Sutton et al., 2000; Mnih et al., 2016), for example, this objective is directly optimized by estimating the gradient of the expected return. An alternative approach to finding optimal policies derives from research that treats RL as a problem in probabilistic inference, including Maximum a Posteriori Policy Optimization (MPO) (Levine, 2018; Abdolmaleki et al., 2018a;b). Here our objective is subtly different, namely, given a suitable criterion for what are good actions to take in a certain state, how do we find a policy that achieves this goal?
|
| 27 |
+
|
| 28 |
+
As was the case for the original MPO algorithm, the following derivation is valid for any such criterion. However, the policy improvement theorem (Sutton & Barto, 1998) tells us that a policy update performed by exact policy iteration, $\begin{array} { r } { \pi ( s ) = \arg \operatorname* { m a x } _ { a } [ Q ^ { \pi } ( s , a ) - V ^ { \pi } ( s ) ] } \end{array}$ , can improve the policy if there is at least one state-action pair with a positive advantage and nonzero probability of visiting the state. Motivated by this classic result, in this work we specifically choose an exponential function of the advantages $A ^ { \bar { \pi } } ( s , a ) = Q ^ { \pi } ( s , a ) - V ^ { \pi } ( s )$ .
|
| 29 |
+
|
| 30 |
+
Notation. In the following we use $\textstyle \sum _ { s , a }$ to indicate both discrete and continuous sums (i.e., integrals) over states $s$ and actions $a$ depending on the setting. A sum with indices only, such as $\textstyle \sum _ { s , a }$ , denotes a sum over all possible states and actions, while $\sum _ { \boldsymbol { s } , \boldsymbol { a } \sim \mathcal { D } }$ , for example, denotes a sum over sample states and actions from a batch of trajectories (the “dataset”) $\mathcal { D }$ .
|
| 31 |
+
|
| 32 |
+
# 3 RELATED WORK
|
| 33 |
+
|
| 34 |
+
V-MPO shares many similarities, and thus relevant related work, with the original MPO algorithm (Abdolmaleki et al., 2018a;b). In particular, the general idea of using KL constraints to limit the size of policy updates is present in both Trust Region Policy Optimization (TRPO; Schulman et al., 2015) and Proximal Policy Optimization (PPO) (Schulman et al., 2017); we note, however, that this corresponds to the E-step constraint in V-MPO.
|
| 35 |
+
|
| 36 |
+
It is worth noting here the following main differences with MPO, which is conceptually quite similar to V-MPO. MPO is primarily designed to be a sample-efficient off-policy algorithm in which the
|
| 37 |
+
|
| 38 |
+

|
| 39 |
+
Figure 1: (a) Actor-learner architecture with a target network, which is used to generate agent experience in the environment and is updated every $T _ { \mathrm { t a r g e t } }$ learning steps from the online network. (b) Schematic of the agents, with the policy $\mathbf { \eta } ^ { ( \theta ) }$ and value $\bar { ( \phi ) }$ networks sharing most of their parameters through a shared input encoder and LSTM [or Transformer-XL (TrXL) for single Atari levels]. The agent also receives the action and reward from the previous step as an input to the LSTM. For DMLab an additional LSTM is used to process simple language instructions.
|
| 40 |
+
|
| 41 |
+
E-step constructs a conditional target distribution $q ( a | s )$ , which requires a state-action value function $Q ( s , a )$ that can evaluate multiple sampled actions for a given state. In contrast, V-MPO is primarily (though not exclusively) designed to be an on-policy algorithm in which the E-step constructs a joint distribution $\psi ( s , a )$ , and in the absence of a learned $Q$ -function only one action per state is used. In this regard V-MPO can also be compared to Fitted $Q$ -iteration by Advantage Weighted Regression (Neumann & Peters, 2009), which learns a $Q$ -function but uses only one action per state.
|
| 42 |
+
|
| 43 |
+
V-MPO can also be related to Relative Entropy Policy Search (REPS) (Peters et al., 2008). Two distinguishing features of V-MPO from REPS are the introduction of the M-step KL constraint and the use of top- $k$ advantages. Moreover, in REPS the value function is a linear function of a learned feature representation whose parameters are trained by matching the feature distributions under the policy’s stationary state distribution. In V-MPO, the nonlinear neural network value function is instead learned directly from $n$ -step returns. Interestingly, previous attempts to use REPS with neural network function approximators reported very poor performance, being particularly prone to local optima (Duan et al., 2016). In contrast, we find that the principles of EM-style policy optimization, when combined with this learned value function and appropriate constraints, can reliably train powerful neural networks, including transformers, for RL tasks.
|
| 44 |
+
|
| 45 |
+
Like V-MPO, Supervised Policy Update (SPU) (Vuong et al., 2019) seeks to exactly solve an optimization problem and fit the parametric policy to this solution. As we argue in Appendix D, however, SPU uses this nonparametric distribution quite differently from V-MPO; as a result, the final algorithm is closer to a policy gradient algorithm such as PPO.
|
| 46 |
+
|
| 47 |
+
# 4 METHOD
|
| 48 |
+
|
| 49 |
+
V-MPO is an approximate policy iteration (Sutton & Barto, 1998) algorithm with a specific prescription for the policy improvement step. In general, policy iteration uses the fact that the true state-value function $V ^ { \pi }$ corresponding to policy $\pi$ can be used to obtain an improved policy $\pi ^ { \prime }$ . Thus we can
|
| 50 |
+
|
| 51 |
+
1. Generate trajectories $\tau$ from an old policy $\pi _ { \theta _ { \mathrm { o l d } } } ( a | s )$ whose parameters $\theta _ { \mathrm { o l d } }$ are fixed. To control the amount of data generated by a particular policy, we use a target network which is fixed for $T _ { \mathrm { t a r g e t } }$ learning steps (Fig. 1a).
|
| 52 |
+
|
| 53 |
+
2. Evaluate the policy $\pi _ { \theta _ { \mathrm { o l d } } } ( a | s )$ by learning the value function $V ^ { \pi _ { \theta _ { \mathrm { o l d } } } } \left( s \right)$ from empirical returns and estimating the corresponding advantages $A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } ( s , a )$ for the actions that were taken (Section 4.1).
|
| 54 |
+
3. Based on $A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } ( s , a )$ , estimate an improved policy $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$ which we call the “online” policy to distinguish it from the fixed target network (Section 4.2).
|
| 55 |
+
|
| 56 |
+
The first two steps are standard, and describing V-MPO’s approach to step 3 is the essential contribution of this work. At a high level, our strategy is to first construct a nonparametric target distribution for the policy update, then partially move the parametric policy towards this distribution subject to a KL constraint. We first review policy evaluation (step 2) in Section 4.1, then derive the V-MPO policy improvement (step 3) in Section 4.2. Ultimately, we use gradient descent to optimize a single, relatively simple loss, which is given in Eq. 10 following the derivation. A summary of the full algorithm is also presented in Algorithm 1.
|
| 57 |
+
|
| 58 |
+
# 4.1 POLICY EVALUATION
|
| 59 |
+
|
| 60 |
+
In the present setting, policy evaluation means learning an approximate state-value function $V ^ { \pi } ( s )$ given a policy $\pi ( a | s )$ , which we keep fixed for $T _ { \mathrm { t a r g e t } }$ learning steps (i.e., batches of trajectories). We note that the value function corresponding to the target policy is instantiated in the “online” network receiving gradient updates; bootstrapping uses the online value function, as it is the best available estimate of the value function for the target policy. Thus in this section $\pi$ refers to $\pi _ { \theta _ { \mathrm { o l d } } }$ , while the value function update is performed on the current $\phi$ , which may share parameters with the current $\theta$ .
|
| 61 |
+
|
| 62 |
+
We fit a parametric value function $V _ { \phi } ^ { \pi } ( s )$ with parameters $\phi$ by minimizing the squared loss
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\mathcal { L } _ { V } ( \phi ) = \frac { 1 } { 2 | \mathcal { D } | } \sum _ { s _ { t } \sim \mathcal { D } } \Big ( V _ { \phi } ^ { \pi } \big ( s _ { t } \big ) - G _ { t } ^ { ( n ) } \Big ) ^ { 2 } ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $G _ { t } ^ { ( n ) }$ is the standard $n$ -step target for the value function at state $s _ { t }$ at time $t$ (Sutton $\&$ Barto, 1998). This return uses the actual rewards in the trajectory and bootstraps from the value function for the rest: for each $\ell = t , \dots , t + n - 1$ in an unroll, $\begin{array} { r } { G _ { \ell } ^ { ( n ) } = \sum _ { k = \ell } ^ { t + n - 1 } \gamma ^ { k - \ell } r _ { k } + \gamma ^ { t + n - \ell } V _ { \phi } ^ { \pi } ( s _ { t + n } ) } \end{array}$ The advantages, which are the key quantity of interest for the policy improvement step in V-MPO, are then given by $A ^ { \pi } ( s _ { t } , a _ { t } ) = G _ { t } ^ { ( n ) } - V _ { \phi } ^ { \pi } ( s _ { t } )$ for each $s _ { t } , a _ { t }$ in the batch of trajectories.
|
| 69 |
+
|
| 70 |
+
PopArt normalization. As we are interested in the multi-task setting where a single agent must learn a large number of tasks with differing reward scales, we used PopArt (van Hasselt et al., 2016; Hessel et al., 2018) for the value function, even when training on a single task. We observed benefits in using PopArt even in the single-task setting, partly due to the fact that we do not tune the relative weighting of the policy evaluation and policy improvement losses despite sharing most parameters for the policy and value networks. Specifically, the value function outputs a separate value for each task in normalized space, which is converted to actual returns by a shift and scaling operation, the statistics of which are learned during training. We used a scale lower bound of $1 0 ^ { - 2 }$ , scale upper bound of $1 0 ^ { 6 }$ , and learning rate of $1 0 ^ { - 4 }$ for the statistics. The lower bound guards against numerical issues when rewards are extremely sparse.
|
| 71 |
+
|
| 72 |
+
Importance-weighting for off-policy data. It is possible to importance-weight the samples using V-trace to correct for off-policy data (Espeholt et al., 2018), for example when data is taken from a replay buffer. For simplicity, however, no importance-weighting was used for the experiments presented in this work, which were mostly on-policy.
|
| 73 |
+
|
| 74 |
+
# 4.2 POLICY IMPROVEMENT IN V-MPO
|
| 75 |
+
|
| 76 |
+
In this section we show how, given the advantage function $A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } \left( s , a \right)$ for the state-action distribution $p _ { \theta _ { \mathrm { o l d } } } ( s , a ) = \pi _ { \theta _ { \mathrm { o l d } } } ( a | s ) p ( s )$ induced by the old policy $\pi _ { \theta _ { \mathrm { o l d } } } ( a | s )$ , we can estimate an improved policy $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$ . More formally, let $\mathcal { T }$ denote the binary event that the new policy is an improvement (in a sense to be defined below) over the previous policy: $\mathcal { T } = 1$ if the policy is successfully improved and 0 otherwise. Then we would like to find the mode of the posterior distribution over parameters $\theta$ conditioned on this event, i.e., we seek the maximum a posteriori (MAP) estimate
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\theta ^ { * } = \arg \operatorname* { m a x } _ { \theta } \left[ \log p _ { \theta } ( \mathcal { T } = 1 ) + \log p ( \theta ) \right] ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where we have written $p ( \mathcal { T } = 1 | \theta )$ as $p _ { \theta } ( \mathcal { T } = 1 )$ to emphasize the parametric nature of the dependence on $\theta$ . We use the well-known identity $\begin{array} { r } { \log p ( X ) = \mathbb { E } _ { \psi ( Z ) } \big [ \log \frac { p ( X , Z ) } { \psi ( Z ) } \big ] + D _ { \mathrm { K L } } \big ( \psi ( Z ) \| p ( Z | X ) \big ) } \end{array}$ any latent distribution $\psi ( Z )$ , where $D _ { \mathrm { K L } } ( \psi ( Z ) \| p ( Z | X ) )$ is the Kullback-Leibler divergence between $\psi ( Z )$ and $p ( Z | X )$ with respect to $Z$ , and the first term is a lower bound because the KL divergence is always non-negative. Then considering $s , a$ as latent variables,
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\log p _ { \theta } ( \mathcal { T } = 1 ) = \sum _ { s , a } \psi ( s , a ) \log \frac { p _ { \theta } ( \mathcal { T } = 1 , s , a ) } { \psi ( s , a ) } + D _ { \mathrm { K L } } \big ( \psi ( s , a ) \| p _ { \theta } ( s , a | \mathcal { T } = 1 ) \big ) .
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Policy improvement in V-MPO consists of the following two steps which have direct correspondences to the expectation maximization (EM) algorithm (Neal & Hinton, 1998): In the expectation (E) step, we choose the variational distribution $\psi ( s , a )$ such that the lower bound on $\log p _ { \theta } ( \mathcal { T } = 1 )$ is as tight as possible, by minimizing the KL term. In the maximization (M) step we then find parameters $\theta$ that maximize the corresponding lower bound, together with the prior term in Eq. 2.
|
| 89 |
+
|
| 90 |
+
# 4.2.1 E-STEP
|
| 91 |
+
|
| 92 |
+
In the E-step, our goal is to choose the variational distribution $\psi ( s , a )$ such that the lower bound on $\log p _ { \theta } ( \mathcal { T } = \mathbf { \bar { 1 } } )$ is as tight as possible, which is the case when the $\mathrm { K L }$ term in Eq. 3 is zero. Given the old parameters $\theta _ { \mathrm { o l d } }$ , this simply leads to $\psi ( s , a ) = p _ { \theta _ { \mathrm { o l d } } } ( s , a | \mathcal { T } = 1 )$ , or
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\psi ( s , a ) = \frac { p _ { \theta _ { \mathrm { o d } } } ( s , a ) p _ { \theta _ { \mathrm { o d } } } ( \mathcal { T } = 1 | s , a ) } { p _ { \theta _ { \mathrm { o d } } } ( \mathcal { T } = 1 ) } , \qquad p _ { \theta _ { \mathrm { o d } } } ( \mathcal { T } = 1 ) = \sum _ { s , a } p _ { \theta _ { \mathrm { o d } } } ( s , a ) p _ { \theta _ { \mathrm { o d } } } ( \mathcal { T } = 1 | s , a ) .
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
Intuitively, this solution weights the probability of each state-action pair with its relative improvement probability $p _ { \theta _ { \mathrm { o l d } } } ( \mathcal { T } = 1 | s , a )$ . We now choose a distribution $p _ { \theta _ { \mathrm { o l d } } } ( \mathcal { T } = 1 | s , a )$ that leads to our desired outcome. As we prefer actions that lead to a higher advantage in each state, we suppose that this probability is given by
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
p _ { \theta _ { \mathrm { o l d } } } ( \mathcal { T } = 1 | s , a ) \propto \exp \left( \frac { A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } ( s , a ) } { \eta } \right)
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
for some temperature $\eta > 0$ , from which we obtain the equation on the right in Eq. 12. This probability depends on the old parameters $\theta _ { \mathrm { o l d } }$ and not on the new parameters $\theta$ . Meanwhile, the value of $\eta$ allows us to control the diversity of actions that contribute to the weighting, but at the moment is arbitrary. It turns out, however, that we can tune $\eta$ as part of the optimization, which is desirable since the optimal value of $\eta$ changes across iterations. The convex loss that achieves this, Eq. 13, is derived in Appendix A by minimizing the KL term in Eq. 3 subject to a hard constraint on $\psi ( s , a )$ .
|
| 105 |
+
|
| 106 |
+
Top- $k$ advantages. We found that learning improves substantially if we take only the samples corresponding to the highest $50 \%$ of advantages in each batch for the E-step, corresponding to the use of $\tilde { \mathcal { D } }$ rather than $\mathcal { D }$ in Eqs. 12, 13. Importantly, these must be consistent between the maximum likelihood weights in Eq. 12 and the temperature loss in Eq. 13, since, mathematically, this corresponds to a specific choice of the policy improvement probability in Eq. 5 to only use the top half of the advantages. This is similar to the technique used in the Cross Entropy Method (CEM) (Mannor et al., 2003) and Covariance Matrix Adaptation - Evolutionary Strategy (CMAES) (Hansen et al., 1997; Abdolmaleki et al., 2017), and is a special case of the more general feature that any rank-preserving transformation is allowed under this formalism. For example, in Fig. 8 of the Appendix we show an example of an agent trained with uniform weights given to the top- $k$ samples, instead of optimizing the temperature. Other choices are possible, and in future work we will investigate the suitability of different choices for specific applications.
|
| 107 |
+
|
| 108 |
+
Importance weighting for off-policy corrections. As for the value function, importance weights can be used in the policy improvement step to correct for off-policy data. While not used for the experiments presented in this work, details for how to carry out this correction are given in Appendix E.
|
| 109 |
+
|
| 110 |
+
# 4.2.2 M-STEP: CONSTRAINED SUPERVISED LEARNING OF THE PARAMETRIC POLICY
|
| 111 |
+
|
| 112 |
+
In the E-step we found the nonparametric variational state-action distribution $\psi ( s , a )$ , Eq. 4, that gives the tightest lower bound to $p _ { \theta } ( \mathcal { T } = 1 )$ in Eq. 3. In the M-step we maximize this lower bound
|
| 113 |
+
|
| 114 |
+
together with the prior term $\log p ( \theta )$ with respect to the parameters $\theta$ , which effectively leads to a constrained weighted maximum likelihood problem. Thus the introduction of the nonparametric distribution in Eq. 4 separates the RL procedure from the neural network fitting.
|
| 115 |
+
|
| 116 |
+
We would like to find new parameters $\theta$ that minimize
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\mathcal { L } ( \theta ) = - \sum _ { s , a } \psi ( s , a ) \log \frac { p _ { \theta } ( \mathcal { T } = 1 , s , a ) } { \psi ( s , a ) } - \log p ( \theta ) .
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
Note, however, that so far we have worked with the joint state-action distribution $\psi ( s , a )$ while we are in fact optimizing for the policy, which is the conditional distribution $\pi _ { \boldsymbol { \theta } } ( a | s )$ . Writing $p _ { \theta } ( s , a ) = \pi _ { \theta } ( a | \bar { s } ) p ( s )$ since only the policy is parametrized by $\theta$ and dropping terms that are not parametrized by $\theta$ , the first term of Eq. 6 is seen to be the weighted maximum likelihood policy loss
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\mathcal { L } _ { \pi } ( \theta ) = - \sum _ { s , a } \psi ( s , a ) \log \pi _ { \theta } ( a | s ) .
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
In the sample-based computation of this loss, we assume that any state-action pairs not in the batch of trajectories have zero weight, leading to the normalization in Eq. 12.
|
| 129 |
+
|
| 130 |
+
As in the original MPO algorithm, a useful prior is to keep the new policy $\pi _ { \boldsymbol { \theta } } ( a | s )$ close to the old policy $\pi _ { \theta _ { \mathrm { o l d } } } ( a | s ) \colon \log p ( \theta ) \approx - \alpha \mathbb { E } _ { s \sim p ( s ) } \left[ D _ { \mathrm { K L } } \big ( \pi _ { \theta _ { \mathrm { o l d } } } ( a | s ) \| \pi _ { \theta } ( a | s ) \big ) \right] .$ . While intuitive, we motivate this more formally in Appendix B. It is again more convenient to specify a bound on the KL divergence instead of tuning $\alpha$ directly, so we solve the constrained optimization problem
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\theta ^ { * } = \mathop { \mathrm { a r g } \operatorname* { m i n } } _ { \theta } - \sum _ { s , a } \psi ( s , a ) \log \pi _ { \theta } ( a | s ) \quad \mathrm { s . t . } \quad \mathbb { E } _ { \mathbf { \pi } \times \mathbf { \pi } \sim \mathbf { \pi } \sim \mathbf { \pi } \sim \mathbf { \pi } } \left[ D _ { \mathrm { K L } } \big ( \pi _ { \theta _ { \mathrm { o u t } } } ( a | s ) \| \pi _ { \theta } ( a | s ) \big ) \right] < \epsilon _ { \alpha } .
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
Intuitively, the constraint in the E-step expressed by Eq. 18 in Appendix A for tuning the temperature only constrains the nonparametric distribution; it is the constraint in Eq. 8 that directly limits the change in the parametric policy, in particular for states and actions that were not in the batch of samples and which rely on the generalization capabilities of the neural network function approximator.
|
| 137 |
+
|
| 138 |
+
To make the constrained optimization problem amenable to gradient descent, we use Lagrangian relaxation to write the unconstrained objective as
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
\begin{array} { r } { \mathcal { I } ( \theta , \alpha ) = \mathcal { L } _ { \pi } ( \theta ) + \alpha \bigg ( \epsilon _ { \alpha } - \underset { s \sim p ( s ) } { \mathbb { E } } \left[ D _ { \mathrm { K L } } \big ( \pi _ { \theta _ { \mathrm { o l d } } } ( a | s ) \| \pi _ { \theta } ( a | s ) \big ) \right] \bigg ) , } \end{array}
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
which we can optimize by following a coordinate-descent strategy, alternating between the optimization over $\theta$ and $\alpha$ . Since $\eta$ and $\alpha$ are Lagrange multipliers that must be positive, after each gradient update we project the resulting $\eta$ and $\alpha$ to a small positive value which we choose to be $\bar { \eta } _ { \mathrm { m i n } } = \alpha _ { \mathrm { m i n } } = 1 0 ^ { - 8 }$ throughout the results presented below.
|
| 145 |
+
|
| 146 |
+
KL constraints in both the $\mathrm { E }$ -step and M-step are generally well satisfied, especially for the E-step since the temperature optimization is convex. Fig. 7 in the Appendix shows an example of how the KL constraints behave in the Atari Seaquest experiment presented below. We note, in particular, that it is desirable for the bounds to not just be satisfied but saturated.
|
| 147 |
+
|
| 148 |
+
# 4.3 FULL LOSS FUNCTION
|
| 149 |
+
|
| 150 |
+
In this section we provide the full loss function used to implement V-MPO, which is perhaps simpler than is suggested by the derivation. Consider a batch of data $\mathcal { D }$ consisting of a number of trajectories, with $| \mathcal D |$ total state-action samples. Each trajectory consists of an unroll of length $n$ of the form $\tau = \big [ ( s _ { t } , a _ { t } , r _ { t + 1 } ) , \dots , ( s _ { t + n - 1 } , a _ { t + n - 1 } , r _ { t + n } ) ,$ , $s _ { t + n } ]$ including the bootstrapped state $s _ { t + n }$ , where $r _ { t + 1 } = r ( s _ { t } , a _ { t } )$ . The total loss is the sum of a policy evaluation loss and a policy improvement loss,
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
\begin{array} { r } { \mathcal { L } ( \phi , \theta , \eta , \alpha ) = \mathcal { L } _ { V } ( \phi ) + \mathcal { L } _ { \mathrm { V - M P O } } ( \theta , \eta , \alpha ) , } \end{array}
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+
where $\phi$ are the parameters of the value network, $\theta$ the parameters of the policy network, and $\eta$ and $\alpha$ are Lagrange multipliers. In practice, the policy and value networks share most of their parameters in the form of a shared convolutional network (a ResNet) and recurrent LSTM core, and are optimized together (Fig. 1b) (Mnih et al., 2016). We note, however, that the value network parameters $\phi$ are considered fixed for the policy improvement loss, and gradients are not propagated.
|
| 157 |
+
|
| 158 |
+
The policy evaluation loss for the value function, ${ \mathcal { L } } _ { V } ( \phi )$ , is the standard regression to $n$ -step returns and is given by Eq. 1 above. The policy improvement loss $\mathcal { L } _ { \mathrm { V - M P O } } ( \theta , \eta , \alpha )$ is given by
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
\mathcal { L } _ { \mathrm { V - M P O } } ( \theta , \eta , \alpha ) = \mathcal { L } _ { \pi } ( \theta ) + \mathcal { L } _ { \eta } ( \eta ) + \mathcal { L } _ { \alpha } ( \theta , \alpha ) .
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
Here the policy loss is the weighted maximum likelihood loss
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
\mathcal { L } _ { \pi } ( \theta ) = - \sum _ { s , a \sim \tilde { \mathcal { D } } } \psi ( s , a ) \log \pi _ { \theta } ( a | s ) , \qquad \psi ( s , a ) = \frac { \exp \big ( \frac { A ^ { \mathrm { t a g e t } } ( s , a ) } { \eta } \big ) } { \sum _ { s , a \sim \tilde { \mathcal { D } } } \exp \big ( \frac { A ^ { \mathrm { t a g e t } } ( s , a ) } { \eta } \big ) } ,
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
where the advantages $A ^ { \mathrm { t a r g e t } } ( s , a )$ for the target network policy $\pi _ { \theta _ { \mathrm { t a r g e t } } } ( a | s )$ are estimated according to the standard method described above. The tilde over the dataset, $\tilde { \mathcal { D } }$ , indicates that we take samples corresponding to the top half advantages in the batch of data. The $\eta$ , or “temperature”, loss is
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
\mathcal { L } _ { \eta } ( \eta ) = \eta \epsilon _ { \eta } + \eta \log \left[ \frac { 1 } { | \tilde { \mathcal { D } } | } \sum _ { s , a \sim \tilde { \mathcal { D } } } \exp \left( \frac { A ^ { \mathrm { t a r g e t } } ( s , a ) } { \eta } \right) \right] .
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
We perform the alternating optimization over $\theta$ and $\alpha$ while keeping a single loss function by alternately applying a “stop-gradient” to the Lagrange multiplier and KL term. Then the KL constraint, which can be viewed as a form of trust-region loss, is given by
|
| 177 |
+
|
| 178 |
+
$$
|
| 179 |
+
\dot { \ z } _ { \alpha } ( \theta , \alpha ) = \frac { 1 } { | \mathcal { D } | } \sum _ { s \in \mathcal { D } } [ \alpha \big ( \epsilon _ { \alpha } - \mathrm { s g } [ [ D _ { \mathrm { K L } } \big ( \pi _ { \theta _ { \mathrm { a r g e } } ( a | s ) } \| \pi _ { \theta } ( a | s ) \big ) ] ] \big ) + \mathrm { s g } [ [ \alpha ] ] D _ { \mathrm { K L } } \big ( \pi _ { \theta _ { \mathrm { a r g e } } ( a | s ) } \| \pi _ { \theta } ( a | s ) \big ) ] ]
|
| 180 |
+
$$
|
| 181 |
+
|
| 182 |
+
where $\mathrm { s g } [ [ \cdot ] ]$ indicates a stop gradient, i.e., that the enclosed term is assumed constant with respect to all variables. Note that here we use the full batch $\mathcal { D }$ , not $\tilde { \mathcal { D } }$ .
|
| 183 |
+
|
| 184 |
+
For continuous action spaces parametrized by Gaussian distributions, we use decoupled KL constraints for the M-step in Eq. 14 as in Abdolmaleki et al. (2018b); the precise form is given in Appendix C.
|
| 185 |
+
|
| 186 |
+
We used the Adam optimizer (Kingma & Ba, 2015) with default TensorFlow hyperparameters to optimize the total loss in Eq. 10. In particular, the learning rate was fixed at $1 0 ^ { - 4 }$ for all experiments.
|
| 187 |
+
|
| 188 |
+
# Algorithm 1 V-MPO
|
| 189 |
+
|
| 190 |
+
given Batch size $B$ , unroll length $n$ , $T _ { \mathrm { t a r g e t } }$ , KL bounds $\epsilon _ { \eta } , \epsilon _ { \alpha }$ .
|
| 191 |
+
initialize Network parameters $\theta _ { \mathrm { o n l i n e } }$ , $\phi _ { \mathrm { o n l i n e } }$ , Lagrange multipliers $\eta , \alpha$ .
|
| 192 |
+
repeat $\mathbf { \bar { \theta } } _ { \mathrm { t a r g e t } } \theta _ { \mathrm { o n l i n e } }$ for $i = 1 , \ldots , T _ { \mathrm { t a r g e t } } .$ do Use policy $\pi _ { \theta _ { \mathrm { t a r g e t } } }$ to act in the environment and collect $B$ trajectories $\tau$ of length $n$ . Update $\theta _ { \mathrm { o n l i n e } }$ , $\bar { \phi } _ { \mathrm { o n l i n e } }$ , $\eta$ , $\alpha$ using Adam to minimize the total loss in Eq. 10. $\begin{array} { l } { \eta \operatorname* { m a x } ( \eta , \eta _ { \mathrm { m i n } } ) } \\ { \alpha \operatorname* { m a x } ( \alpha , \alpha _ { \mathrm { m i n } } ) } \end{array}$ end for
|
| 193 |
+
until Fixed number of steps.
|
| 194 |
+
|
| 195 |
+
# 5 EXPERIMENTS
|
| 196 |
+
|
| 197 |
+
Details on the network architecture and hyperparameters used for each task are given in Appendix F.
|
| 198 |
+
|
| 199 |
+
# 5.1 DISCRETE ACTIONS: DMLAB, ATARI
|
| 200 |
+
|
| 201 |
+
DMLab. DMLab-30 (Beattie et al., 2016) is a collection of visually rich, partially observable 3D environments played from the first-person point of view. Like IMPALA, for DMLab we used pixel control as an auxiliary loss for representation learning (Jaderberg et al., 2017b; Hessel et al., 2018). However, we did not employ the optimistic asymmetric reward scaling used by previous IMPALA experiments to aid exploration on a subset of the DMLab levels, by weighting positive rewards more than negative rewards (Espeholt et al., 2018; Hessel et al., 2018; Kapturowski et al., 2019). Unlike in Hessel et al. (2018) we also did not use population-based training (PBT) (Jaderberg et al., 2017a). Additional details for the settings used in DMLab can be found in Table 5 of the Appendix.
|
| 202 |
+
|
| 203 |
+

|
| 204 |
+
Figure 2: (a) Multi-task DMLab-30. IMPALA results show 3 runs of 8 agents each; within a run hyperparameters were evolved via PBT. For V-MPO each line represents a set of hyperparameters that are fixed throughout training. The final result of $\mathrm { R } 2 \mathrm { D } 2 +$ trained for 10B environment steps on individual levels (Kapturowski et al., 2019) is also shown for comparison (orange line). (b) Multi-task Atari-57. In the IMPALA experiment, hyperparameters were evolved with PBT. For V-MPO each of the 24 lines represents a set of hyperparameters that were fixed throughout training, and all runs achieved a higher score than the best IMPALA run. Data for IMPALA (“Pixel-PopArtIMPALA” for DMLab-30 and “PopArt-IMPALA” for Atari-57) was obtained from the authors of Hessel et al. (2018). Each agent step corresponds to 4 environment frames due to the action repeat.
|
| 205 |
+
|
| 206 |
+

|
| 207 |
+
Figure 3: V-MPO trained on single example levels from DMLab-30, compared to IMPALA and more recent results from $\mathrm { R } 2 \mathrm { D } 2 +$ , the larger, DMLab-specific version of R2D2 (Kapturowski et al., 2019). The IMPALA results include hyperparameter evolution with PBT.
|
| 208 |
+
|
| 209 |
+
Fig. 2a shows the results for multi-task DMLab-30, comparing the V-MPO learning curves to data obtained from Hessel et al. (2018) for the PopArt IMPALA agent with pixel control. We note that the result for V-MPO at 10B environment frames across all levels matches the result for the Recurrent Replay Distributed DQN (R2D2) agent (Kapturowski et al., 2019) trained on individual levels for 10B environment steps per level. Fig. 3 shows example individual levels in DMLab where V-MPO achieves scores that are substantially higher than has previously been reported, for both R2D2 and IMPALA. The pixel-control IMPALA agents shown here were carefully tuned for DMLab and are similar to the “experts” used in Schmitt et al. (2018); in all cases these results match or exceed previously published results for IMPALA (Espeholt et al., 2018; Kapturowski et al., 2019).
|
| 210 |
+
|
| 211 |
+
Atari. The Atari Learning Environment (ALE) (Bellemare et al., 2012) is a collection of 57 Atari 2600 games that has served as an important benchmark for recent deep RL methods. We used the standard preprocessing scheme and a maximum episode length of 30 minutes (108,000 frames), see Table 6 in the Appendix. For the multi-task setting we followed Hessel et al. (2018) in setting the discount to zero on loss of life; for the example single tasks we did not employ this trick, since it can prevent the agent from achieving the highest score possible by sacrificing lives. Similarly, while in the multi-task setting we followed previous work in clipping the maximum reward to 1.0, no such clipping was applied in the single-task setting in order to preserve the original reward structure. Additional details for the settings used in Atari can be found in Table 6 in the Appendix.
|
| 212 |
+
|
| 213 |
+

|
| 214 |
+
Figure 4: Example levels from Atari. In Breakout, V-MPO achieves the maximum score of 864 in every episode. No reward clipping was applied, and the maximum length of an episode was 30 minutes (108,000 frames). Supplementary video for Ms. Pacman: https://bit.ly/2lWQBy5
|
| 215 |
+
|
| 216 |
+

|
| 217 |
+
Figure 5: (a) Humanoid “run” from full state (Tassa et al., 2018) and (b) humanoid “gaps” from pixel observations (Merel et al., 2019). Purple curves are the same runs but without parametric KL constraints. Det. eval.: deterministic evaluation. Supplementary video for humanoid gaps: https://bit.ly/2L9KZdS. (c)-(d) Example OpenAI Gym tasks. See also Fig. 11 in the Appendix for Gym Humanoid-V1.
|
| 218 |
+
|
| 219 |
+
Fig. 2b shows the results for multi-task Atari-57, demonstrating that it is possible for a single agent to achieve “superhuman“ median performance on Atari-57 in approximately 4 billion ${ \sim } 7 0$ million per level) environment frames. Again, while we did not employ PBT in order to demonstrate that individual V-MPO runs can exceed the performance of a population of IMPALA agents, Fig. 6 shows that with population-based tuning of hyperparameters even higher performance is possible.
|
| 220 |
+
|
| 221 |
+
We also compare the performance of V-MPO on a few individual Atari levels to R2D2 (Kapturowski et al., 2019), which previously achieved some of the highest scores reported for Atari. Again, VMPO can match or exceed previously reported scores while requiring fewer interactions with the environment. In Ms. Pacman, the final performance approaches 300,000 with a 30-minute timeout (and the maximum 1M without). Inspired by the argument in Kapturowski et al. (2019) that in a fully observable environment LSTMs enable the agent to utilize more useful representations than is available in the immediate observation, for the single-task setting we used a Transformer-XL (TrXL) (Dai et al., 2019) to replace the LSTM core. Unlike previous work for single Atari levels, we did not employ any reward clipping (Mnih et al., 2015; Espeholt et al., 2018) or nonlinear value function rescaling (Kapturowski et al., 2019).
|
| 222 |
+
|
| 223 |
+
# 5.2 CONTINUOUS CONTROL
|
| 224 |
+
|
| 225 |
+
To demonstrate V-MPO’s effectiveness in high-dimensional, continuous action spaces, here we present examples of learning to control both a simulated humanoid with 22 degrees of freedom from full state observations and one with 56 degrees of freedom from pixel observations (Tassa et al., 2018; Merel et al., 2019). As shown in Fig. 5a, for the 22-dimensional humanoid V-MPO reliably achieves higher asymptotic returns than has previously been reported, including for Deep Deterministic Policy
|
| 226 |
+
|
| 227 |
+
Gradients (DDPG) (Lillicrap et al., 2015), Stochastic Value Gradients (SVG) (Heess et al., 2015), and MPO. These algorithms are far more sample-efficient but reach a lower final performance.
|
| 228 |
+
|
| 229 |
+
In the “gaps” task the 56-dimensional humanoid must run forward to match a target velocity of $4 \mathrm { m / s }$ and jump over the gaps between platforms by learning to actuate joints with position-control (Merel et al., 2019). Previously, only an agent operating in the space of pre-learned motor primitives was able to solve the task from pixel observations (Merel et al., 2018; 2019); here we show that V-MPO can learn a challenging visuomotor task from scratch (Fig. 5b). For this task we also demonstrate the importance of the parametric KL constraint, without which the agent learns poorly.
|
| 230 |
+
|
| 231 |
+
In Figs. 5c-d we also show that V-MPO achieves the highest asymptotic performance reported for two OpenAI Gym tasks (Brockman et al., 2016). Again, MPO and Stochastic Actor-Critic (Haarnoja et al., 2018) are far more sample-efficient but reach a lower final performance.
|
| 232 |
+
|
| 233 |
+
These experiments are presented to demonstrate the existence of higher-return solutions than have previously been reported, and an algorithm, V-MPO, that can reliably converge to these solutions. However, in the future we desire algorithms that can do so while using fewer interactions with the environment.
|
| 234 |
+
|
| 235 |
+
# 6 CONCLUSION
|
| 236 |
+
|
| 237 |
+
In this work we have introduced a scalable on-policy deep reinforcement learning algorithm, V-MPO, that is applicable to both discrete and continuous control domains. For the results presented in this work neither importance weighting nor entropy regularization was used; moreover, since the size of neural network parameter updates is limited by KL constraints, we were also able to use the same learning rate for all experiments. This suggests that a scalable, performant RL algorithm may not require some of the tricks that have been developed over the past several years. Interestingly, both the original MPO algorithm for replay-based off-policy learning (Abdolmaleki et al., 2018a;b) and V-MPO for on-policy learning are derived from similar principles, providing evidence for the benefits of this approach as an alternative to popular policy gradient-based methods.
|
| 238 |
+
|
| 239 |
+
# ACKNOWLEDGMENTS
|
| 240 |
+
|
| 241 |
+
We thank Lorenzo Blanco, Trevor Cai, Greg Wayne, Chloe Hillier, and Vicky Langston for their assistance and support.
|
| 242 |
+
|
| 243 |
+
# REFERENCES
|
| 244 |
+
|
| 245 |
+
Abbas Abdolmaleki, Bob Price, Nuno Lau, Luis P Reis, and Gerhard Neumann. Deriving and Improving CMA-ES with Information Geometric Trust Regions. Proceedings of the Genetic and Evolutionary Computation Conference, 2017.
|
| 246 |
+
Abbas Abdolmaleki, Jost Tobias Springenberg, Jonas Degrave, Steven Bohez, Yuval Tassa, Dan Belov, Nicolas Heess, and Martin Riedmiller. Relative Entropy Regularized Policy Iteration. arXiv preprint, 2018a. URL https://arxiv.org/pdf/1812.02256.pdf.
|
| 247 |
+
Abbas Abdolmaleki, Jost Tobias Springenberg, Yuval Tassa, Remi Munos, Nicolas Heess, and Martin Riedmiller. Maximum a Posteriori Policy Optimisation. Int. Conf. Learn. Represent., 2018b. URL https://arxiv.org/pdf/1806.06920.pdf.
|
| 248 |
+
Charles Beattie, Joel Z Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Kuttler, ¨ Andrew Lefrancq, Simon Green, V´ıctor Valdes, Amir Sadik, et al. Deepmind Lab. ´ arXiv preprint arXiv:1612.03801, 2016.
|
| 249 |
+
Marc G. Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The Arcade Learning Environment: An Evaluation Platform for General Agents. Journal of Artificial Intelligence Research, 47, 2012.
|
| 250 |
+
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. OpenAI Gym. arXiv preprint, 2016. URL http://arxiv.org/abs/ 1606.01540.
|
| 251 |
+
|
| 252 |
+
Peter Buchlovsky, David Budden, Dominik Grewe, Chris Jones, John Aslanides, Frederic Besse, Andy Brock, Aidan Clark, Sergio Gomez Colmenarejo, Aedan Pope, Fabio Viola, and Dan Belov. TF-Replicator: Distributed Machine Learning for Researchers. arXiv preprint, 2019. URL http://arxiv.org/abs/1902.00465.
|
| 253 |
+
|
| 254 |
+
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G. Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context. arXiv preprint, 2019. URL http://arxiv.org/abs/1901.02860.
|
| 255 |
+
|
| 256 |
+
Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking Deep Reinforcement Learning for Continuous Control. arXiv preprint, 2016. URL http://arxiv. org/abs/1604.06778.
|
| 257 |
+
|
| 258 |
+
Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, Shane Legg, and Koray Kavukcuoglu. IMPALA: Scalable Distributed Deep-RL with Importance Weighted Actor-Learner Architectures. arXiv preprint, 2018. URL http://arxiv.org/abs/1802.01561.
|
| 259 |
+
|
| 260 |
+
Google. Cloud TPU, 2018. URL https://cloud.google.com/tpu/.
|
| 261 |
+
|
| 262 |
+
Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor. arXiv preprint, 2018. URL http://arxiv.org/abs/1801.01290.
|
| 263 |
+
|
| 264 |
+
Nikolaus Hansen, Andreas Ostermeier, and Andreas Ostermeier. Convergence Properties of Evolution Strategies with the Derandomized Covariance Matrix Adaptation: CMA-ES. 1997. URL http: //www.cmap.polytechnique.fr/˜nikolaus.hansen/CMAES2.pdf.
|
| 265 |
+
|
| 266 |
+
Nicolas Heess, Greg Wayne, David Silver, Timothy P. Lillicrap, Yuval Tassa, and Tom Erez. Learning continuous control policies by stochastic value gradients. arXiv preprint, 2015. URL http: //arxiv.org/abs/1510.09142.
|
| 267 |
+
|
| 268 |
+
Matteo Hessel, Hubert Soyer, Lasse Espeholt, Wojciech Czarnecki, Simon Schmitt, and Hado van Hasselt. Multi-task Deep Reinforcement Learning with PopArt. arXiv preprint, 2018. URL https://arxiv.org/pdf/1809.04474.pdf.
|
| 269 |
+
|
| 270 |
+
Max Jaderberg, Valentin Dalibard, Simon Osindero, Wojciech M. Czarnecki, Jeff Donahue, Ali Razavi, Oriol Vinyals, Tim Green, Iain Dunning, Karen Simonyan, Chrisantha Fernando, and Koray Kavukcuoglu. Population Based Training of Neural Networks. arXiv preprint, 2017a. URL http://arxiv.org/abs/1711.09846.
|
| 271 |
+
|
| 272 |
+
Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement Learning with Unsupervised Auxiliary Tasks. Int. Conf. Learn. Represent., 2017b. URL https://openreview.net/pdf?id $=$ SJ6yPD5xg.
|
| 273 |
+
|
| 274 |
+
Max Jaderberg, Wojciech M. Czarnecki, Iain Dunning, Luke Marris, Guy Lever, Antonio Garcia Castaneda, Charles Beattie, Neil C. Rabinowitz, Ari S. Morcos, Avraham Ruderman, Nico-˜ las Sonnerat, Tim Green, Louise Deason, Joel Z. Leibo, David Silver, Demis Hassabis, Koray Kavukcuoglu, and Thore Graepel. Human-level performance in 3d multiplayer games with population-based reinforcement learning. Science, 364:859–865, 2019. URL https: //science.sciencemag.org/content/364/6443/859.
|
| 275 |
+
|
| 276 |
+
Steven Kapturowski, Georg Ostrovski, John Quan, Remi Munos, and Will Dabney. Recurrent ´ Experience Replay in Distributed Reinforcement Learning. Int. Conf. Learn. Represent., 2019. URL https://openreview.net/pdf?id $=$ r1lyTjAqYX.
|
| 277 |
+
|
| 278 |
+
Diederik P. Kingma and Jimmy Lei Ba. Adam: A method for stochastic optimization. Int. Conf. Learn. Represent., 2015. URL https://arxiv.org/abs/1412.6980.
|
| 279 |
+
|
| 280 |
+
Sergey Levine. Reinforcement Learning and Control as Probabilistic Inference: Tutorial and Review. arXiv preprint, 2018. URL http://arxiv.org/abs/1805.00909.
|
| 281 |
+
|
| 282 |
+
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. arXiv preprint, 2015. URL http://arxiv.org/abs/1509.02971.
|
| 283 |
+
|
| 284 |
+
Shie Mannor, Reuven Y Rubinstein, and Yohai Gat. The cross entropy method for fast policy search. Proceedings of the 20th International Conference on Machine Learning, 2003. URL https://www.aaai.org/Papers/ICML/2003/ICML03-068.pdf.
|
| 285 |
+
|
| 286 |
+
Josh Merel, Leonard Hasenclever, Alexandre Galashov, Arun Ahuja, Vu Pham, Greg Wayne, Yee Whye Teh, and Nicolas Heess. Neural probabilistic motor primitives for humanoid control. arXiv preprint, 2018. URL http://arxiv.org/abs/1811.11711.
|
| 287 |
+
|
| 288 |
+
Josh Merel, Arun Ahuja, Vu Pham, Saran Tunyasuvunakool, Siqi Liu, Dhruva Tirumala, Nicolas Heess, and Greg Wayne. Hierarchical Visuomotor Control of Humanoids. Int. Conf. Learn. Represent., 2019. URL https://openreview.net/pdf?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BJfYvo09Y7.
|
| 289 |
+
|
| 290 |
+
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:529–533, 2015. URL http://dx.doi.org/10.1038/nature14236.
|
| 291 |
+
|
| 292 |
+
Volodymyr Mnih, Adria Puigdom \` enech Badia, Mehdi Mirza, Alex Graves, Tim Harley, Timothy P \` Lillicrap, David Silver, and Koray Kavukcuoglu. Asynchronous Methods for Deep Reinforcement Learning. arXiv:1602.01783, 2016. URL http://arxiv.org/abs/1602.01783.
|
| 293 |
+
|
| 294 |
+
Radford M. Neal and Geoffrey E. Hinton. A View of the EM Algorithm that Justifies Incremental, Sparse, and Other Variants. In M.I. Jordan (ed.), Learn. Graph. Model. NATO ASI Ser. vol. 89. Springer, Dordrecht, 1998.
|
| 295 |
+
|
| 296 |
+
Gerhard Neumann and Jan R. Peters. Fitted Q-iteration by Advantage Weighted Regression. Advances in Neural Information Processing Systems, 2009. URL http://papers.nips.cc/paper/ 3501-fitted-q-iteration-by-advantage-weighted-regression.pdf.
|
| 297 |
+
|
| 298 |
+
OpenAI. OpenAI Five, 2018a. URL https://openai.com/blog/openai-five/.
|
| 299 |
+
|
| 300 |
+
OpenAI. Learning Dexterity, 2018b. URL https://openai.com/blog/learningdexterity/.
|
| 301 |
+
|
| 302 |
+
Jan Peters, M Katharina, and Yasemin Altun. Relative Entropy Policy Search. ¨ Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, pp. 1607–1612, 2008.
|
| 303 |
+
|
| 304 |
+
Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. 2019. URL https: //d4mucfpksywv.cloudfront.net/better-language-models/language_ models_are_unsupervised_multitask_learners.pdf.
|
| 305 |
+
|
| 306 |
+
Simon Schmitt, Jonathan J. Hudson, Augustin Z´ıdek, Simon Osindero, Carl Doersch, Wojciech M. Czarnecki, Joel Z. Leibo, Heinrich Kuttler, Andrew Zisserman, Karen Simonyan, and S. M. Ali ¨ Eslami. Kickstarting Deep Reinforcement Learning. arXiv preprint, 2018. URL http://arxiv. org/abs/1803.03835.
|
| 307 |
+
|
| 308 |
+
Simon Schmitt, Matteo Hessel, and Karen Simonyan. Off-Policy Actor-Critic with Shared Experience Replay. arXiv preprint, 2019. URL https://arxiv.org/abs/1909.11583.
|
| 309 |
+
|
| 310 |
+
John Schulman, Sergey Levine, Philipp Moritz, Michael I. Jordan, and Pieter Abbeel. Trust Region Policy Optimization. arXiv preprint, 2015. URL http://arxiv.org/abs/1502.05477.
|
| 311 |
+
|
| 312 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint, 2017. URL http://arxiv.org/abs/1707.06347.
|
| 313 |
+
|
| 314 |
+
David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of Go with deep neural networks and tree search. Nature, 529:484–489, 2016. URL http://www. nature.com/doifinder/10.1038/nature16961.
|
| 315 |
+
|
| 316 |
+
David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy Lillicrap, Karen Simonyan, and Demis Hassabis. A general reinforcement learning algorithm that masters chess, shogi, and go through self-play. Science, 362:1140–1144, 2018. URL https://science. sciencemag.org/content/362/6419/1140.
|
| 317 |
+
|
| 318 |
+
Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. MIT Press, Cambridge, MA, 1998.
|
| 319 |
+
|
| 320 |
+
Richard S Sutton, David A. McAllester, Satinder P. Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In S. A. Solla, T. K. Leen, and K. Muller (eds.), ¨ Advances in Neural Information Processing Systems 12, pp. 1057– 1063. MIT Press, 2000. URL http://papers.nips.cc/paper/1713-policygradient-methods-for-reinforcement-learning-with-functionapproximation.pdf.
|
| 321 |
+
|
| 322 |
+
Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, Josh Merel, Andrew Lefrancq, Timothy P. Lillicrap, and Martin A. Riedmiller. DeepMind Control Suite. arXiv preprint, 2018. URL http://arxiv.org/abs/ 1801.00690.
|
| 323 |
+
|
| 324 |
+
Hado van Hasselt, Arthur Guez, Matteo Hessel, and David Silver. Learning functions across many orders of magnitudes. arXiv preprint, 2016. URL http://arxiv.org/abs/1602.07714.
|
| 325 |
+
|
| 326 |
+
Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michael Mathieu, Andrew Dudzik, Junyoung ¨ Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, Junhyuk Oh, Dan Horgan, Manuel Kroiss, Ivo Danihelka, Aja Huang, Laurent Sifre, Trevor Cai, John P Agapiou, Max Jaderberg, Alexander S Vezhnevets, Remi Leblond, Tobias Pohlen, Valentin Dalibard, David ´ Budden, Yury Sulsky, James Molloy, Tom L Paine, Caglar Gulcehre, Ziyu Wang, Tobias Pfaff, Yuhuai Wu, Roman Ring, Dani Yogatama, Dario Wunsch, Katrina McKinney, Oliver Smith, Tom ¨ Schaul, Timothy Lillicrap, Koray Kavukcuoglu, Demis Hassabis, Chris Apps, and David Silver. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 2019. URL http://doi.org/10.1038/s41586-019-1724-z.
|
| 327 |
+
|
| 328 |
+
Quan Vuong, Keith Ross, and Yiming Zhang. Supervised Policy Update for Deep Reinforcement Learning. arXiv preprint, 2019. URL http://arxiv.org/abs/1805.11706.
|
| 329 |
+
|
| 330 |
+
Ronald J. Williams. Simple statistical gradient-following methods for connectionist reinforcement learning. Mach. Learn., 8:229–256, 1992. URL http://dx.doi.org/10.1007/ BF00992696.
|
| 331 |
+
|
| 332 |
+
Cathy Wu, Aravind Rajeswaran, Yan Duan, Vikash Kumar, Alexandre M. Bayen, Sham Kakade, Igor Mordatch, and Pieter Abbeel. Variance reduction for policy gradient with action-dependent factorized baselines. arXiv preprint, 2018. URL http://arxiv.org/abs/1803.07246.
|
| 333 |
+
|
| 334 |
+
# A DERIVATION OF THE V-MPO TEMPERATURE LOSS
|
| 335 |
+
|
| 336 |
+
In this section we derive the E-step temperature loss in Eq. 22. To this end, we explicitly commit to the more specific improvement criterion in Eq. 5 by plugging into the original objective in Eq. 3. We seek $\psi ( s , a )$ that minimizes
|
| 337 |
+
|
| 338 |
+
$$
|
| 339 |
+
\begin{array} { r l r } { { \mathcal { I } ( \psi ( s , a ) ) = D _ { \mathrm { K L } } \big ( \psi ( s , a ) \| p _ { \theta _ { \mathrm { o l d } } } ( s , a | \mathcal { T } = 1 ) \big ) } } \\ & { } & { \propto - \displaystyle \sum _ { s , a } \psi ( s , a ) A ^ { \pi _ { \theta \mathrm { o l d } } } ( s , a ) + \eta \sum _ { s , a } \psi ( s , a ) \log \frac { \psi ( s , a ) } { p _ { \theta _ { \mathrm { o l d } } } ( s , a ) } + \lambda \sum _ { s , a } \psi ( s , a ) } \end{array}
|
| 340 |
+
$$
|
| 341 |
+
|
| 342 |
+
where $\lambda = \eta \log p _ { \theta _ { \mathrm { o l d } } } ( \mathbb { Z } = 1 )$ after multiplying through by $\eta$ , which up to this point in the derivation is given. We wish to automatically tune $\eta$ so as to enforce a bound $\epsilon _ { \eta }$ on the KL term $D _ { \mathrm { K L } } \big ( \psi ( s , a ) \| p _ { \theta _ { \mathrm { o l d } } } ( s , a ) \big )$ multiplying it in Eq. 16, in which case the temperature optimization can also be viewed as a nonparametric trust region for the variational distribution with respect to the old distribution. We therefore consider the constrained optimization problem
|
| 343 |
+
|
| 344 |
+
$$
|
| 345 |
+
\psi ( s , a ) = \arg \operatorname* { m a x } _ { \psi ( s , a ) } \sum _ { s , a } \psi ( s , a ) A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } ( s , a )
|
| 346 |
+
$$
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\mathrm { s . t . } \sum _ { s , a } \psi ( s , a ) \log \frac { \psi ( s , a ) } { p _ { \theta _ { \mathrm { o l d } } } ( s , a ) } < \epsilon _ { \eta } \mathrm { a n d } \sum _ { s , a } \psi ( s , a ) = 1 .
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
We can now use Lagrangian relaxation to transform the constrained optimization problem into one that maximizes the unconstrained objective
|
| 353 |
+
|
| 354 |
+
$$
|
| 355 |
+
\mathcal { I } ( \psi ( s , a ) , \eta , \lambda ) = \sum _ { s , a } \psi ( s , a ) A ^ { \pi _ { \theta a a } } ( s , a ) + \eta \left( \epsilon _ { \eta } - \sum _ { s , a } \psi ( s , a ) \log \frac { \psi ( s , a ) } { p _ { \theta _ { \theta a a } } ( s , a ) } \right) + \lambda \left( 1 - \sum _ { s , a } \psi ( s , a ) \right) .
|
| 356 |
+
$$
|
| 357 |
+
|
| 358 |
+
with $\eta \geq 0$ . (Note we are re-using the variables $\eta$ and $\lambda$ for the new optimization problem.) Differentiating $\mathcal { I }$ with respect to $\psi ( s , a )$ and setting equal to zero, we obtain
|
| 359 |
+
|
| 360 |
+
$$
|
| 361 |
+
\psi ( s , a ) = p _ { \theta _ { \mathrm { o l d } } } ( s , a ) \exp \bigg ( \frac { A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } ( s , a ) } { \eta } \bigg ) \exp \bigg ( - 1 - \frac { \lambda } { \eta } \bigg ) .
|
| 362 |
+
$$
|
| 363 |
+
|
| 364 |
+
Normalizing over $s , a$ (using the freedom given by $\lambda$ ) then gives
|
| 365 |
+
|
| 366 |
+
$$
|
| 367 |
+
\psi ( s , a ) = \frac { p _ { \theta _ { \mathrm { o l d } } } ( s , a ) \exp { \big ( \frac { A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } ( s , a ) } { \eta } \big ) } } { \sum _ { s , a } p _ { \theta _ { \mathrm { o l d } } } ( s , a ) \exp { \big ( \frac { A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } ( s , a ) } { \eta } \big ) } } ,
|
| 368 |
+
$$
|
| 369 |
+
|
| 370 |
+
which reproduces the general solution Eq. 4 for our specific choice of policy improvement in Eq. 5. However, the value of $\eta$ can now be found by optimizing the corresponding dual function. Plugging Eq. 21 into the unconstrained objective in Eq. 19 gives rise to the $\eta$ -dependent term
|
| 371 |
+
|
| 372 |
+
$$
|
| 373 |
+
\mathcal { L } _ { \eta } ( \eta ) = \eta \epsilon _ { \eta } + \eta \log \left[ \sum _ { s , a } p _ { \theta _ { \mathrm { o l d } } } ( s , a ) \exp \left( \frac { A ^ { \pi _ { \theta _ { \mathrm { o l d } } } } ( s , a ) } { \eta } \right) \right] .
|
| 374 |
+
$$
|
| 375 |
+
|
| 376 |
+
Replacing the expectation with samples from $p _ { \theta _ { \mathrm { o l d } } } ( s , a )$ in the batch of trajectories $\mathcal { D }$ leads to the loss in Eq. 13.
|
| 377 |
+
|
| 378 |
+
# B M-STEP KL CONSTRAINT
|
| 379 |
+
|
| 380 |
+
Here we give a somewhat more formal motivation for the prior $\log p ( \theta )$ . Consider a normal prior $\mathcal { N } ( \boldsymbol { \theta } ; \boldsymbol { \mu } , \bar { \Sigma } )$ with mean $\mu$ and covariance $\Sigma$ . We choose $\Sigma ^ { - 1 } \ : = \ : \alpha { \cal F } ( \theta _ { \mathrm { o l d } } )$ where $\alpha$ is a scaling parameter and $F ( \theta _ { \mathrm { o l d } } )$ is the Fisher information for $\pi _ { \theta ^ { \prime } } ( a | s )$ evaluated at $\theta ^ { \prime } = \theta _ { \mathrm { o l d } }$ . Then $\begin{array} { r } \log \bar { p } ( \theta ) \approx - \alpha \times \frac { 1 } { 2 } ( \dot { \theta } - \dot { \theta } _ { \mathrm { o l d } } ) ^ { T } F ( \theta _ { \mathrm { o l d } } ) ( \theta - \theta _ { \mathrm { o l d } } ) + \left\{ \begin{array} { l l } { \right. } \end{array} \end{array}$ {term independent of $\theta \}$ , where the first term is precisely the second-order approximation to the KL divergence $D _ { \mathrm { K L } } ( \theta _ { \mathrm { o l d } } \| \theta )$ . We now follow TRPO (Schulman et al., 2015) in heuristically approximating this as the state-averaged expression, $\mathbb { E } _ { s \sim p ( s ) } \big [ D _ { \mathrm { K L } } \big ( \pi _ { \theta _ { \mathrm { o l d } } } ( a | s ) \| \pi _ { \theta } ( a | s ) \big ) \big ]$ . We note that the KL divergence in either direction has the same second-order expansion, so our choice of $\mathrm { K L }$ is an empirical one (Abdolmaleki et al., 2018a).
|
| 381 |
+
|
| 382 |
+
# C DECOUPLED KL CONSTRAINTS FOR CONTINUOUS CONTROL
|
| 383 |
+
|
| 384 |
+
As in Abdolmaleki et al. (2018b), for continuous action spaces parametrized by Gaussian distributions we use decoupled KL constraints for the M-step. This uses the fact that the KL divergence between two $d$ -dimensional multivariate normal distributions with means $\mu _ { 1 } , \mu _ { 2 }$ and covariances $\Sigma _ { 1 } , \Sigma _ { 2 }$ can be written as
|
| 385 |
+
|
| 386 |
+
$$
|
| 387 |
+
D _ { \mathrm { K L } } \big ( \mathcal { N } ( \mu _ { 1 } , \Sigma _ { 1 } ) \| \mathcal { N } ( \mu _ { 2 } , \Sigma _ { 2 } ) \big ) = \frac { 1 } { 2 } \bigg [ ( \mu _ { 2 } - \mu _ { 1 } ) ^ { T } \Sigma _ { 1 } ^ { - 1 } ( \mu _ { 2 } - \mu _ { 1 } ) + \mathrm { T r } ( \Sigma _ { 2 } ^ { - 1 } \Sigma _ { 1 } ) - d + \log \frac { | \Sigma _ { 2 } | } { | \Sigma _ { 1 } | } \bigg ] ,
|
| 388 |
+
$$
|
| 389 |
+
|
| 390 |
+
where $| \cdot |$ is the matrix determinant. Since the first distribution and hence $\Sigma _ { 1 }$ in the $\mathrm { K L }$ divergence of Eq. 9 depends on the old target network parameters, we see that we can separate the overall KL divergence into a mean component and a covariance component:
|
| 391 |
+
|
| 392 |
+
$$
|
| 393 |
+
\begin{array} { r l } & { D _ { \mathrm { K L } } ^ { \mu } \big ( \pi _ { \theta _ { \mathrm { o l d } } } \| \pi _ { \theta } \big ) = \displaystyle \frac { 1 } { 2 } ( \mu _ { \theta } - \mu _ { \theta _ { \mathrm { o l d } } } ) ^ { T } \Sigma _ { \theta _ { \mathrm { o l d } } } ^ { - 1 } ( \mu _ { \theta } - \mu _ { \theta _ { \mathrm { o l d } } } ) , } \\ & { D _ { \mathrm { K L } } ^ { \Sigma } \big ( \pi _ { \theta _ { \mathrm { o l d } } } \| \pi _ { \theta } \big ) = \displaystyle \frac { 1 } { 2 } \bigg [ \operatorname { T r } ( \Sigma _ { \theta } ^ { - 1 } \Sigma _ { \theta _ { \mathrm { o l d } } } ) - d + \log \frac { \lvert \Sigma _ { \theta } \rvert } { \lvert \Sigma _ { \theta _ { \mathrm { o l d } } } \rvert } \bigg ] . } \end{array}
|
| 394 |
+
$$
|
| 395 |
+
|
| 396 |
+
With the replacement $D _ { \mathrm { K L } } \left( \pi _ { \theta _ { \mathrm { o l d } } } \| \pi _ { \theta } \right) \ \to \ D _ { \mathrm { K L } } ^ { C } \left( \pi _ { \theta _ { \mathrm { o l d } } } \| \pi _ { \theta } \right)$ for $C = \mu , \Sigma$ and corresponding $\alpha $ $\alpha _ { \mu } , ~ \alpha _ { \Sigma }$ , we obtain the total loss
|
| 397 |
+
|
| 398 |
+
$$
|
| 399 |
+
{ \mathcal { L } } _ { \mathrm { V \cdot M P O } } ( \theta , \eta , \alpha _ { \mu } , \alpha _ { \Sigma } ) = { \mathcal { L } } _ { \pi } ( \theta ) + { \mathcal { L } } _ { \eta } ( \eta ) + { \mathcal { L } } _ { \alpha _ { \mu } } ( \theta , \alpha _ { \mu } ) + { \mathcal { L } } _ { \alpha _ { \Sigma } } ( \theta , \alpha _ { \Sigma } ) ,
|
| 400 |
+
$$
|
| 401 |
+
|
| 402 |
+
where ${ \mathcal { L } } _ { \pi } ( \theta )$ and $\mathcal { L } _ { \eta } ( \eta )$ are the same as before. Note, however, that unlike in Abdolmaleki et al. (2018a) we do not decouple the policy loss.
|
| 403 |
+
|
| 404 |
+
We generally set $\epsilon _ { \Sigma }$ to be much smaller than $\epsilon _ { \mu }$ (see Table 7). Intuitively, this allows the policy to learn quickly in action space while preventing premature collapse of the policy, and, conversely, increasing “exploration” without moving in action space.
|
| 405 |
+
|
| 406 |
+
# D RELATION TO SUPERVISED POLICY UPDATE
|
| 407 |
+
|
| 408 |
+
Like V-MPO, Supervised Policy Update (SPU) (Vuong et al., 2019) adopts the strategy of first solving a nonparametric constrained optimization problem exactly, then fitting a neural network to the resulting solution via a supervised loss function. There is, however, an important difference from V-MPO, which we describe here.
|
| 409 |
+
|
| 410 |
+
In SPU, the KL loss, which is the sole loss in SPU, leads to a parametric optimization problem that is equivalent to the nonparametric optimization problem posed initially. To see this, we observe that the SPU loss seeks parameters (note the direction of the KL divergence)
|
| 411 |
+
|
| 412 |
+
$$
|
| 413 |
+
\begin{array} { l } { \displaystyle \theta ^ { * } = \arg \operatorname* { m i n } _ { \theta } \sum _ { s } d ^ { \pi _ { \theta _ { k } } } \left( s \right) D _ { \mathrm { K L } } \left( \pi _ { \theta } ( a | s ) \| \pi ^ { \lambda } ( a | s ) \right) } \\ { \displaystyle \quad = \arg \operatorname* { m i n } _ { \theta } \sum _ { s } d ^ { \pi _ { \theta _ { k } } } \left( s \right) \sum _ { a } \pi _ { \theta } ( a | s ) \log \left[ \frac { \pi _ { \theta } ( a | s ) } { \pi _ { \theta _ { k } } ( a | s ) \exp \big ( A ^ { \pi _ { \theta _ { k } } } \left( s , a \right) / \lambda \big ) / Z _ { \lambda } ( s ) } \right] } \\ { \displaystyle = \arg \operatorname* { m i n } _ { \theta } \sum _ { s } d ^ { \pi _ { \theta _ { k } } } \left( s \right) \sum _ { a } \left[ \pi _ { \theta } ( a | s ) \log \frac { \pi _ { \theta } ( a | s ) } { \pi _ { \theta _ { k } } ( a | s ) } - \frac { 1 } { \lambda } \pi _ { \theta } ( a | s ) A ^ { \pi _ { \theta _ { k } } } \left( s , a \right) \right] + \left\{ \mathrm { \ c o n s t a n t ~ t e r m s ~ } \right\} } \end{array}
|
| 414 |
+
$$
|
| 415 |
+
|
| 416 |
+
Multiplying by $\lambda$ since it can be treated as a constant up to this point, we then see that this corresponds exactly to the (Lagrangian form) of the problem
|
| 417 |
+
|
| 418 |
+
$$
|
| 419 |
+
\begin{array} { r l r } & { } & { \theta ^ { * } = \arg \underset { \theta } { \operatorname* { m a x } } \sum _ { s } d ^ { \pi _ { \theta _ { k } } } ( s ) \sum _ { a } \pi _ { \theta } ( a | s ) A ^ { \pi _ { \theta _ { k } } } ( s , a ) } \\ & { } & { \mathrm { s . t . } \sum _ { s } d ^ { \pi _ { \theta _ { k } } } ( s ) D _ { \mathrm { K L } } \big ( \pi _ { \theta } ( a | s ) \| \pi _ { \theta _ { k } } ( a | s ) \big ) < \epsilon , } \end{array}
|
| 420 |
+
$$
|
| 421 |
+
|
| 422 |
+
which is the original nonparametric problem posed in Vuong et al. (2019).
|
| 423 |
+
|
| 424 |
+
# E IMPORTANCE-WEIGHTING FOR OFF-POLICY CORRECTIONS
|
| 425 |
+
|
| 426 |
+
The network that generates the data may lag behind the target network in common distributed, asynchronous implementations (Espeholt et al., 2018). We can compensate for this by multiplying the exponentiated advantages by importance weights $\rho ( s , a )$ :
|
| 427 |
+
|
| 428 |
+
$$
|
| 429 |
+
\begin{array} { l } { { \displaystyle \psi ( s , a ) = \frac { \rho ( s , a ) p _ { \theta _ { \mathcal D } } ( s , a ) \exp \big ( \frac { A ^ { \pi _ { \theta _ { \mathcal D } } } ( s , a ) } { \eta } \big ) } { \sum _ { s , a } \rho ( s , a ) p _ { \theta _ { \mathcal D } } ( s , a ) \exp \big ( \frac { A ^ { \pi _ { \theta _ { \mathcal D } } } ( s , a ) } { \eta } \big ) } , } } \\ { { \displaystyle { \mathcal L } _ { \eta } ( \eta ) = \eta \epsilon _ { \eta } + \eta \log \Bigg [ \sum _ { s , a } \rho ( s , a ) p _ { \theta _ { \mathcal D } } ( s , a ) \exp \left( \frac { A ^ { \pi _ { \theta _ { \mathcal D } } } ( s , a ) } { \eta } \right) \Bigg ] , } } \end{array}
|
| 430 |
+
$$
|
| 431 |
+
|
| 432 |
+
where $\theta _ { \mathcal { D } }$ are the parameters of the behavior policy that generated $\mathcal { D }$ and which may be different from $\theta _ { \mathrm { t a r g e t } }$ . The clipped importance weights $\rho ( s , a )$ are given by
|
| 433 |
+
|
| 434 |
+
$$
|
| 435 |
+
\rho ( s , a ) = \operatorname* { m i n } \bigg ( 1 , \frac { \pi _ { \theta _ { \mathrm { o l d } } } ( a | s ) } { \pi _ { \theta _ { \mathcal { D } } } ( a | s ) } \bigg ) .
|
| 436 |
+
$$
|
| 437 |
+
|
| 438 |
+
As was the case with $\mathrm { V } .$ -trace for the value function, we did not find it necessary to use importance weighting and all experiments presented in this work did not use them for the sake of simplicity.
|
| 439 |
+
|
| 440 |
+
# F NETWORK ARCHITECTURE AND HYPERPARAMETERS
|
| 441 |
+
|
| 442 |
+
For DMLab the visual observations were $7 2 \times 9 6$ RGB images, while for Atari the observations were 4 stacked frames of $8 4 \times 8 4$ grayscale images. The ResNet used to process visual observations is similar to the 3-section ResNet used in Hessel et al. (2018), except the number of channels was multiplied by 4 in each section, so that the number of channels were (64, 128, 128) (Schmitt et al., 2019). For individual DMLab levels we used the same number of channels as Hessel et al. (2018), i.e., (16, 32, 32). Each section consisted of a convolution and $3 \times 3$ max-pooling operation (stride 2), followed by residual blocks of size 2, i.e., a convolution followed by a ReLU nonlinearity, repeated twice, and a skip connection from the input residual block input to the output. The entire stack was passed through one more ReLU nonlinearity. All convolutions had a kernel size of 3 and a stride of 1. For the humanoid control tasks from vision, the number of channels in each section were (16, 32, 32).
|
| 443 |
+
|
| 444 |
+
Since some of the levels in DMLab require simple language processing, for DMLab the agents contained an additional 256-unit LSTM receiving an embedding of hashed words as input. The output of the language LSTM was then concatenated with the output of the visual processing pathway as well as the previous reward and action, then fed to the main LSTM.
|
| 445 |
+
|
| 446 |
+
For multi-task DMLab we used a 3-layer LSTM, each with 256 units, and an unroll length of 95 with batch size 128. For the single-task setting we used a 2-layer LSTM. For multi-task Atari and the 56-dimensional humanoid-gaps control task a single 256-unit LSTM was used, while for the 22-dimensional humanoid-run task the core consisted only of a 2-layer MLP with 512 and 256 units (no LSTM). For single-task Atari a Transformer-XL was used in place of the LSTM. Note that we followed Radford et al. (2019) in placing the layer normalization on only the inputs to each sub-block. For Atari the unroll length was 63 with a batch size of 128. For both humanoid control tasks the batch size was 64, but the unroll length was 40 for the 22-dimensional humanoid and 63 for the 56-dimensional humanoid.
|
| 447 |
+
|
| 448 |
+
In all cases the policy logits (for discrete actions) and Gaussian distribution parameters (for continuous actions) consisted of a 256-unit MLP followed by a linear readout, and similarly for the value function. For discrete actions we initialized the linear policy layer with zero weights and biases to ensure a uniform policy at the start of training.
|
| 449 |
+
|
| 450 |
+
The initial values for the Lagrange multipliers in the V-MPO loss are given in Table 1
|
| 451 |
+
|
| 452 |
+
Implementation note. We implemented V-MPO in an actor-learner framework (Espeholt et al., 2018) that utilizes TF-Replicator (Buchlovsky et al., 2019) for distributed training on TPU 8-core and 16-core configurations (Google, 2018). One practical consequence of this is that a full batch of data $\mathcal { D }$ was in fact split into 8 or 16 minibatches, one per core/replica, and the overall result obtained by averaging the computations performed for each minibatch. More specifically, the determination of the highest advantages and the normalization of the nonparametric distribution, Eq. 12, is performed within minibatches. While it is possible to perform the full-batch computation by utilizing crossreplica communication, we found this to be unnecessary.
|
| 453 |
+
|
| 454 |
+
DMLab action set. Ignoring the “jump” and “crouch” actions which we do not use, an action in the native DMLab action space consists of 5 integers whose meaning and allowed values are given in Table 2. Following previous work on DMLab (Hessel et al., 2018), we used the reduced action set given in Table 3 with an action repeat of 4.
|
| 455 |
+
|
| 456 |
+
Table 1: Values for common V-MPO parameters.
|
| 457 |
+
|
| 458 |
+
<table><tr><td>HYPERPARAMETER</td><td colspan="3">VALUE</td></tr><tr><td></td><td>DMLab</td><td>Atari</td><td>Continuous control</td></tr><tr><td>Initial n</td><td>1.0</td><td>1.0</td><td>1.0</td></tr><tr><td>Initial α</td><td>5.0</td><td>5.0</td><td>-</td></tr><tr><td>Initial αμ</td><td>-</td><td>-</td><td>1.0</td></tr><tr><td>Initial αΣ</td><td>1</td><td>-</td><td>1.0</td></tr></table>
|
| 459 |
+
|
| 460 |
+
Table 2: Native action space for DMLab. See https://github.com/deepmind/lab/blob/ master/docs/users/actions.md for more details.
|
| 461 |
+
|
| 462 |
+
<table><tr><td>ACTIONNAME</td><td>RANGE</td></tr><tr><td>LOOK_LEFT_RIGHT_PIXELS_PER_FRAME</td><td>[-512, 512]</td></tr><tr><td>LOOK_DOWN_UP_PIXELS_PER_FRAME</td><td>[-512, 512]</td></tr><tr><td>STRAFE_LEFT_RIGHT</td><td>[-1,1]</td></tr><tr><td>MOVE_BACK_FORWARD</td><td>[-1, 1]</td></tr><tr><td>FIRE</td><td>[0,1]</td></tr></table>
|
| 463 |
+
|
| 464 |
+
Table 3: Reduced action set for DMLab from Hessel et al. (2018).
|
| 465 |
+
|
| 466 |
+
<table><tr><td>ACTION</td><td>NATIVE DMLAB ACTION</td></tr><tr><td>Forward (FW)</td><td>[ 0, 0, 0,</td></tr><tr><td>Backward (BW)</td><td>1, [ 0, 0, 0, -1,</td></tr><tr><td>Strafe left</td><td>0, 0, -1, 0,</td></tr><tr><td>Strafe right</td><td>0, 0, 1,</td></tr><tr><td>Small look left (LL)</td><td>[-10, 0, 0,</td></tr><tr><td>Small look right (LR)</td><td>[10, 0,</td></tr><tr><td>Large look left (LL)</td><td>[-60, 0,</td></tr><tr><td>Large look right (LR)</td><td>0, [60, 0, 0,</td></tr><tr><td>Look down</td><td>0, 10,</td></tr><tr><td>Look up</td><td>0, -10,</td></tr><tr><td>FW + small LL</td><td>0,</td></tr><tr><td>FW+ small LR</td><td>[-10, [10,</td></tr><tr><td>FW + large LL</td><td>0, [-60,</td></tr><tr><td>FW + large LR</td><td>0, [60,</td></tr><tr><td></td><td>0, 0, 0,</td></tr><tr><td>Fire</td><td>[0, 0,</td></tr></table>
|
| 467 |
+
|
| 468 |
+
Table 4: Multi-task Atari-57 scores by level after 11.4B total (200M per level) environment frames. All entries show mean $\pm$ standard deviation. Data for IMPALA (“PopArt-IMPALA”) was obtained from the authors of Hessel et al. (2018). Human-normalized scores are calculated as $( E - R ) / ( H - R ) { \times } 1 0 0$ , where $E$ is the episode reward, $R$ the episode reward obtained by a random agent, and $H$ is the episode reward obtained by a human. 18
|
| 469 |
+
|
| 470 |
+
<table><tr><td colspan="6">LEVEL NAME EPISODE REWARD HUMAN-NORMALIZED</td></tr><tr><td></td><td>IMPALA</td><td>V-MPO</td><td>IMPALA</td><td></td><td>V-MPO</td></tr><tr><td>alien</td><td>1163.00 ± 148.43</td><td>2332.00 ± 290.16</td><td>13.55 ± 2.15</td><td></td><td>30.50 ± 4.21</td></tr><tr><td>amidar</td><td>192.50 ± 9.16</td><td>423.60± 20.53</td><td>10.89 ± 0.53</td><td></td><td>24.38 ± 1.20</td></tr><tr><td>assault</td><td>4215.30 ± 294.51</td><td>1225.90 ± 60.64</td><td>768.46± 56.68</td><td></td><td>193.13 ± 11.67</td></tr><tr><td>asterix</td><td>4180.00 ± 303.91</td><td>9955.00 ± 2043.48</td><td>47.87 ± 3.66</td><td></td><td>117.50 ± 24.64</td></tr><tr><td>asteroids</td><td>3473.00 ± 381.30</td><td>2982.00 ± 164.35</td><td>5.90 ± 0.82</td><td></td><td>4.85 ± 0.35</td></tr><tr><td>atlantis</td><td>997530.00 ± 3552.89</td><td>940310.00 ± 6085.96</td><td>6086.50 ± 21.96</td><td></td><td>5732.81 ± 37.62</td></tr><tr><td>bank_heist</td><td>1329.00 ± 2.21</td><td>1563.00 ± 15.81</td><td>177.94 ± 0.30</td><td></td><td>209.61 ± 2.14</td></tr><tr><td>battle_zone</td><td>43900.00 ± 4738.04</td><td>61400.00 ± 5958.52</td><td>119.27 ± 13.60</td><td></td><td>169.52 ± 17.11</td></tr><tr><td>beam_rider</td><td>4598.00 ± 618.09</td><td>3868.20 ± 666.55</td><td>25.56± 3.73</td><td></td><td>21.16 ± 4.02</td></tr><tr><td>berzerk</td><td>1018.00 ± 72.63</td><td>1424.00 ± 150.93</td><td>35.68 ± 2.90</td><td></td><td>51.87 ± 6.02</td></tr><tr><td>bowling</td><td>63.60 ± 0.84</td><td>27.60 ± 0.62</td><td>29.43 ± 0.61</td><td></td><td>3.27 ± 0.45</td></tr><tr><td>boxing</td><td>93.10 ± 0.94</td><td>100.00 ± 0.00</td><td>775.00 ± 7.86</td><td></td><td>832.50 ± 0.00</td></tr><tr><td>breakout</td><td>484.30 ± 57.24</td><td>400.70 ±18.82</td><td>1675.69 ± 198.77</td><td></td><td>1385.42 ± 65.36</td></tr><tr><td>centipede</td><td>6037.90 ± 994.99</td><td>3015.00 ± 404.97</td><td>39.76 ± 10.02</td><td></td><td>9.31 ± 4.08</td></tr><tr><td>chopper_command</td><td>4250.00 ± 417.91</td><td>4340.00 ± 714.45</td><td>52.29 ± 6.35</td><td></td><td>53.66 ± 10.86</td></tr><tr><td>crazy_climber</td><td>100440.00 ± 9421.56</td><td>116760.00 ± 5312.12</td><td>357.94 ± 37.61</td><td></td><td>423.09 ± 21.21</td></tr><tr><td>defender</td><td>41585.00 ± 4194.42</td><td>98395.00 ± 17552.17</td><td>244.78 ± 26.52</td><td></td><td>604.01 ± 110.99</td></tr><tr><td>demon_attack</td><td>77880.00 ± 8798.44</td><td>20243.00 ± 5434.41</td><td>4273.35 ± 483.72</td><td></td><td>1104.56 ± 298.77</td></tr><tr><td>double_dunk</td><td>-0.80 ± 0.31</td><td>12.60 ± 1.94</td><td>809.09 ± 14.08</td><td></td><td>1418.18 ± 88.19</td></tr><tr><td>enduro</td><td>1187.90 ± 76.10</td><td>1453.80 ± 104.37</td><td></td><td>138.05 ± 8.84</td><td>168.95 ± 12.13</td></tr><tr><td>fishing_derby</td><td>21.60 ± 3.46</td><td>33.80 ± 2.10</td><td></td><td>213.77 ± 6.54</td><td>236.79 ± 3.96</td></tr><tr><td>freeway</td><td>32.10 ± 0.17</td><td>33.20 ±0.28</td><td></td><td>108.45 ± 0.58</td><td>112.16 ± 0.93</td></tr><tr><td>frostbite</td><td>250.00 ± 0.00</td><td>260.00 ± 0.00</td><td>4.33 ± 0.00</td><td></td><td>4.56± 0.00</td></tr><tr><td>gopher</td><td>11720.00 ± 1687.71</td><td>7576.00 ± 973.13</td><td></td><td>531.92 ± 78.32</td><td>339.62 ± 45.16</td></tr><tr><td>gravitar</td><td>1095.00 ± 232.75</td><td>3125.00 ± 191.87</td><td></td><td>29.01 ± 7.32</td><td>92.88 ± 6.04</td></tr><tr><td>hero</td><td>13159.50 ± 68.90</td><td>29196.50 ± 752.06</td><td></td><td>40.71 ± 0.23</td><td>94.53 ± 2.52</td></tr><tr><td>ice_hockey</td><td>4.80 ± 1.31</td><td>10.60 ± 2.00</td><td></td><td>132.23 ± 10.83</td><td>180.17 ± 16.50</td></tr><tr><td> jamesbond</td><td>1015.00 ± 91.39</td><td>3805.00 ± 595.92</td><td></td><td>360.12 ± 33.38</td><td>1379.11 ± 217.65</td></tr><tr><td>kangaroo</td><td>1780.00 ± 18.97</td><td>12790.00 ± 629.52</td><td></td><td>57.93 ± 0.64</td><td>427.02 ± 21.10</td></tr><tr><td>krull</td><td>9738.00 ± 360.95</td><td>7359.00 ± 1064.84</td><td></td><td>762.53 ± 33.81</td><td>539.67 ± 99.75</td></tr><tr><td>kung_fu_master</td><td>44340.00 ± 2898.70 0.00 ± 0.00</td><td>38620.00 ± 2346.48</td><td></td><td>196.11 ± 12.90</td><td>170.66 ± 10.44</td></tr><tr><td>montezuma_revenge</td><td>1953.00 ± 227.12</td><td>0.00 ± 0.00</td><td></td><td>0.00 ±0.00</td><td>0.00± 0.00</td></tr><tr><td>ms_pacman</td><td>5708.00 ± 354.92</td><td>2856.00 ± 324.54</td><td></td><td>24.77 ± 3.42</td><td>38.36 ± 4.88</td></tr><tr><td>name_this_game</td><td>37030.00 ± 6415.95</td><td>9295.00 ± 679.83</td><td></td><td>59.33 ± 6.17</td><td>121.64 ± 11.81</td></tr><tr><td>phoenix</td><td>-4.90 ± 2.34</td><td>19560.00 ± 1843.44</td><td></td><td>559.60 ± 98.99</td><td>290.05 ± 28.44</td></tr><tr><td>pitfall</td><td>20.80 ± 0.19</td><td>-2.80 ± 1.40</td><td></td><td>3.35 ± 0.04</td><td>3.39±0.02</td></tr><tr><td>pong</td><td>100.00 ± 0.00</td><td>21.00 ± 0.00</td><td></td><td>117.56 ± 0.54</td><td>118.13 ± 0.00</td></tr><tr><td>private_eye</td><td>5512.50 ± 741.08</td><td>100.00 ± 0.00</td><td></td><td>0.11 ± 0.00</td><td>0.11 ± 0.00</td></tr><tr><td>qbert</td><td>8237.00 ± 97.09</td><td>15297.50 ± 1244.47</td><td></td><td>40.24 ± 5.58</td><td>113.86 ± 9.36</td></tr><tr><td>riverraid</td><td></td><td>11160.00 ± 733.06</td><td></td><td>43.72 ± 0.62</td><td>62.24± 4.65</td></tr><tr><td>road_runner</td><td>28440.00 ± 1215.99</td><td>51060.00 ± 1560.72</td><td></td><td>362.91 ± 15.52</td><td>651.67 ± 19.92</td></tr><tr><td>robotank</td><td>29.60 ± 2.15</td><td>46.80 ± 3.42</td><td></td><td>282.47 ± 22.22</td><td>459.79 ± 35.29</td></tr><tr><td>seaquest</td><td>1888.00 ± 63.26</td><td>9953.00 ± 973.02</td><td></td><td>4.33 ± 0.15</td><td>23.54± 2.32</td></tr><tr><td>skiing</td><td>-16244.00 ± 592.28 1794.00 ± 279.04</td><td>-15438.10 ± 1573.39</td><td></td><td>6.69 ± 4.64</td><td>13.01 ± 12.33</td></tr><tr><td>solaris</td><td>793.50 ± 90.61</td><td>2194.00 ± 417.91</td><td></td><td>5.03 ± 2.52</td><td>8.64 ± 3.77</td></tr><tr><td>space_invaders</td><td>44860.00 ± 5157.74</td><td>1771.50 ± 201.95</td><td></td><td>42.45 ± 5.96</td><td>106.76 ± 13.28</td></tr><tr><td>star-gunner</td><td></td><td>60120.00 ± 1953.60</td><td></td><td>461.05 ± 53.80</td><td>620.24 ± 20.38</td></tr><tr><td>surround</td><td>2.50 ± 1.04</td><td>4.00 ± 0.62</td><td></td><td>75.76 ± 6.31</td><td>84.85 ± 3.74</td></tr><tr><td>tennis</td><td>-0.10 ± 0.09</td><td>23.10 ± 0.26</td><td></td><td>152.90 ± 0.61</td><td>302.58 ± 1.69</td></tr><tr><td>time_pilot</td><td>10890.00 ± 787.46</td><td>22330.00 ± 2443.11</td><td></td><td>440.77 ± 47.40</td><td>1129.42 ± 147.07</td></tr><tr><td>tutankham</td><td>218.50 ± 13.53</td><td>254.60 ± 9.99</td><td></td><td>132.59 ± 8.66</td><td>155.70 ± 6.40</td></tr><tr><td>up_n_down</td><td>175083.00 ± 16341.05</td><td>82913.00 ± 12142.08</td><td></td><td>1564.09 ± 146.43</td><td>738.18 ±108.80</td></tr><tr><td>venture</td><td>0.00 ±0.00</td><td>0.00 ± 0.00</td><td></td><td>0.00±0.00</td><td>0.00 ± 0.00</td></tr><tr><td>video_pinball</td><td>59898.40 ± 23875.14</td><td>198845.20 ± 98768.54</td><td></td><td>339.02 ± 135.13</td><td>1125.46 ± 559.03</td></tr><tr><td>wizard_of_wor</td><td>6960.00 ± 1730.97</td><td>7890.00 ± 1595.77</td><td></td><td>152.55 ± 41.28</td><td>174.73 ± 38.06</td></tr><tr><td>yars_revenge</td><td>12825.70 ± 2065.90</td><td>41271.70 ± 4726.72</td><td></td><td>18.90 ± 4.01</td><td>74.16 ± 9.18</td></tr><tr><td>zaxxon</td><td>11520.00 ± 646.81</td><td>18820.00 ± 754.69</td><td></td><td>125.67 ± 7.08</td><td>205.53 ± 8.26</td></tr><tr><td>Median</td><td></td><td></td><td></td><td>117.56</td><td>155.70</td></tr></table>
|
| 471 |
+
|
| 472 |
+
Table 5: Settings for DMLab.
|
| 473 |
+
|
| 474 |
+
<table><tr><td>SETTING</td><td>SINGLE-TASK MULTI-TASK</td></tr><tr><td>Agent discount</td><td>0.99</td></tr><tr><td>Image height</td><td>72</td></tr><tr><td>Image width</td><td>96</td></tr><tr><td>Number of action repeats</td><td>4</td></tr><tr><td>Number of LSTMlayers</td><td>2 3</td></tr><tr><td>Pixel-control cost</td><td>2 ×10-3</td></tr><tr><td>Ttarget</td><td>10</td></tr><tr><td>En</td><td>0.1 0.5</td></tr><tr><td>Eα (log-uniform)</td><td>[0.001,0.01) [0.01, 0.1)</td></tr></table>
|
| 475 |
+
|
| 476 |
+
<table><tr><td>SETTING</td><td>SINGLE-TASK</td><td>MULTI-TASK</td></tr><tr><td>Environment discount on end of life</td><td>1</td><td>0</td></tr><tr><td>Agent discount</td><td>0.997</td><td>0.99</td></tr><tr><td>Clipped reward range</td><td>no clipping</td><td>[-1,1]</td></tr><tr><td>Max episode length</td><td>30 mins (108.000 frames)</td><td></td></tr><tr><td>Image height</td><td colspan="2">84</td></tr><tr><td>Image width</td><td colspan="2">84</td></tr><tr><td>Grayscale</td><td colspan="2">True</td></tr><tr><td>Number of stacked frames</td><td colspan="2">4</td></tr><tr><td>Number of action repeats</td><td colspan="2">4</td></tr><tr><td>TrXL: Key/Value size</td><td>32</td><td></td></tr><tr><td>TrXL:Number of heads</td><td>8</td><td></td></tr><tr><td>TrXL:Number of layers</td><td>8</td><td></td></tr><tr><td>TrXL:MLP size</td><td>512</td><td></td></tr><tr><td>Ttarget</td><td colspan="2">1000</td></tr><tr><td>En</td><td colspan="2">100 1×10-1</td></tr><tr><td>Eα (log-uniform)</td><td colspan="2">[0.005,0.01) [0.001,0.01)</td></tr></table>
|
| 477 |
+
|
| 478 |
+
Table 6: Settings for Atari. TrXL: Transformer-XL.
|
| 479 |
+
|
| 480 |
+
<table><tr><td>SETTING</td><td>HUMANOID-PIXELS</td><td>HUMANOID-STATE</td><td>OPENAI GYM</td></tr><tr><td>Agent discount</td><td></td><td>0.99</td><td></td></tr><tr><td>Unroll length</td><td>63</td><td>63</td><td>39</td></tr><tr><td>Image height</td><td>64</td><td>:</td><td>·</td></tr><tr><td>Image width</td><td>64</td><td>:</td><td>·</td></tr><tr><td>Target update period</td><td></td><td>100</td><td></td></tr><tr><td>En</td><td>0.1</td><td colspan="2">0.01</td></tr><tr><td>Eαμ (log-uniform)</td><td>[0.01, 1.0)</td><td>[0.05,0.5]</td><td>[0.005,0.01]</td></tr><tr><td>Eα (log-uniform)</td><td>[5 × 10-6,5 × 10-5)</td><td>[10−5,5 × 10-5)</td><td>[5 × 10-6, 5 × 10-5)</td></tr></table>
|
| 481 |
+
|
| 482 |
+
Table 7: Settings for continuous control. For the humanoid gaps task from pixels the physics time step was $5 \mathrm { m s }$ and the control time step $3 0 \mathrm { m s }$ .
|
| 483 |
+
|
| 484 |
+

|
| 485 |
+
Figure 6: Multi-task Atari-57 with population-based training (PBT) (Jaderberg et al., 2017a). All settings of the PBT experiment were the same as without except the learning rates were also sampled log-uniformly from $[ \dot { 8 } \times 1 0 ^ { - 5 }$ , $3 \times 1 0 ^ { - 4 } )$ and $\epsilon _ { \eta }$ from [0.05, 0.5). Along with $\epsilon _ { \alpha }$ sampled loguniformly from [0.001, 0.01) as in the original experiment, hyperparameters were evolved via copy and mutation operators roughly once every $4 \times 1 0 ^ { 8 }$ environment frames.
|
| 486 |
+
|
| 487 |
+

|
| 488 |
+
Figure 7: KL constraints during optimization for the Seaquest example in Fig. 4c. Values are subsampled but not smoothed to show the variability.
|
| 489 |
+
|
| 490 |
+

|
| 491 |
+
Figure 8: Same as Fig. 4c (Atari Seaquest), but trained with uniform weights on the top $50 \%$ of advantages.
|
| 492 |
+
|
| 493 |
+

|
| 494 |
+
Figure 9: Same as Fig. 2a (multi-task DMLab-30), but trained without top- $k$ , i.e., all advantages are used in the E-step. Note the small dip in the middle is due to a pause in the experiment and resetting of the human-normalized scores.
|
| 495 |
+
|
| 496 |
+

|
| 497 |
+
Figure 10: Example frame from the humanoid gaps task, with the agent’s $6 4 \times 6 4$ first-person view on the right. The proprioceptive information provided to the agent in addition to the primary pixel observation consisted of joint angles and velocities, root-to-end-effector vectors, root-frame velocity, rotational velocity, root-frame acceleration, and the 3D orientation relative to the $z$ -axis.
|
| 498 |
+
|
| 499 |
+

|
| 500 |
+
Figure 11: 17-dimensional Humanoid-V1 task in OpenAI Gym.
|
md/train/SywMS6ZfM/SywMS6ZfM.md
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DISTRIBUTIONAL INCLUSION VECTOR EMBEDDING FOR UNSUPERVISED HYPERNYMY DETECTION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Modeling hypernymy, such as poodle is-a dog, is an important generalization aid to many NLP tasks, such as entailment, relation extraction, and question answering. Supervised learning from labeled hypernym sources, such as WordNet, limit the coverage of these models, which can be addressed by learning hypernyms from unlabeled text. Existing unsupervised methods either do not scale to large vocabularies or yield unacceptably poor accuracy. This paper introduces distributional inclusion vector embedding (DIVE), a simple-to-implement unsupervised method of hypernym discovery via per-word non-negative vector embeddings which preserve the inclusion property of word contexts. In experimental evaluations more comprehensive than any previous literature of which we are aware—evaluating on 11 datasets using multiple existing as well as newly proposed scoring functions— we find that our method provides up to double the precision of previous unsupervised methods, and the highest average performance, using a much more compact word representation, and yielding many new state-of-the-art results. In addition, the meaning of each dimension in DIVE is interpretable, which leads to a novel approach on word sense disambiguation as another promising application of DIVE.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Numerous applications benefit from compactly representing context distributions, which assign meaning to objects under the rubric of distributional semantics. In natural language processing, distributional semantics has long been used to assign meanings to words (that is, to lexemes in the dictionary, not individual instances of word tokens). The meaning of a word in the distributional sense is often taken to be the set of textual contexts (nearby tokens) in which that word appears, represented as a large sparse bag of words (SBOW). Without any supervision, word2vec (Mikolov et al., 2013), among other approaches based on matrix factorization (Levy et al., 2015a), successfully compress the SBOW into a much lower dimensional embedding space, increasing the scalability and applicability of the embeddings while preserving (or even improving) the correlation of geometric embedding similarities with human word similarity judgments.
|
| 12 |
+
|
| 13 |
+
While embedding models have achieved impressive results, context distributions capture more semantic features than just word similarity. The distributional inclusion hypothesis (DIH) (Weeds & Weir, 2003; Geffet & Dagan, 2005; Cimiano et al., 2005) posits that the context set of a word tends to be a subset of the contexts of its hypernyms. For a concrete example, most adjectives that can be applied to poodle can also be applied to dog, because dog is a hypernym of poodle. For instance, both can be obedient. However, the converse is not necessarily true — a dog can be straight-haired but a poodle cannot. Therefore, dog tends to have a broader context set than poodle. Many asymmetric scoring functions comparing SBOW based on DIH have been developed for automatic hypernymy detection (Weeds & Weir, 2003; Geffet & Dagan, 2005; Santus et al., 2017).
|
| 14 |
+
|
| 15 |
+
Hypernymy detection plays a key role in many challenging NLP tasks, such as textual entailment (Sammons et al., 2011), coreference (Ponzetto & Strube, 2006), relation extraction (Demeester et al., 2016) and question answering (Huang et al., 2008). Leveraging the variety of contexts and inclusion properties in context distributions can greatly increase the ability to discover taxonomic structure among words (Santus et al., 2017). The inability to preserve these features limits the semantic representation power and downstream applicability of some popular existing unsupervised learning approaches such as word2vec.
|
| 16 |
+
|
| 17 |
+
Several recently proposed methods aim to encode hypernym relations between words in dense embeddings, such as Gaussian embedding (Vilnis & McCallum, 2015; Athiwaratkun & Wilson, 2017), order embedding (Vendrov et al., 2016), H-feature detector (Roller & Erk, 2016), HyperScore (Nguyen et al., 2017), dual tensor (Glavas & Ponzetto, 2017), Poincar ˇ e embedding (Nickel ´ & Kiela, 2017), and LEAR (Vulic & Mrk ´ siˇ c, 2017). However, the methods focus on supervised ´ or semi-supervised setting (Vendrov et al., 2016; Roller & Erk, 2016; Nguyen et al., 2017; Glavasˇ & Ponzetto, 2017; Vulic & Mrk ´ siˇ c, 2017), do not learn from raw text (Nickel & Kiela, 2017) or ´ lack comprehensive experiments on the hypernym detection task (Vilnis & McCallum, 2015; Athiwaratkun & Wilson, 2017).
|
| 18 |
+
|
| 19 |
+
Recent studies (Levy et al., 2015b; Santus et al., 2017) have underscored the difficulty of generalizing supervised hypernymy annotations to unseen pairs — classifiers often effectively memorize prototypical hypernyms (‘general’ words) and ignore relations between words. These findings motivate us to develop more accurate and scalable unsupervised embeddings to detect hypernymy and propose several scoring functions to analyze the embeddings from different perspectives.
|
| 20 |
+
|
| 21 |
+
# 1.1 CONTRIBUTIONS
|
| 22 |
+
|
| 23 |
+
• A novel unsupervised low-dimensional embedding method to model inclusion relations among word contexts via performing non-negative matrix factorization (NMF) on a weighted PMI matrix, which can be efficiently optimized using modified skip-grams. Several new asymmetric comparison functions to measure inclusion and generality properties and to evaluate different aspects of unsupervised embeddings. Extensive experiments on 11 datasets demonstrate the learned embeddings and comparison functions achieve state-of-the-art performances on unsupervised hypernym detection while requiring much less memory and compute than approaches based on the full SBOW. • A qualitative experiment illustrates DIVE can be used to solve word sense disambiguation, especially when efficiently modeling word senses at multiple granularities is desirable.
|
| 24 |
+
|
| 25 |
+
# 2 METHOD
|
| 26 |
+
|
| 27 |
+
The distributional inclusion hypothesis (DIH) suggests that the context set of a hypernym tends to contain the context set of its hyponyms. That is, when representing a word as the counts of contextual co-occurrences, the count in every dimension of hypernym $y$ tends to be larger than or equal to the corresponding count of its hyponym $x$ :
|
| 28 |
+
|
| 29 |
+
$$
|
| 30 |
+
x \preceq y \iff \forall c \in V , \# ( x , c ) \leq \# ( y , c ) ,
|
| 31 |
+
$$
|
| 32 |
+
|
| 33 |
+
where $x \preceq y$ means $y$ is a hypernym of $x , V$ is the set of vocabulary, and $\# ( x , c )$ indicates the number of times that word $x$ and its context word $c$ co-occur in a small window with size $| W |$ in corpus $D$ .
|
| 34 |
+
|
| 35 |
+
Our goal is to produce lower-dimensional embeddings that preserve the inclusion property that the embedding of hypernym $y$ is larger than or equal to the embedding of its hyponym $x$ in every dimension. Formally, the desirable property can be written as
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
x \preceq y \iff \mathbf { x } [ i ] \leq \mathbf { y } [ i ] , \forall i \in \{ 1 , . . . , d _ { 0 } \} ,
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+
where $d _ { 0 }$ is number of dimensions in the embedding space. We add additional non-negativity constraints, i.e. $x [ i ] \ge 0 , y [ i ] \ge 0 , \forall i$ , in order to increase the interpretability of the embeddings (the reason will be explained later in this section).
|
| 42 |
+
|
| 43 |
+
This is a challenging task. In reality, there are a lot of noise and systematic biases which cause the violation of DIH in Equation (1) (i.e. $\# ( x , c ) > \# ( y , c )$ for some neighboring word $c$ ), but the general trend can be discovered by processing several thousands of neighboring words in SBOW together. After the compression, the same trend has to be estimated in a much smaller embedding space which discards most of the information in SBOW, so it is not surprising to see most of the unsupervised hypernymy detection studies use SBOW (Santus et al., 2017) and the existing unsupervised embeddings like Gaussian embedding have degraded accuracy (Vulic et al., 2016). ´
|
| 44 |
+
|
| 45 |
+
# 2.1 INCLUSION PRESERVING MATRIX FACTORIZATION
|
| 46 |
+
|
| 47 |
+
Popular methods of unsupervised word embedding are usually based on matrix factorization (Levy et al., 2015a). The approaches first compute a co-occurrence statistic between the wth word and the cth context word as the $( w , c )$ th element of the matrix $M [ w , c ]$ . Next, the matrix $M$ is factorized such that $M [ w , c ] \approx \mathbf { w } ^ { T } \mathbf { \dot { c } }$ , where w is the low dimension embedding of $w$ th word and $\mathbf { c }$ is the cth context embedding.
|
| 48 |
+
|
| 49 |
+
The statistic in $M [ w , c ]$ is usually related to pointwise mutual information: $P M I ( w , c ) ~ =$ $\textstyle \log ( { \frac { P ( w , c ) } { P ( w ) \cdot P ( c ) } } )$ , where $\begin{array} { r } { P ( w , c ) = \frac { \# ( w , c ) } { | D | } } \end{array}$ , $| D | = \sum _ { w \in V } \sum _ { c \in V } \# ( w , c )$ is number of co-occurrence word pairs in the corpus, $\begin{array} { r } { P ( w ) = \frac { \# ( w ) } { | D | } } \end{array}$ , $\# ( w ) = \sum _ { c \in V } \# ( w , c )$ is the frequency of the word $w$ times the window size $| W |$ , and similarly for $P ( c )$ . For example, $M [ w , c ]$ could be set as positive PMI (PPMI), $\operatorname* { m a x } ( P M I ( w , c ) , 0 )$ , or shifted PMI, $P M I ( w , c ) - \log ( k )$ , like skip-grams with negative sampling (SGNS) (Levy et al., 2015a). Intuitively, since $\dot { M } [ w , \bar { c ] } \approx \mathbf { w } ^ { T } \mathbf { c }$ , larger embedding values of w at every dimension seems to imply larger $\mathbf { \bar { w } } ^ { T } \mathbf { c }$ , larger $M [ w , c ]$ , larger $\bar { P } M I ( w , c )$ , and thus larger co-occurrence count $\# ( w , c )$ . However, the derivation has two flaws: (1) c could be negative and (2) lower $\# ( w , c )$ could still lead to larger $P M I ( w , c )$ as long as the $\# ( w )$ is small enough.
|
| 50 |
+
|
| 51 |
+
To preserve DIH, we propose a novel word embedding method, distributional inclusion vector embedding $( D I V E )$ , which fixes the two flaws by performing non-negative factorization (NMF) on the matrix $M$ , where
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
M [ w , c ] = \log ( \frac { P ( w , c ) } { P ( w ) \cdot P ( c ) } \cdot \frac { \# ( w ) } { k \cdot Z } ) = \log ( \frac { \# ( w , c ) | V | } { \# ( c ) k } ) ,
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where $k$ is a constant which shifts PMI value like SGNS, $\begin{array} { r } { Z = \frac { | D | } { | V | } } \end{array}$ is the average word frequency, and $| V |$ is the vocabulary size.
|
| 58 |
+
|
| 59 |
+
The design encourages the inclusion property in DIVE (i.e. Equation (2)) to be satisfied because the property implies that Equation (1) (DIH) holds if the matrix is reconstructed perfectly. The derivation is simple: Since context vector c is non-negative, if the embedding of hypernym $\mathbf { y }$ is greater than or equal to the embedding of its hyponym $\mathbf { X }$ in every dimension, $\mathbf { \bar { x } } ^ { T } \mathbf { c } \leq \mathbf { y } ^ { T } \mathbf { c }$ . Then, $\mathbf { \bar { \boldsymbol { M } } } [ \boldsymbol { x } , \boldsymbol { c } ] \le M [ \boldsymbol { y } , \boldsymbol { \bar { c } } ]$ tends to be true because $\mathbf { w } ^ { \hat { T } } \mathbf { c } \ \tilde { \approx } \ M [ w , c ]$ . This leads to $\# ( x , c ) \leq \# ( y , c )$ because M [w, c] = log( #(w,c)|V |#(c)k ) and only $\# ( w , c )$ change with $w$ .
|
| 60 |
+
|
| 61 |
+
# 2.2 OPTIMIZATION
|
| 62 |
+
|
| 63 |
+
Due to its appealing scalability properties during training time (Levy et al., 2015a), we optimize our embedding based on the skip-gram with negative sampling (SGNS) (Mikolov et al., 2013). The objective function of SGNS is
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
l _ { S G N S } = \sum _ { w \in V } \sum _ { c \in V } \# ( w , c ) \log \sigma ( \mathbf { w } ^ { T } \mathbf { c } ) \ + \ \sum _ { w \in V } k ^ { \prime } \sum _ { c \in V } \# ( w , c ) \operatorname { \mathbb { E } } _ { c _ { N } \sim P _ { D } } [ \log \sigma ( - \mathbf { w } ^ { T } \mathbf { c } _ { \mathbf { N } } ) ] ,
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where $\mathbf { w } \in \mathbb { R } , \mathbf { c } \in \mathbb { R } , \mathbf { c _ { N } } \in \mathbb { R } , k ^ { \prime }$ is a constant hyper-parameter indicating the ratio between positive and negative samples.
|
| 70 |
+
|
| 71 |
+
Levy & Goldberg (2014) prove SGNS is equivalent to factorizing a shifted PMI matrix $M ^ { \prime }$ , where $\begin{array} { r } { M ^ { \prime } [ w , c ] = \log ( \frac { P ( w , c ) } { P ( w ) \cdot P ( c ) } \cdot \frac { 1 } { k ^ { \prime } } ) } \end{array}$ . By setting $\begin{array} { r } { k ^ { \prime } = \frac { k \cdot Z } { \# ( w ) } } \end{array}$ and applying non-negativity constraints to the embeddings, DIVE can be optimized using the similar objective function:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
l _ { D I V E } = \sum _ { w \in V } \sum _ { c \in V } \# ( w , c ) \log \sigma ( \mathbf { w } ^ { T } \mathbf { c } ) \ + k \sum _ { w \in V } \frac { Z } { \# ( w ) } \sum _ { c \in V } \# ( w , c ) \operatorname { \mathbb { E } } _ { c _ { N } \sim P _ { D } } [ \log \sigma ( - \mathbf { w } ^ { T } \mathbf { c } _ { \mathbf { N } } ) ] ,
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $\mathbf { w } \geq 0 , \mathbf { c } \geq 0 , \mathbf { c } _ { \mathbf { N } } \geq 0 ,$ $\sigma$ is the logistic sigmoid function, and $k$ is a constant hyper-parameter. $P _ { D }$ is the distribution of negative samples, which we set to be the corpus word frequency distribution in this paper. Equation (5) is optimized by ADAM (Kingma & Ba, 2015), a variant of stochastic gradient descent (SGD). The non-negativity constraint is implemented by projection (i.e., clipping any embedding which crosses the zero boundary after an update).
|
| 78 |
+
|
| 79 |
+

|
| 80 |
+
|
| 81 |
+
Figure 1: The top 15 dimensions in the distributional inclusion vector embedding (DIVE) of the word core trained by the co-occurrence statistics of context words. The index of dimensions is sorted by the embedding values. The words in each row of the table are sorted by its embedding value in the dimension.
|
| 82 |
+
|
| 83 |
+
<table><tr><td rowspan=1 colspan=1>id</td><td rowspan=1 colspan=1>Top 1-5 words</td><td rowspan=1 colspan=1>Top 101-105 words</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>element,gas,atom,rock,carbon</td><td rowspan=1 colspan=1>methane,llio</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>system,rcieturvelope,ge</td><td rowspan=1 colspan=1>functional,rnt,ocsing,</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>also, well,svral,rly</td><td rowspan=1 colspan=1>fall, eventually, main,ise,mosty</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>part</td><td rowspan=1 colspan=1>incorporate,ge,iead,oing,dd</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>star,orbit,snbital,</td><td rowspan=1 colspan=1>bright,posion,turieractio</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>several,ic</td><td rowspan=1 colspan=1>designate,ist,iss,bch,i</td></tr><tr><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>science,plosophy, thory,plosophr,r</td><td rowspan=1 colspan=1>ethical,dvocte,oic,bic,</td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>version,game,release,original,ile</td><td rowspan=1 colspan=1>cassette, rtual,code,project, kb</td></tr><tr><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>electron,ttric,cit</td><td rowspan=1 colspan=1>anode,wire,ac,perform,eistor</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>tank, cylinder,heel,gi</td><td rowspan=1 colspan=1>aluminumtic,ott</td></tr><tr><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>school,itil</td><td rowspan=1 colspan=1>doctorateldert</td></tr><tr><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>network,r,er,dtum,prl</td><td rowspan=1 colspan=1>technologyoutgnt,crooft,</td></tr><tr><td rowspan=1 colspan=1>13</td><td rowspan=1 colspan=1>high,low,turergy</td><td rowspan=1 colspan=1>atmosphric,tod,,io</td></tr><tr><td rowspan=1 colspan=1>14</td><td rowspan=1 colspan=1>acid, carbon, product, ue,inc</td><td rowspan=1 colspan=1>ph,monoided</td></tr><tr><td rowspan=1 colspan=1>15</td><td rowspan=1 colspan=1>access,nd,rquire,llow,program</td><td rowspan=1 colspan=1>size,abilitytlly</td></tr></table>
|
| 84 |
+
|
| 85 |
+
The optimization process provides an alternative angle to explain how DIVE preserves DIH. The gradients for the word embedding w is
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\frac { d l _ { D I V E } } { d \mathbf { w } } = \sum _ { c \in V } \# ( w , c ) ( 1 - \sigma ( \mathbf { w } ^ { T } \mathbf { c } ) ) \mathbf { c } - k \sum _ { c _ { N } \in V } \frac { \# ( c _ { N } ) } { | V | } \sigma ( \mathbf { w } ^ { T } \mathbf { c } _ { \mathbf { N } } ) \mathbf { c } _ { \mathbf { N } } .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
Assume hyponym $\mathbf { X }$ and hypernym y satisfy DIH in Equation (1) and the embeddings $\mathbf { x }$ and $\mathbf { y }$ are the same at some point during the gradient ascent. In the case, the gradients coming from negative sampling (the second term) decrease the same amount of embedding values for both $x$ and $y$ because $k$ is a constant hyper-parameter. However, the embedding of hypernym $\mathbf { y }$ would get higher or equal positive gradients from the first term than $\mathbf { x }$ in every dimension because $\# ( x , \bar { c } ) \leq \bar { \# } ( y , c )$ . This means Equation (1) tends to imply Equation (2). Combining the analysis from the matrix factorization viewpoint, DIH in Equation (1) is approximately equivalent to the inclusion property in DIVE (i.e. Equation (2)).
|
| 92 |
+
|
| 93 |
+
# 2.3 PMI FILTERING
|
| 94 |
+
|
| 95 |
+
For a frequent target word, there must be many neighboring words that incidentally appear near the target word without being semantically meaningful, especially when a large context window size is used. The unrelated context words cause noise in both the word vector and the context vector of DIVE. We address this issue by filtering out context words $c$ for each target word $w$ when the PMI of the co-occurring words is too small (i.e., $\begin{array} { r } { \log ( \frac { P ( w , c ) } { P ( w ) \cdot P ( c ) } ) < \log ( k _ { f } ) ) } \end{array}$ . That is, we set $\# ( w , c ) = 0$ in the objective function. This preprocessing step is similar with computing PPMI in SBOW (Bullinaria & Levy, 2007), where low PMI co-occurrences are removed from the count-based representation.
|
| 96 |
+
|
| 97 |
+
# 2.4 INTERPRETABILITY
|
| 98 |
+
|
| 99 |
+
After applying the non-negativity constraint, we observe that each dimension roughly corresponds to a topic, as previous findings suggest (Pauca et al., 2004; Murphy et al., 2012). This gives rise to a natural and intuitive interpretation of our word embeddings: the word embeddings can be seen as unnormalized probability distributions over topics. By removing the normalization of the target word frequency in the shifted PMI matrix, specific words have values in few dimensions (topics), while general words appear in more topics and correspondingly have high values in more dimensions, so the concreteness level of two words can be easily compared using the magnitude of their embeddings. In other words, general words have more diverse context distributions, so we need more dimensions to store the information in order to compress SBOW well (Nalisnick & Ravi, 2015).
|
| 100 |
+
|
| 101 |
+
In Figure 1, we present three mentions of the word core and its surrounding contexts. These various context words increase the embedding values in different dimensions. Each dimension of the learned embeddings roughly corresponds to a topic, and the more general or representative words for each topic tend to have the higher value in the corresponding dimension (e.g. words in the second column of the table). The embedding is able to capture the common contexts where the word core appears. For example, the context of the first mention is related to the atom topic (dimension id 1) and the electron topic (id 9), while the second and third mention occur in the computer architecture topic (id 2) and education topic (id 11), respectively.
|
| 102 |
+
|
| 103 |
+
# 3 EXPERIMENT SETUP
|
| 104 |
+
|
| 105 |
+
We describe four experiments in Section 4-7. The first 3 experiments compare DIVE with other unsupervised embeddings and SBOW using different hypernymy scoring functions. In these experiments, unsupervised approaches refer to the methods that only train on plaintext corpus without using any hypernymy or lexicon annotation. The last experiment presents qualitative results on word sense disambiguation.
|
| 106 |
+
|
| 107 |
+
# 3.1 DATASETS AND TESTING SETUP
|
| 108 |
+
|
| 109 |
+
The SBOW and embeddings are tested on 11 datasets. The first 4 datasets come from the recent review of Santus et al. (2017): BLESS (Baroni & Lenci, 2011), EVALution (Santus et al., 2015), Lenci/Benotto (Benotto, 2015), and Weeds (Weeds et al., 2014). The next 4 datasets are downloaded from the code repository of the H-feature detector (Roller & Erk, 2016): Medical (i.e., Levy 2014) (Levy et al., 2014), LEDS (also referred to as ENTAILMENT or Baroni 2012) (Baroni et al., 2012), TM14 (i.e., Turney 2014) (Turney & Mohammad, 2015), and Kotlerman 2010 (Kotlerman et al., 2010). In addition, the performance on the test set of HyperNet (Shwartz et al., 2016) (using the random train/test split), the test set of WordNet (Vendrov et al., 2016), and all pairs in HyperLex (Vulic et al., 2016) are also evaluated. ´
|
| 110 |
+
|
| 111 |
+
The F1 and accuracy measurements are sometimes very similar even though the quality of prediction varies, so average precision $\operatorname { A P } @$ all is adopted as the main evaluation metric. The HyperLex dataset has a continuous score on each candidate word pair, so we adopt Spearman rank coefficient $\rho$ as suggested by the review study of Vulic et al. (2016). Any OOV (out-of-vocabulary) word en- ´ countered in the testing data is pushed to the bottom of the prediction list (effectively assuming the word pair does not have a hypernym relation).
|
| 112 |
+
|
| 113 |
+
# 3.2 TRAINING SETUP
|
| 114 |
+
|
| 115 |
+
We use WaCkypedia corpus (Baroni et al., 2009), a 2009 Wikipedia dump, to compute SBOW and train the embedding. For the datasets without Part of Speech (POS) information (i.e. Medical, LEDS, TM14, Kotlerman 2010, and HyperNet), the training data of SBOW and embeddings are raw text. For other datasets, we concatenate each token with the Part of Speech (POS) of the token before training the models except the case when we need to match the training setup of another paper.
|
| 116 |
+
|
| 117 |
+
All words are lower cased. Stop words and rare words (occurs less than 10 times) are removed during our preprocessing step. The number of embedding dimensions in DIVE $d _ { 0 }$ is set to be 100. Other hyper-parameters used in the experiments are listed in the supplementary materials. The hyper-parameters of DIVE were decided based on the performance of HyperNet training set. To train embeddings more efficiently, we chunk the corpus into subsets/lines of 100 tokens instead of using sentence segmentation. Preliminary experiments show that this implementation simplification does not hurt the performance.
|
| 118 |
+
|
| 119 |
+
Table 1: Comparison with previous unsupervised embeddings. All values are percentages. $\mathbf { A P } @$ all $( \% )$ for 10 datasets and Spearman $\rho$ $( \% )$ for HyperLex. Word2Vec $+ \mathrm { C }$ scores the word pairs using the cosine similarity on skip-grams (SGNS). $\mathrm { G E + C }$ and $\mathrm { G E + K L }$ computes cosine similarity and negative KL divergence on Gaussian embedding, respectively.
|
| 120 |
+
|
| 121 |
+
<table><tr><td>Dataset</td><td>BLESS</td><td>EVALution</td><td>LenciBenotto</td><td>Weeds</td><td>Medical</td><td>LEDS</td></tr><tr><td>Random Word2Vec+C</td><td>5.3 9.2</td><td>26.6 25.4</td><td>41.2 40.8</td><td>51.4 51.6</td><td>8.5 11.2</td><td>50.5 71.8</td></tr><tr><td>GE+C GE+KL</td><td>10.5 7.6</td><td>26.7 29.6</td><td>43.3</td><td>52.0</td><td>14.9</td><td>69.7</td></tr><tr><td>DIVE+C.△S</td><td></td><td></td><td>45.1</td><td>51.3</td><td>15.7</td><td>64.6</td></tr><tr><td></td><td>16.3</td><td>33.0</td><td>50.4</td><td>65.5</td><td>25.3</td><td>83.5</td></tr><tr><td>Dataset</td><td>TM14</td><td>Kotlerman 2010</td><td>HyperNet</td><td>WordNet</td><td>HyperLex</td><td></td></tr><tr><td>Random</td><td>52.0</td><td>30.8</td><td>24.5</td><td>55.2</td><td>0</td><td></td></tr><tr><td>Word2Vec+C</td><td>52.1</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>39.5</td><td>20.7</td><td>63.0</td><td>16.3</td><td></td></tr><tr><td>GE+C</td><td>53.9</td><td>36.0</td><td>21.6</td><td>58.2</td><td>16.4</td><td></td></tr><tr><td>GE+KL</td><td>52.0</td><td>39.4</td><td>23.7</td><td>54.4</td><td>9.6</td><td></td></tr><tr><td>DIVE+C·△S</td><td>57.2</td><td>36.6</td><td>41.9</td><td>60.9</td><td>32.8</td><td></td></tr></table>
|
| 122 |
+
|
| 123 |
+
In the following experiments, we train both SBOW and DIVE on only the first 512,000 lines (51.2 million tokens) because we find this way of training setting provides better performances (for both SBOW and DIVE) than training on the whole WaCkypedia or training on randomly sampled 512,000 lines. We suspect this is due to the corpus being sorted by the Wikipedia page titles, which makes some categorical words such as animal and mammal occur 3-4 times more frequently in the first 51.2 million tokens than the rest. The performances of training SBOW PPMI on the whole WaCkypedia is also provided for reference in Table 4 and Table 5.
|
| 124 |
+
|
| 125 |
+
# 4 EXPERIMENT 1: COMPARISON WITH UNSUPERVISED EMBEDDINGS
|
| 126 |
+
|
| 127 |
+
If a pair of words has the hypernym relation, the words tend to be similar and the hypernym should be more general than the hyponym. As in HyperScore (Nguyen et al., 2017), we score the hypernym candidates by multiplying two factors corresponding to these properties. The ${ \bf C } { \cdot } { \Delta } { \cal S }$ (i.e. the cosine similarity multiply the difference of summation) scoring function is defined as
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
C \cdot \Delta S ( \mathbf { w } _ { q } \mathbf { w } _ { p } ) = \frac { \mathbf { w } _ { q } ^ { T } \mathbf { w } _ { p } } { | | \mathbf { w } _ { q } | | _ { 2 } \cdot | | \mathbf { w } _ { p } | | _ { 2 } } \cdot ( | | \mathbf { w } _ { p } | | _ { 1 } - | | \mathbf { w } _ { q } | | _ { 1 } ) ,
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
where ${ \bf w } _ { p }$ is the embedding of hypernym and ${ \bf w } _ { q }$ is the embedding of hyponym.
|
| 134 |
+
|
| 135 |
+
As far as we know, Gaussian embedding (GE) is the only unsupervised embedding method which can capture the asymmetric relations between a hypernym and its hyponyms. Using the same training and testing setup, we use the code implemented by Athiwaratkun $\&$ Wilson $( 2 0 1 7 ) ^ { 1 }$ to train Gaussian embedding on the first 51.2 million tokens and test the embeddings on 11 datasets. Its hyper-parameters are determined using the same way as DIVE (i.e. maximizing the AP on HyperNet training set). We compare DIVE with $\mathrm { G E } ^ { 2 }$ in Table 1, and the performances of random scores and only measuring word similarity using skip-grams are also presented for reference. As we can see, DIVE is usually significantly better than other baselines.
|
| 136 |
+
|
| 137 |
+
# 5 EXPERIMENT 2: HYPERNYMY SCORING FUNCTIONS ANALYSIS
|
| 138 |
+
|
| 139 |
+
In Experiment 1, we show that there exists a scoring function $\left( \mathbf { C } { \cdot } \Delta \mathbf { S } \right)$ which detects hypernymy accurately using the embedding space of DIVE. Nevertheless, different scoring functions measure different signals in SBOW or embeddings. Since there are so many scoring functions and datasets available in the domain, we first introduce and test the performances of various scoring functions so as to select the representative ones for a more comprehensive evaluation of DIVE on the hypernymy detection tasks. We denote the embedding/context vector of the hypernym candidate and the hyponym candidate as ${ \bf w } _ { p }$ and ${ \bf w } _ { q }$ , respectively. The SBOW model which represents a word by the frequency of its neighboring words is denoted as SBOW Freq, while the SBOW which uses PPMI of its neighboring words as the features (Bullinaria & Levy, 2007) is denoted as SBOW PPMI.
|
| 140 |
+
|
| 141 |
+
# 5.1 UNSUPERVISED SCORING FUNCTIONS
|
| 142 |
+
|
| 143 |
+
# 5.1.1 SIMILARITY
|
| 144 |
+
|
| 145 |
+
A hypernym tends to be similar to its hyponym, so we measure the cosine similarity between word vectors of the SBOW features (Levy et al., 2015b) or DIVE. We refer to the symmetric scoring function as Cosine or C for short in the following tables. We also train the original skip-grams with 100 dimensions and measure the cosine similarity between the resulting word2vec embeddings. This scoring function is referred to as Word2vec or W.
|
| 146 |
+
|
| 147 |
+
# 5.1.2 GENERALITY
|
| 148 |
+
|
| 149 |
+
The distributional informativeness hypothesis (Santus et al., 2014) observes that in many corpora, semantically ‘general’ words tend to appear more frequently and in more varied contexts. Thus, Santus et al. (2014) advocate using entropy of context distributions to capture the diversity of context. We adopt the two variations of the approach proposed by Santus et al. (2017): SLQS Row and SLQS Sub functions. We also refer to SLQS Row as $\Delta \mathrm { E }$ because it measures the entropy difference of context distributions. For SLQS Sub, the number of top context words is fixed as 100.
|
| 150 |
+
|
| 151 |
+
Although effective at measuring diversity, the entropy totally ignores the frequency signal from the corpus. To leverage the information, we measure the generality of a word by its L1 norm $( | \mathbf { w } _ { p } | _ { 1 } )$ and L2 norm $( | | \mathbf { w } _ { p } | | _ { 2 } )$ . Recall that Equation (2) indicates that the embedding of the hypernym $\mathbf { y }$ should have a larger value at every dimension than the embedding of the hyponym x. When the inclusion property holds, $\begin{array} { r } { | { \bf y } | _ { 1 } = \sum _ { i } { \bf y } [ i ] \geq \sum _ { i } { \bf x } [ i ] = | { \bf x } | _ { 1 } } \end{array}$ and similarly $| | \mathbf { y } | | _ { 2 } \geq | | \mathbf { x } | | _ { 2 }$ . Thus, we propose two scoring functions, difference of vector summation $( | \mathbf { w } _ { p } | _ { 1 } - | \mathbf { w } _ { q } | _ { 1 } )$ and the difference of vector 2-norm $( | | \mathbf { \bar { w } } _ { p } | | _ { 2 } - | | \mathbf { w } _ { q } | | _ { 2 } )$ . Notice that when applying the difference of vector summations (denoted as $\Delta S$ ) to SBOW Freq, it is equivalent to computing the word frequency difference between the hypernym candidate pair.
|
| 152 |
+
|
| 153 |
+
# 5.1.3 COMBINATION
|
| 154 |
+
|
| 155 |
+
The combination of 2 similarity functions (Cosine and Word2vec) and the 3 generality functions (difference of entropy, summation, and 2-norm of vectors) leads to six different scoring functions as shown in Table 2, and ${ \bf C } { \cdot } { \Delta } { \cal S }$ is the same scoring function we used in Experiment 1. It should be noted that if we use skip-grams with negative sampling (word2vec) as the similarity measurement (i.e., $W \cdot \Delta \ \{ \mathrm { E } , \mathrm { S } , \mathrm { Q } \} ,$ ), the scores are determined by two embedding/feature spaces together (word2vec and DIVE/SBOW).
|
| 156 |
+
|
| 157 |
+
# 5.1.4 INCLUSION
|
| 158 |
+
|
| 159 |
+
Several scoring functions are proposed to measure inclusion properties of SBOW based on DIH. Weeds Precision (Weeds & Weir, 2003) and CDE (Clarke, 2009) both measure the magnitude of the intersection between feature vectors $( | \mathbf { w } _ { p } \cap \mathbf { w } _ { q } | )$ . For example, ${ \bf w } _ { p } \cap { \bf w } _ { q }$ is defined by the elementwise minimum in CDE. Then, both scoring functions divide the intersection by the magnitude of the potential hyponym vector $( | \mathbf { w } _ { q } | )$ . invCL (Lenci & Benotto, 2012) (A variant of CDE) is also tested.
|
| 160 |
+
|
| 161 |
+
We choose these 3 functions because they have been shown to detect hypernymy well in a recent study (Santus et al., 2017). However, it is hard to confirm that their good performances come from the inclusion property between context distributions — it is also possible that the context vectors of more general words have higher chance to overlap with all other words due to their high frequency. For instance, considering a one dimension feature which stores only the frequency of words, the naive embedding could still have reasonable performance on the CDE function, but the embedding in fact only memorizes the general words without modeling relations between words (Levy et al., 2015b) and loses lots of inclusion signals in the word co-occurrence statistics.
|
| 162 |
+
|
| 163 |
+
Table 2: Micro average AP@all $( \% )$ of 10 datasets using different scoring functions. The feature space is SBOW using word frequency.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Word2vec (W) 24.8</td><td>Cosine (C) 26.7</td><td>SLQS Sub 27.4</td><td>SLQS Row (△E) 27.6</td><td>Summation (△S) 31.5</td><td>Two norm (△Q) 31.2</td></tr><tr><td>W.△E</td><td>C.△E</td><td>W.△S</td><td>C.△S</td><td>W.△Q</td><td>C.△Q</td></tr><tr><td>28.8</td><td>29.5</td><td>31.6</td><td>31.2</td><td>31.4</td><td>31.1</td></tr><tr><td>Weeds</td><td>CDE</td><td>invCL</td><td>Asymmetric L1(AL1)</td><td></td><td></td></tr><tr><td>19.0</td><td>31.1</td><td>30.7</td><td>28.2</td><td></td><td></td></tr></table>
|
| 166 |
+
|
| 167 |
+
In order to measure the inclusion property without the interference of the word frequency signal from the SBOW or embeddings, we propose a new measurement called asymmetric $L _ { 1 }$ distance. We first get context distributions ${ \bf d } _ { p }$ and ${ \bf d } _ { q }$ by normalizing $\mathbf { w } _ { p }$ and ${ \bf w } _ { q }$ , respectively. Ideally, the context distribution of the hypernym ${ \bf d } _ { p }$ will include ${ \bf d } _ { q }$ . This suggests the hypernym distribution ${ \bf d } _ { p }$ is larger than context distribution of the hyponym with a proper scaling factor $a \mathbf { d } _ { q }$ (i.e., $\operatorname* { m a x } ( a \mathbf { d } _ { q } \bar { - }$ ${ \bf d } _ { p } , 0 )$ should be small). Furthermore, both distributions should be similar, so $a \mathbf { d } _ { q }$ should not be too different from ${ \bf d } _ { p }$ (i.e., $\operatorname* { m a x } ( \mathbf { d } _ { p } - a \mathbf { d } _ { q } , 0 )$ should also be small). Therefore, we define asymmetric L1 distance as
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
A L _ { 1 } = \operatorname* { m i n } _ { a } \sum _ { c } w _ { 0 } \cdot \operatorname* { m a x } ( a \mathbf { d } _ { q } [ c ] - \mathbf { d } _ { p } [ c ] , 0 ) + \operatorname* { m a x } ( \mathbf { d } _ { p } [ c ] - a \mathbf { d } _ { q } [ c ] , 0 ) ,
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
where $w _ { 0 }$ is a constant which emphasizes the inclusion penalty. If $w _ { 0 } ~ = ~ 1$ and $a \ = \ 1$ , $A L _ { 1 }$ is equivalent to L1 distance. The lower $A L _ { 1 }$ distance implies a higher chance of observing the hypernym relation. We tried $w _ { 0 } = 5$ and $w _ { 0 } = 2 0$ . $w _ { 0 } = 2 0$ produces a worse micro-average AP@all on SBOW Freq, SBOW PPMI and DIVE, so we fix $w _ { 0 }$ to be 5 in all experiments. An efficient way to solve the optimization in $A L _ { 1 }$ is presented in the supplementary materials.
|
| 174 |
+
|
| 175 |
+
# 5.2 RESULTS AND DISCUSSIONS
|
| 176 |
+
|
| 177 |
+
We show the micro average $\mathbf { A P } @$ all on 10 datasets using different hypernymy scoring functions in Table 2. We can see the combination functions such as ${ \bf C } { \cdot } { \Delta } { \cal S }$ and ${ \bf W } { \cdot } { \Delta } { \cal S }$ perform the best overall. Among the unnormalized inclusion based scoring functions, CDE works the best. $A L _ { 1 }$ performs well compared with other functions which remove the frequency signal such as Word2vec, Cosine, and SLQS Row. The summation is the most robust generality measurement. In the table, the scoring functions are applied to SBOW Freq, but the performances of hypernymy scoring functions on the other feature spaces (e.g. DIVE) have a similar trend.
|
| 178 |
+
|
| 179 |
+
# 6 EXPERIMENT 3: COMPARISON WITH SBOW
|
| 180 |
+
|
| 181 |
+
# 6.1 COMPARISON WITH PREVIOUSLY REPORTED RESULTS
|
| 182 |
+
|
| 183 |
+
In Table 3, DIVE with two of the best scoring functions $C { \cdot } \Delta s$ and ${ \bf W } { \cdot } { \Delta S }$ ) is compared with the previous unsupervised state-of-the-art approaches based on SBOW on different datasets.
|
| 184 |
+
|
| 185 |
+
There are several reasons which might cause the large performance gaps in some datasets. In addition to the effectiveness of DIVE, some improvements come from our proposed scoring functions. The fact that every paper uses a different training corpus also affects the performances. Furthermore, Santus et al. (2017) select the scoring functions and feature space for the first 4 datasets based on $\mathbf { A P } @ 1 0 0$ , which we believe is too sensitive to the hyper-parameter settings of different methods. To isolate the impact of each factor, we perform a more comprehensive comparison next.
|
| 186 |
+
|
| 187 |
+
# 6.2 PERFORMANCE ANALYSIS
|
| 188 |
+
|
| 189 |
+
In this experiment, we examine whether DIVE successfully preserves the signals for hypernymy detection tasks, which are measured by the same scoring functions designed for SBOW. Summation difference $( \Delta \boldsymbol { S } )$ and CDE perform the best among generality and inclusion functions in Table 2,
|
| 190 |
+
|
| 191 |
+
Table 3: Comparison with previous methods based on sparse bag of word (SBOW). All values are percentages. The results of invCL (Lenci & Benotto, 2012), APSyn (Santus et al., 2016), and CDE (Clarke, 2009) are selected because they have the best $\mathbf { A P } @ 1 0 0$ in the first 4 datasets (Santus et al., 2017). Cosine similarity (Levy et al., 2015b), balAPinc (Kotlerman et al., 2010) in 3 datasets (Turney & Mohammad, 2015), SLQS (Santus et al., 2014) in HyperNet dataset (Shwartz et al., 2016), and Freq ratio (FR) (Vulic et al., 2016) are compared. ´
|
| 192 |
+
|
| 193 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=2>BLESS EVALution</td><td rowspan=1 colspan=1>LenciBenotto</td><td rowspan=1 colspan=1>Weeds</td><td rowspan=1 colspan=1>Medical</td></tr><tr><td rowspan=1 colspan=1>Metric</td><td rowspan=1 colspan=4>AP@all</td><td rowspan=1 colspan=1>F1</td></tr><tr><td rowspan=2 colspan=1>Baselines</td><td rowspan=1 colspan=2>invCL</td><td rowspan=1 colspan=1>APSyn</td><td rowspan=1 colspan=1>CDE</td><td rowspan=1 colspan=1>Cosine</td></tr><tr><td rowspan=1 colspan=1>5.1</td><td rowspan=1 colspan=1>35.3</td><td rowspan=1 colspan=1>38.2</td><td rowspan=1 colspan=1>44.1</td><td rowspan=1 colspan=1>23.1</td></tr><tr><td rowspan=1 colspan=1>DIVE+C·△S</td><td rowspan=1 colspan=1>16.3</td><td rowspan=1 colspan=1>33.0</td><td rowspan=1 colspan=1>50.4</td><td rowspan=1 colspan=1>65.5</td><td rowspan=1 colspan=1>25.3</td></tr><tr><td rowspan=1 colspan=1>DIVE +W·△S</td><td rowspan=1 colspan=1>18.6</td><td rowspan=1 colspan=1>32.3</td><td rowspan=1 colspan=1>51.5</td><td rowspan=1 colspan=1>68.6</td><td rowspan=1 colspan=1>25.7</td></tr><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>LEDS</td><td rowspan=1 colspan=1>TM14</td><td rowspan=1 colspan=1>Kotlerman 2010</td><td rowspan=1 colspan=1>HyperNet</td><td rowspan=1 colspan=1>HyperLex</td></tr><tr><td rowspan=1 colspan=1>Metric</td><td rowspan=1 colspan=2>AP@all</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>F1</td><td rowspan=1 colspan=1>Spearman p</td></tr><tr><td rowspan=2 colspan=1>Baselines</td><td rowspan=1 colspan=3>balAPinc</td><td rowspan=1 colspan=1>SLQS</td><td rowspan=1 colspan=1>Freq ratio</td></tr><tr><td rowspan=1 colspan=1>73</td><td rowspan=1 colspan=1>56</td><td rowspan=1 colspan=1>37</td><td rowspan=1 colspan=1>22.8</td><td rowspan=1 colspan=1>27.9</td></tr><tr><td rowspan=1 colspan=1>DIVE+C·△S</td><td rowspan=1 colspan=1>83.5</td><td rowspan=1 colspan=1>57.2</td><td rowspan=1 colspan=1>36.6</td><td rowspan=1 colspan=1>41.9</td><td rowspan=1 colspan=1>32.8</td></tr><tr><td rowspan=1 colspan=1>DIVE+W·△S</td><td rowspan=1 colspan=1>86.4</td><td rowspan=1 colspan=1>57.3</td><td rowspan=1 colspan=1>37.4</td><td rowspan=1 colspan=1>38.6</td><td rowspan=1 colspan=1>33.3</td></tr></table>
|
| 194 |
+
|
| 195 |
+
respectively. $A L _ { 1 }$ could be used to examine the inclusion properties after removing the frequency signal. Therefore, we will present the results using these 3 scoring functions, along with ${ \bf W } { \cdot } { \Delta } S$ and ${ \bf C } { \cdot } { \Delta } { \cal S }$ .
|
| 196 |
+
|
| 197 |
+
# 6.2.1 BASELINES
|
| 198 |
+
|
| 199 |
+
In addition to classic representations such as SBOW Freq and SBOW PPMI, we compare distributional inclusion vector embedding (DIVE) with additional 4 baselines in Table 4.
|
| 200 |
+
|
| 201 |
+
• SBOW PPMI with additional frequency weighting (PPMI w/ FW). Specifically, $\mathbf { w } [ c ] =$ $\begin{array} { r } { \operatorname* { m a x } ( \log ( \frac { P ( w , c ) } { P ( w ) * P ( c ) * \frac { Z } { \# ( w ) } } ) , 0 ) } \end{array}$ . This forms the matrix reconstructed by DIVE when $k = 1$ .
|
| 202 |
+
• DIVE without the PMI filter (DIVE w/o PMI)
|
| 203 |
+
• NMF on shifted PMI: Non-negative matrix factorization (NMF) on the shifted PMI without frequency weighting for DIVE (DIVE w/o FW). This is the same as applying the nonnegative constraint on the skip-gram model.
|
| 204 |
+
K-means (Freq NMF): The method first uses Mini-batch $\mathbf { k }$ -means (Sculley, 2010) to cluster words in skip-gram embedding space into 100 topics, and hashes each frequency count in SBOW into the corresponding topic. If running $\mathbf { k }$ -means on skip-grams is viewed as an approximation of clustering the SBOW context vectors, the method can be viewed as a kind of NMF (Ding et al., 2005). Let the $N \times N$ context matrix be denoted as $M _ { c }$ , where the $( i , j )$ th element stores the count of word $j$ appearing beside word $i$ . K-means hashing creates a $N \times 1 0 0$ matrix $G$ with orthonormal rows $\tilde { G } ^ { T } G = I )$ , where the $( i , k )$ th element is 0 if the word $i$ does not belong to cluster $k$ . The orthonormal $G$ is also an approximated solution of a type of NMF $( M _ { c } \overset { \mathbf { \backsimeq } } { \approx } F G ^ { T }$ ) (Ding et al., 2005). Hashing context vectors into topic vectors can be written as $M _ { c } G \approx F G ^ { T } G = F$ .
|
| 205 |
+
|
| 206 |
+
In the experiment, we also tried to apply a constant $\log ( k )$ shifting to SBOW PPMI (i.e. $\operatorname* { m a x } ( P M I - \log ( k ) , 0 ) )$ ). We found that the performance degrades as $k$ increases. Similarly, applying PMI filter to SBOW PPMI (set context feature to be 0 if the value is lower than $\log ( k _ { f } ) )$ usually makes the performances worse, especially when $k _ { f }$ is large. Applying PMI filter to SBOW Freq only makes its performances closer to (but still much worse than) SBOW PPMI, so we omit this baseline as well.
|
| 207 |
+
|
| 208 |
+
# 6.2.2 RESULTS AND DISCUSSIONS
|
| 209 |
+
|
| 210 |
+
In Table 4, we first confirm the finding of the previous review study of Santus et al. (2017): there is no single hypernymy scoring function which always outperforms others. One of the main reasons is that different datasets collect negative samples differently. This is also why we evaluate our method on many datasets to make sure our conclusions hold in general. For example, if negative samples come from random word pairs (e.g. WordNet dataset), a symmetric similarity measure is already a pretty good scoring function. On the other hand, negative samples come from related or similar words in HyperNet, EVALution, Lenci/Benotto, and Weeds, so only computing generality difference leads to the best (or close to the best) performance. The negative samples in many datasets are composed of both random samples and similar words (such as BLESS), so the combination of similarity and generality difference yields the most stable results.
|
| 211 |
+
|
| 212 |
+
Table 4: $\mathbf { A P } @$ all $( \% )$ of 10 datasets. The box at lower right corner compares the micro average AP across all 10 datasets. Numbers in different rows come from different feature or embedding spaces. Numbers in different columns come from different datasets and unsupervised scoring functions. We also present the micro average AP across the first 4 datasets (BLESS, EVALution, Lenci/Benotto and Weeds). All wiki means SBOW using PPMI features trained on the whole WaCkypedia. FW refers to frequency weighting on the shifted PMI matrix.
|
| 213 |
+
|
| 214 |
+
<table><tr><td rowspan="2" colspan="2">AP@all(%)</td><td colspan="5">BLESS</td><td colspan="4">EVALution</td><td colspan="5">Lenci/Benotto</td></tr><tr><td>CDE</td><td>AL1</td><td>△S</td><td>W△S</td><td>C△S</td><td>CDE AL1</td><td>△S</td><td>W△S</td><td>C△S</td><td>CDE</td><td>AL1</td><td>△S</td><td>W△S</td><td>C△S</td></tr><tr><td rowspan="4">SBOW</td><td>Freq</td><td>6.3</td><td>7.3 5.6 5.6</td><td>11.0 17.2</td><td>5.9 15.3</td><td>35.3 30.4</td><td>32.6 27.7</td><td>36.2</td><td>33.0</td><td>36.3</td><td>51.8</td><td>47.6</td><td>51.0</td><td>51.8</td><td>51.1</td></tr><tr><td>PPMI</td><td>13.6</td><td>5.1</td><td></td><td></td><td></td><td>27.5</td><td>34.1</td><td>31.9</td><td>34.3</td><td>47.2</td><td>39.7</td><td>50.8</td><td>51.1</td><td>52.0</td></tr><tr><td>PPMI w/FW</td><td>6.2</td><td>5.0</td><td>5.5 12.4</td><td></td><td>5.8</td><td>36.0</td><td>36.3</td><td>32.9</td><td>36.4</td><td>52.0</td><td>43.1</td><td>50.9</td><td>51.9</td><td>50.7</td></tr><tr><td>All wiki</td><td>12.1</td><td>5.2</td><td>6.9 12.5</td><td></td><td>13.4 28.5</td><td>27.1</td><td>30.3</td><td>29.9</td><td>31.0</td><td>47.1</td><td>39.9</td><td>48.5</td><td>48.7</td><td>51.1</td></tr><tr><td rowspan="3">DIVE</td><td>Full</td><td>9.3</td><td>7.6 6.0 5.6</td><td>18.6</td><td>16.3</td><td>30.0</td><td>27.5</td><td>34.9</td><td>33.0</td><td>46.7</td><td>43.2</td><td>51.3</td><td>51.5</td><td>50.4</td><td></td></tr><tr><td>w/o PMI</td><td>7.8</td><td>6.9</td><td>16.7</td><td>7.1</td><td>32.8</td><td>32.2</td><td>35.7</td><td>32.3 32.5</td><td>35.4</td><td>47.6</td><td>44.9</td><td>50.9</td><td>51.6</td><td>49.7</td></tr><tr><td>w/o FW</td><td>9.0</td><td>6.2</td><td>6.2</td><td>7.3</td><td>24.3</td><td>25.0</td><td>22.9</td><td>23.5</td><td>23.9</td><td>38.8</td><td>38.1</td><td>38.2</td><td>38.2</td><td>38.4</td></tr><tr><td>Kmean (Freq NMF)</td><td></td><td>6.5</td><td>7.3 5.6</td><td>10.9</td><td>5.8</td><td>33.7</td><td>27.2</td><td>36.2</td><td>33.0</td><td>36.2</td><td>49.6</td><td>42.5</td><td>51.0</td><td>51.8</td><td>51.2</td></tr><tr><td colspan="2"></td><td colspan="4">7.3 Weeds</td><td colspan="4">Micro Average (4 datasets)</td><td></td><td colspan="4">Medical</td><td></td></tr><tr><td colspan="2">AP@all(%)</td><td>CDE AL1</td><td colspan="3">△S</td><td>CDE</td><td colspan="3">AL1</td><td></td><td>CDE</td><td>AL1</td><td>△S</td><td>W·△S</td><td>C△S</td></tr><tr><td rowspan="5">SBOW</td><td>Freq</td><td>69.5</td><td>58.0 68.8</td><td>W△S 68.2</td><td>C△S 68.4</td><td>23.1</td><td>21.8</td><td>△S 22.9</td><td>W△S 25.0</td><td>C△S 23.0</td><td>19.4</td><td>19.2</td><td>14.1</td><td>18.4</td><td>15.3</td></tr><tr><td>PPMI</td><td>61.0</td><td>50.3</td><td>70.3</td><td>69.2</td><td>69.3</td><td>24.7 17.9</td><td>22.3</td><td>28.1</td><td>27.8</td><td>23.4</td><td>8.7</td><td>13.2</td><td>20.1</td><td>24.4</td></tr><tr><td>PPMI w/FW</td><td>67.6</td><td>52.2</td><td>69.4</td><td>68.7</td><td>67.7</td><td>23.2 18.2</td><td>22.9</td><td>25.8</td><td>22.9</td><td>22.8</td><td>10.6</td><td>13.7</td><td>18.6</td><td>17.0</td></tr><tr><td>All wiki</td><td>61.3</td><td>48.6</td><td>70.0</td><td></td><td>70.4</td><td>23.4</td><td></td><td></td><td>25.8</td><td>22.3</td><td>8.9</td><td>12.2</td><td>17.6</td><td>21.1</td></tr><tr><td>Full</td><td>59.2</td><td>55.0</td><td>68.5</td><td></td><td></td><td>17.7 19.8</td><td>21.7 22.8</td><td>24.6 28.9</td><td>27.6</td><td>11.7</td><td>9.3</td><td>13.7</td><td>21.4</td><td>19.2</td></tr><tr><td>DIVE w/o PMI</td><td>60.4</td><td>56.4</td><td>69.7 69.3</td><td>68.6 68.6</td><td>65.5 64.8</td><td>22.1 22.2</td><td>21.0</td><td></td><td>23.1</td><td>10.7</td><td>8.4</td><td>13.3</td><td>19.8</td><td></td><td>16.2</td></tr><tr><td rowspan="3"></td><td>w/o FW</td><td>49.2</td><td>47.3 45.1</td><td>45.1</td><td>44.9</td><td>18.9</td><td>17.3</td><td>22.7 17.2</td><td>28.0 16.8</td><td>17.5</td><td>10.9</td><td>9.8</td><td>7.4</td><td>7.6</td><td>7.7</td></tr><tr><td>Kmean (Freq NMF)</td><td>69.4</td><td>51.1 68.8</td><td>68.2</td><td>68.9</td><td>22.5</td><td>19.3</td><td>22.9</td><td>24.9</td><td>23.0</td><td>12.6</td><td>10.9</td><td>14.0</td><td>18.1</td><td>14.6</td></tr><tr><td></td><td></td><td>LEDS</td><td></td><td></td><td></td><td></td><td>TM14</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="2">AP@all(%)</td><td colspan="4">AL1 △S</td><td colspan="4">CDE AL1</td><td></td><td colspan="4">Kotlerman 2010</td><td></td></tr><tr><td colspan="2">SBOWFreq</td><td>CDE</td><td>70.4 70.7</td><td>W·△S 83.3</td><td>C△S 73.3</td><td>55.6</td><td>53.2</td><td>△S 54.9</td><td>W·△S 55.7</td><td>C.△S 55.0</td><td>CDE 35.9</td><td>AL1 40.5</td><td>△S 34.5</td><td>W.△S 37.0</td><td>C.△S 35.4</td></tr><tr><td colspan="2">SBOWPPMI</td><td>82.7 84.4</td><td>50.2 72.2</td><td>86.5</td><td>84.5</td><td>56.2</td><td>52.3</td><td>54.4</td><td></td><td>57.6</td><td>39.1</td><td>30.9</td><td>33.0</td><td>37.0</td><td>36.3</td></tr><tr><td colspan="2">All wiki</td><td>83.1</td><td>49.7 67.9</td><td>82.9</td><td>81.4</td><td>54.7</td><td>50.5</td><td>52.6</td><td>57.0 55.1</td><td>54.9</td><td>38.5</td><td>31.2</td><td>32.2</td><td>35.4</td><td>35.3</td></tr><tr><td colspan="2">DIVE</td><td>83.3</td><td>72.7</td><td>86.4</td><td>83.5</td><td>55.3</td><td>52.6</td><td>55.2</td><td>57.3</td><td>57.2</td><td>35.3</td><td>31.6</td><td>33.6</td><td>37.4</td><td>36.6 MicroAverage(10datasets)</td></tr><tr><td colspan="2">AP@all (%)</td><td>74.7</td><td>HyperNet</td><td></td><td></td><td></td><td></td><td>WordNet</td><td></td><td></td></table>
|
| 215 |
+
|
| 216 |
+
DIVE performs similar or better on all the scoring functions compared with SBOW consistently across all datasets in Table 4, while using many fewer dimensions (see Table 6). Its results on combination scoring functions outperform SBOW Freq. Meanwhile, its results on $A L _ { 1 }$ outperform SBOW PPMI. The fact that combination scoring functions (i.e., W·∆S or $\mathbf { C } { \cdot } \Delta \mathbf { S }$ ) usually outperform generality functions suggests that only memorizing general words is not sufficient. The best average performance on 4 and 10 datasets are both produced by ${ \bf W } { \cdot } { \Delta } { \cal S }$ on DIVE.
|
| 217 |
+
|
| 218 |
+
SBOW PPMI improves the combination functions from SBOW Freq but sacrifices AP on the inclusion functions. It generally hurts performance to change the frequency sampling of PPMI (PPMI w/ FW) or compute SBOW PPMI on the whole WaCkypedia (all wiki) instead of the first 51.2 million tokens. The similar trend can also be seen in Table 5. Note that $A L _ { 1 }$ completely fails in HyperLex dataset using SBOW PPMI, which suggests that PPMI might not necessarily preserve the distributional inclusion property, even though it can have good performance on combination functions.
|
| 219 |
+
|
| 220 |
+
Removing the PMI filter from DIVE slightly drops the overall precision while removing frequency weights on shifted PMI (w/o FW) leads to poor performances. K-means (Freq NMF) produces similar AP compared with SBOW Freq, but has worse $A L _ { 1 }$ scores. Its best AP scores on different datasets are also significantly worse than the best AP of DIVE. This means that only making word2vec (skip-grams with negative sampling) non-negative or naively accumulating topic distribution in contexts cannot lead to satisfactory embeddings.
|
| 221 |
+
|
| 222 |
+
Table 5: Spearman $\rho \left( \% \right)$ in HyperLex.
|
| 223 |
+
|
| 224 |
+
<table><tr><td rowspan="2">Spearman p (%)</td><td colspan="5">HyperLex</td></tr><tr><td>CDE</td><td>AL1</td><td>△S</td><td>W·△S</td><td>C.△S</td></tr><tr><td>SBOWFreq</td><td>31.7</td><td>19.6</td><td>27.6</td><td>29.6</td><td>27.3</td></tr><tr><td>SBOW PPMI</td><td>28.1</td><td>-2.3</td><td>31.8</td><td>34.3</td><td>34.5</td></tr><tr><td>All wiki</td><td>25.3</td><td>-2.2</td><td>28.0</td><td>30.5</td><td>31.0</td></tr><tr><td>DIVE</td><td>28.9</td><td>18.7</td><td>31.2</td><td>33.3</td><td>32.8</td></tr></table>
|
| 225 |
+
|
| 226 |
+
Table 6: The average number of non-zero dimensions across all testing words in 10 datasets.
|
| 227 |
+
|
| 228 |
+
<table><tr><td rowspan=1 colspan=1>SBOW Freq</td><td rowspan=1 colspan=1>SBOWPPMI</td><td rowspan=1 colspan=1>DIVE</td></tr><tr><td rowspan=1 colspan=1>5799</td><td rowspan=1 colspan=1>3808</td><td rowspan=1 colspan=1>20</td></tr></table>
|
| 229 |
+
|
| 230 |
+
Table 7: Spectral clustering on the non-zero DIVE dimensions of the query word. When the number of clusters is set to be 2, we present the top 4 dimensions in each cluster, which have the highest values on the query word embedding. Otherwise, the top 2 dimensions are presented. CID refers to cluster ID. The top 5 words with the highest values of each dimension are presented.
|
| 231 |
+
|
| 232 |
+
<table><tr><td>Query</td><td>CID</td><td colspan="2">Top 5 words in the top dimensions</td></tr><tr><td rowspan="2">rock</td><td>1</td><td>element,gas,atom,rock,carbon find, specie,species,animal,bird</td><td>sea,lake,river,area,water point,side,line, front,circle</td></tr><tr><td>2</td><td>band,song,album,music,rock early,work,century,late,begin</td><td>write,john,guitar,band,author include,several, show, television,film</td></tr><tr><td rowspan="2">bank</td><td>1</td><td>county,area,city, town,west building,build,house, palace, site</td><td>several,main, province, include,consist sea,lake,river,area,water</td></tr><tr><td>2</td><td>money, tax,price, pay, income united, states,country, world, europe</td><td>company,corporation,system,agency, service state,palestinian,israel,right, palestine</td></tr><tr><td rowspan="2">apple</td><td>1</td><td>food, fruit,vegetable,meat, potato war,german,ii,germany,world</td><td>goddess,zeus,god,hero,sauron write, john,guitar,band,author</td></tr><tr><td>2</td><td>version, game,release,original, file system,architecture,develop,base,language</td><td>car,company,sell, manufacturer,model include,several, show, television,film</td></tr><tr><td rowspan="2">star</td><td>1</td><td>film, role, production, play, stage wear,blue,color, instrument,red</td><td>character,series,game,novel, fantasy write, john,guitar,band,author</td></tr><tr><td>2</td><td>element,gas,atom,rock,carbon give, term,vector,mass,momentum</td><td>star,orbit,sun,orbital,planet light, image,lens,telescope,camera</td></tr><tr><td rowspan="2">tank</td><td>1</td><td>tank,cylinder,wheel, engine,steel acid,carbon,product, use, zinc</td><td>industry, export, industrial, economy,company network,user,server, datum, protocol</td></tr><tr><td>2</td><td>army,force,infantry,military,battle however,attempt,result, despite, fail</td><td>aircraft,navy,missile,ship,flight war, german, ii, germany, world</td></tr><tr><td rowspan="3">race</td><td>1</td><td>win,world,cup,play,championship</td><td>two,one,three,four,another</td></tr><tr><td>2 3</td><td>railway, line, train,road, rail</td><td>car,company, sell, manufacturer,model</td></tr><tr><td></td><td>population,language, ethnic, native, people</td><td>female,age,woman,male,household</td></tr><tr><td rowspan="3">run</td><td>1</td><td>system,architecture, develop,base,language</td><td>access, need, require,allow, program</td></tr><tr><td>2</td><td>railway,line,train,road,rail</td><td>also,well, several, early, see</td></tr><tr><td>3</td><td>game,team,season,win,league</td><td>game,player,run,deal,baseball</td></tr><tr><td rowspan="3">tablet</td><td>1</td><td>bc, source, greek, ancient, date</td><td>book,publish,write,work,edition</td></tr><tr><td>2</td><td>use,system,design,term,method</td><td>version, game,release,original, file</td></tr><tr><td>3</td><td>system,blood,vessel,artery,intestine</td><td>patient, symptom, treatment,disorder, may</td></tr></table>
|
| 233 |
+
|
| 234 |
+
# 7 EXPERIMENT 4: WORD SENSE DISAMBIGUATION
|
| 235 |
+
|
| 236 |
+
In addition to hypernymy detection, Athiwaratkun & Wilson (2017) show that the mixture of Gaussian distributions can also be used to discover multiple senses of each word. In our qualitative experiment, we show that DIVE can achieve the similar goal without fixing the number of senses before training the embedding.
|
| 237 |
+
|
| 238 |
+
Recall that each dimension roughly corresponds to one topic. Given a query word, the higher embedding value on a dimension implies higher likelihood to observe the word in the context of the topic. The embedding of a polysemy would have high values on different groups of topics/dimensions. This allows us to discover the senses by clustering the topics/dimensions of the polysemy. We use the embedding values as the feature each dimension, compute the pairwise similarity between dimensions, and apply spectral clustering (Stella & Shi, 2003) to group topics as shown in the Table 7. See more implementation details in the supplementary materials.
|
| 239 |
+
|
| 240 |
+
In the word sense disambiguation tasks, it is usually challenging to determine how many senses/clusters each word should have. Many existing approaches fix the number of senses before training the embedding (Tian et al., 2014; Athiwaratkun & Wilson, 2017). Neelakantan et al. (2014) make the number of clusters approximately proportional to the diversity of the context, but the assumption does not always hold. Furthermore, the training process cannot capture different granularity of senses. For instance, race in the car context could share the same sense with the race in the game topic because they all mean contest, but the race in the car context actually refers to the specific contest of speed. Therefore, they can also be viewed as separate senses (like the results in Table 7). This means the correct number of clusters is not unique, and the methods, which fixes the cluster numbers, need to re-train the embedding many times to capture such granularity.
|
| 241 |
+
|
| 242 |
+
In our approach, clustering dimensions is done after the training process of DIVE is completed, so it is fairly efficient to change the cluster numbers and hierarchical clustering is also an option. Similar to our method, Pelevina et al. (2016) also discover word senses by graph-based clustering. The main difference is that they cluster the top $n$ words which are most related to the query word instead of topics. However, choosing the hyper-parameter $n$ is difficult. Large $n$ would make graph clustering algorithm inefficient, while small $n$ would make less frequent senses difficult to discover.
|
| 243 |
+
|
| 244 |
+
# 8 RELATED WORK
|
| 245 |
+
|
| 246 |
+
Most previous unsupervised approaches focus on designing better hypernymy scoring functions for sparse bag of word (SBOW) features. They are well summarized in the recent study (Santus et al., 2017). Santus et al. (2017) also evaluate the influence of different contexts, such as changing the window size of contexts or incorporating dependency parsing information, but neglect scalability issues inherent to SBOW methods.
|
| 247 |
+
|
| 248 |
+
A notable exception is the Gaussian embedding model (Vilnis & McCallum, 2015). The context distribution of each word is encoded as a multivariate Gaussian distribution, where the embeddings of hypernyms tend to have higher variance and overlap with the embedding of their hyponyms. However, since a Gaussian distribution is normalized, it is difficult to retain frequency information during the embedding process, and experiments on HyperLex (Vulic et al., 2016) demonstrate that a simple ´ baseline only relying on word frequency can achieve good results. Follow-up work models contexts by a mixture of Gaussians (Athiwaratkun & Wilson, 2017) relaxing the unimodality assumption but achieves little improvement on hypernym detection tasks.
|
| 249 |
+
|
| 250 |
+
Kiela et al. (2015) show that images retrieved by a search engine can be a useful source of information to determine the generality of lexicons, but the resources might not be available for some corpora such as scientific literature.
|
| 251 |
+
|
| 252 |
+
Order embedding (Vendrov et al., 2016) is a supervised approach to encode many annotated hypernym pairs (e.g. all of the whole WordNet (Miller, 1995)) into a compact embedding space, where the embedding of a hypernym should be smaller than the embedding of its hyponym in every dimension. Our method learns embedding from raw text, where a hypernym embedding should be larger than the embedding of its hyponym in every dimension. Thus, DIVE can be viewed as an unsupervised and reversed form of order embedding.
|
| 253 |
+
|
| 254 |
+
Other semi-supervised hypernym detection methods aim to generalize from sets of annotated word pairs using raw text corpora. The goal of HyperScore (Nguyen et al., 2017) is similar to our model: the embedding of a hypernym should be similar to its hyponym but with higher magnitude. However, their training process relies heavily on annotated hypernym pairs, and the performance drops significantly when reducing the amount of supervision. In addition to context distributions, previous work also leverages training data to discover useful text pattern indicating is-a relation (Shwartz et al., 2016; Roller & Erk, 2016), but it remains challenging to increase recall of hypernym detection because commonsense facts like cat is-a animal might not appear in the corpus.
|
| 255 |
+
|
| 256 |
+
Non-negative matrix factorization (NMF) has a long history in NLP, for example in the construction of topic models (Pauca et al., 2004). Non-negative sparse embedding (NNSE) (Murphy et al., 2012) and Faruqui et al. (2015) indicate that non-negativity can make embeddings more interpretable and improve word similarity evaluations. The sparse NMF is also shown to be effective in cross-lingual lexical entailment tasks but does not necessarily improve monolingual hypernymy detection (Vyas &
|
| 257 |
+
|
| 258 |
+
Carpuat, 2016). In our study, a new type of NMF is proposed, and the comprehensive experimental analysis demonstrates its state-of-the-art performances on unsupervised hypernymy detection.
|
| 259 |
+
|
| 260 |
+
# 9 CONCLUSIONS
|
| 261 |
+
|
| 262 |
+
Compressing unsupervised SBOW models into a compact representation is challenging while preserving the inclusion, generality, and similarity signals which are important for hypernym detection. Our experiments suggest that simple baselines such as accumulating K-mean clusters and non-negative skip-grams do not lead to satisfactory performances in this task.
|
| 263 |
+
|
| 264 |
+
To achieve this goal, we proposed an interpretable and scalable embedding method called distributional inclusion vector embedding (DIVE) by performing non-negative matrix factorization (NMF) on a weighted PMI matrix. We demonstrate that scoring functions which measure inclusion and generality properties in SBOW can also be applied to DIVE to detect hypernymy, and DIVE performs the best on average, slightly better than SBOW while using many fewer dimensions.
|
| 265 |
+
|
| 266 |
+
Our experiments also indicate that unsupervised scoring functions, which combine similarity and generality measurements, work the best in general, but no one scoring function dominates across all datasets. A combination of unsupervised DIVE with the proposed scoring functions produces new state-of-the-art performances on many datasets under the unsupervised setup.
|
| 267 |
+
|
| 268 |
+
Finally, a qualitative experiment shows that clusters of the topics discovered by DIVE often correspond to the word senses, which allow us to do word sense disambiguation without the need to know the number of senses before training the embeddings.
|
| 269 |
+
|
| 270 |
+
# REFERENCES
|
| 271 |
+
|
| 272 |
+
Ben Athiwaratkun and Andrew Gordon Wilson. Multimodal word distributions. In ACL, 2017.
|
| 273 |
+
|
| 274 |
+
Marco Baroni and Alessandro Lenci. How we BLESSed distributional semantic evaluation. In Workshop on GEometrical Models of Natural Language Semantics (GEMS), 2011.
|
| 275 |
+
|
| 276 |
+
Marco Baroni, Silvia Bernardini, Adriano Ferraresi, and Eros Zanchetta. The WaCky wide web: a collection of very large linguistically processed web-crawled corpora. Language resources and evaluation, 43(3):209–226, 2009.
|
| 277 |
+
|
| 278 |
+
Marco Baroni, Raffaella Bernardi, Ngoc-Quynh Do, and Chung-chieh Shan. Entailment above the word level in distributional semantics. In EACL, 2012.
|
| 279 |
+
|
| 280 |
+
Giulia Benotto. Distributional models for semantic relations: A study on hyponymy and antonymy. PhD Thesis, University of Pisa, 2015.
|
| 281 |
+
|
| 282 |
+
John A Bullinaria and Joseph P Levy. Extracting semantic representations from word co-occurrence statistics: A computational study. Behavior research methods, 39(3):510–526, 2007.
|
| 283 |
+
|
| 284 |
+
Philipp Cimiano, Andreas Hotho, and Steffen Staab. Learning concept hierarchies from text corpora using formal concept analysis. J. Artif. Intell. Res.(JAIR), 24(1):305–339, 2005.
|
| 285 |
+
|
| 286 |
+
Daoud Clarke. Context-theoretic semantics for natural language: an overview. In workshop on geometrical models of natural language semantics, pp. 112–119, 2009.
|
| 287 |
+
|
| 288 |
+
Thomas Demeester, Tim Rocktaschel, and Sebastian Riedel. Lifted rule injection for relation em- ¨ beddings. In EMNLP, 2016.
|
| 289 |
+
|
| 290 |
+
Chris Ding, Xiaofeng He, and Horst D Simon. On the equivalence of nonnegative matrix factorization and spectral clustering. In ICDM, 2005.
|
| 291 |
+
|
| 292 |
+
Manaal Faruqui, Yulia Tsvetkov, Dani Yogatama, Chris Dyer, and Noah Smith. Sparse overcomplete word vector representations. In ACL, 2015.
|
| 293 |
+
|
| 294 |
+
Maayan Geffet and Ido Dagan. The distributional inclusion hypotheses and lexical entailment. In ACL, 2005.
|
| 295 |
+
|
| 296 |
+
Goran Glavas and Simone Paolo Ponzetto. Dual tensor model for detecting asymmetric lexico- ˇ semantic relations. In EMNLP, 2017.
|
| 297 |
+
|
| 298 |
+
Zhiheng Huang, Marcus Thint, and Zengchang Qin. Question classification using head words and their hypernyms. In EMNLP, 2008.
|
| 299 |
+
|
| 300 |
+
Douwe Kiela, Laura Rimell, Ivan Vulic, and Stephen Clark. Exploiting image generality for lexical entailment detection. In ACL, 2015.
|
| 301 |
+
|
| 302 |
+
Diederik Kingma and Jimmy Ba. ADAM: A method for stochastic optimization. In ICLR, 2015.
|
| 303 |
+
|
| 304 |
+
Lili Kotlerman, Ido Dagan, Idan Szpektor, and Maayan Zhitomirsky-Geffet. Directional distributional similarity for lexical inference. Natural Language Engineering, 16(4):359–389, 2010.
|
| 305 |
+
|
| 306 |
+
Alessandro Lenci and Giulia Benotto. Identifying hypernyms in distributional semantic spaces. In SemEval, 2012.
|
| 307 |
+
|
| 308 |
+
Omer Levy and Yoav Goldberg. Neural word embedding as implicit matrix factorization. In NIPS, 2014.
|
| 309 |
+
|
| 310 |
+
Omer Levy, Ido Dagan, and Jacob Goldberger. Focused entailment graphs for open IE propositions. In CoNLL, 2014.
|
| 311 |
+
|
| 312 |
+
Omer Levy, Yoav Goldberg, and Ido Dagan. Improving distributional similarity with lessons learned from word embeddings. Transactions of the Association for Computational Linguistics, 3:211– 225, 2015a.
|
| 313 |
+
|
| 314 |
+
Omer Levy, Steffen Remus, Chris Biemann, and Ido Dagan. Do supervised distributional methods really learn lexical inference relations? In NAACL-HTL, 2015b.
|
| 315 |
+
|
| 316 |
+
Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In NIPS, 2013.
|
| 317 |
+
|
| 318 |
+
George A. Miller. Wordnet: a lexical database for english. Communications of the ACM, 38(11): 39–41, 1995.
|
| 319 |
+
|
| 320 |
+
Brian Murphy, Partha Talukdar, and Tom Mitchell. Learning effective and interpretable semantic models using non-negative sparse embedding. COLING, pp. 1933–1950, 2012.
|
| 321 |
+
|
| 322 |
+
Eric Nalisnick and Sachin Ravi. Infinite dimensional word embeddings. arXiv preprint arXiv:1511.05392, 2015.
|
| 323 |
+
|
| 324 |
+
Arvind Neelakantan, Jeevan Shankar, Alexandre Passos, and Andrew McCallum. Efficient nonparametric estimation of multiple embeddings per word in vector space. In EMNLP, 2014.
|
| 325 |
+
|
| 326 |
+
Kim Anh Nguyen, Maximilian Koper, Sabine Schulte im Walde, and Ngoc Thang Vu. Hierarchical ¨ embeddings for hypernymy detection and directionality. In EMNLP, 2017.
|
| 327 |
+
|
| 328 |
+
Maximilian Nickel and Douwe Kiela. Poincare embeddings for learning hierarchical representa- ´ tions. In NIPS, 2017.
|
| 329 |
+
|
| 330 |
+
V. Paul Pauca, Farial Shahnaz, Michael W Berry, and Robert J. Plemmons. Text mining using non-negative matrix factorizations. In ICDM, 2004.
|
| 331 |
+
|
| 332 |
+
F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12(Oct):2825–2830, 2011.
|
| 333 |
+
|
| 334 |
+
Maria Pelevina, Nikolay Arefyev, Chris Biemann, and Alexander Panchenko. Making sense of word embeddings. In Workshop on Representation Learning for NLP, 2016.
|
| 335 |
+
|
| 336 |
+
Simone Paolo Ponzetto and Michael Strube. Exploiting semantic role labeling, wordnet and wikipedia for coreference resolution. In ACL, 2006.
|
| 337 |
+
|
| 338 |
+
Stephen Roller and Katrin Erk. Relations such as hypernymy: Identifying and exploiting hearst patterns in distributional vectors for lexical entailment. In EMNLP, 2016.
|
| 339 |
+
|
| 340 |
+
Mark Sammons, V Vydiswaran, and Dan Roth. Recognizing textual entailment. Multilingual Natural Language Applications: From Theory to Practice. Prentice Hall, Jun, 2011.
|
| 341 |
+
|
| 342 |
+
Enrico Santus, Alessandro Lenci, Qin Lu, and Sabine Schulte Im Walde. Chasing hypernyms in vector spaces with entropy. In EACL, 2014.
|
| 343 |
+
|
| 344 |
+
Enrico Santus, Frances Yung, Alessandro Lenci, and Chu-Ren Huang. EVALution 1.0: an evolving semantic dataset for training and evaluation of distributional semantic models. In Workshop on Linked Data in Linguistics (LDL), 2015.
|
| 345 |
+
|
| 346 |
+
Enrico Santus, Tin-Shing Chiu, Qin Lu, Alessandro Lenci, and Chu-Ren Huang. Unsupervised measure of word similarity: how to outperform co-occurrence and vector cosine in vsms. arXiv preprint arXiv:1603.09054, 2016.
|
| 347 |
+
|
| 348 |
+
Enrico Santus, Vered Shwartz, and Dominik Schlechtweg. Hypernyms under siege: Linguisticallymotivated artillery for hypernymy detection. In EACL, 2017.
|
| 349 |
+
|
| 350 |
+
David Sculley. Web-scale k-means clustering. In WWW, 2010.
|
| 351 |
+
|
| 352 |
+
Vered Shwartz, Yoav Goldberg, and Ido Dagan. Improving hypernymy detection with an integrated path-based and distributional method. In ACL, 2016.
|
| 353 |
+
|
| 354 |
+
X Yu Stella and Jianbo Shi. Multiclass spectral clustering. In ICCV, 2003.
|
| 355 |
+
|
| 356 |
+
Fei Tian, Hanjun Dai, Jiang Bian, Bin Gao, Rui Zhang, Enhong Chen, and Tie-Yan Liu. A probabilistic model for learning multi-prototype word embeddings. In COLING, 2014.
|
| 357 |
+
|
| 358 |
+
Peter D Turney and Saif M Mohammad. Experiments with three approaches to recognizing lexical entailment. Natural Language Engineering, 21(3):437–476, 2015.
|
| 359 |
+
|
| 360 |
+
Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. In ICLR, 2016.
|
| 361 |
+
|
| 362 |
+
Luke Vilnis and Andrew McCallum. Word representations via gaussian embedding. In ICLR, 2015.
|
| 363 |
+
|
| 364 |
+
Ivan Vulic and Nikola Mrk ´ siˇ c. Specialising word vectors for lexical entailment. ´ arXiv preprint arXiv:1710.06371, 2017.
|
| 365 |
+
|
| 366 |
+
Ivan Vulic, Daniela Gerz, Douwe Kiela, Felix Hill, and Anna Korhonen. Hyperlex: A large-scale ´ evaluation of graded lexical entailment. arXiv preprint arXiv:1608.02117, 2016.
|
| 367 |
+
|
| 368 |
+
Yogarshi Vyas and Marine Carpuat. Sparse bilingual word representations for cross-lingual lexical entailment. In HLT-NAACL, 2016.
|
| 369 |
+
|
| 370 |
+
Julie Weeds and David Weir. A general framework for distributional similarity. In EMNLP, 2003.
|
| 371 |
+
|
| 372 |
+
Julie Weeds, Daoud Clarke, Jeremy Reffin, David Weir, and Bill Keller. Learning to distinguish hypernyms and co-hyponyms. In COLING, 2014.
|
| 373 |
+
|
| 374 |
+
Table 8: Comparison with semi-supervised embeddings (with limited training data). All values are percentages. The number in parentheses beside each approach indicates the number of annotated hypernymy word pairs used to train the model. Semi-supervised embeddings include HyperScore (Nguyen et al., 2017) and H-feature (Roller & Erk, 2016). When we compare F1 with the results from other papers, we use 20 fold cross validation to determine prediction thresholds, as done by Roller & Erk (2016). Note that HyperScore ignores POS in the testing data, so we follow the setup when comparing with it.
|
| 375 |
+
|
| 376 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>HyperLex</td><td rowspan=1 colspan=3>EVALution LenciBenotto Weeds</td><td rowspan=1 colspan=1>Medical</td></tr><tr><td rowspan=1 colspan=1>Metric</td><td rowspan=1 colspan=1>Spearman p</td><td rowspan=1 colspan=3>AP@all</td><td rowspan=1 colspan=1>F1</td></tr><tr><td rowspan=2 colspan=1>Baselines(#Training Hypernymy)</td><td rowspan=1 colspan=4>HyperScore(1337)</td><td rowspan=1 colspan=1>H-feature (897)</td></tr><tr><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>39</td><td rowspan=1 colspan=1>44.8</td><td rowspan=1 colspan=1>58.5</td><td rowspan=1 colspan=1>26</td></tr><tr><td rowspan=1 colspan=1>DIVE+C·△S (0)</td><td rowspan=1 colspan=1>34.5</td><td rowspan=1 colspan=1>33.8</td><td rowspan=1 colspan=1>52.9</td><td rowspan=1 colspan=1>70.0</td><td rowspan=1 colspan=1>25.3</td></tr></table>
|
| 377 |
+
|
| 378 |
+
Table 9: We show the top 30 words with the highest embedding magnitude after dot product with the query embedding $\mathbf { q }$ (i.e. showing w such that $| \mathbf { w } ^ { T } \mathbf { q } | _ { 1 }$ is one of the top 30 highest values). The rows with the empty query word sort words based on $| \mathbf { w } | _ { 1 }$ .
|
| 379 |
+
|
| 380 |
+
<table><tr><td>Query</td><td colspan="6">Top30 generalwords</td></tr><tr><td></td><td>use large american design study</td><td>name state life work lead</td><td>system group may produce type</td><td>include power small control people</td><td>base death find great high</td><td>city form body write create</td></tr><tr><td>species</td><td>specie human gene fish evidence</td><td>species bird tree disease breed</td><td>animal genus name live protein</td><td>find family genetic food wild</td><td>plant organism study cell similar</td><td>may suggest occur mammal fossil</td></tr><tr><td>system</td><td>system standard allow process network</td><td>use type function code file</td><td>design computer datum via development</td><td>provide application device base service</td><td>operate develop control program transport</td><td>model method information software law</td></tr></table>
|
| 381 |
+
|
| 382 |
+
# A SUPPLEMENTARY MATERIALS
|
| 383 |
+
|
| 384 |
+
# A.1 COMPARISON WITH SEMI-SUPERVISED EMBEDDINGS
|
| 385 |
+
|
| 386 |
+
In addition to the unsupervised approach, we also compare DIVE with semi-supervised approaches. When there are sufficient training data, there is no doubt that the semi-supervised embedding approaches such as HyperNet (Shwartz et al., 2016), H-feature detector (Roller & Erk, 2016), and HyperScore (Nguyen et al., 2017) can achieve better performance than all unsupervised methods. However, in many domains such as scientific literature, there are often not many annotated hypernymy pairs (e.g. Medical dataset (Levy et al., 2014)).
|
| 387 |
+
|
| 388 |
+
Since we are comparing an unsupervised method with semi-supervised methods, it is hard to fairly control the experimental setups and tune the hyper-parameters. In Table 8, we only show several performances which are copied from the original paper when training data are limited3. As we can see, the performance from DIVE is roughly comparable to the previous semi-supervised approaches trained on small amount of hypernym pairs. This demonstrates the robustness of our approach and the difficulty of generalizing hypernymy annotations with semi-supervised approaches.
|
| 389 |
+
|
| 390 |
+
# A.2 GENERALITY ESTIMATION AND HYPERNYM DIRECTIONALITY DETECTION
|
| 391 |
+
|
| 392 |
+
In Table 9, we show the most general words in DIVE under different queries as constraints. We also present the accuracy of judging which word is a hypernym (more general) given word pairs with
|
| 393 |
+
|
| 394 |
+
Table 10: Accuracy $( \% )$ of hypernym directionality prediction across 10 datasets.
|
| 395 |
+
|
| 396 |
+
<table><tr><td rowspan=1 colspan=4>Micro Average (1O datasets)</td></tr><tr><td rowspan=1 colspan=1>SBOW Freq+ SLQS Sub64.4</td><td rowspan=1 colspan=1>SBOW Freq +△S66.8</td><td rowspan=1 colspan=1>SBOW PPMI+△S66.8</td><td rowspan=1 colspan=1>DIVE+△S67.0</td></tr></table>
|
| 397 |
+
|
| 398 |
+
Table 11: Dataset sizes. N denotes the number of word pairs in the dataset, and OOV shows how many word pairs are not processed by all the methods in Table 4 and Table 5.
|
| 399 |
+
|
| 400 |
+
<table><tr><td colspan="2">BLESS</td><td colspan="2">EVALution</td><td colspan="2">Lenci/Benotto</td><td colspan="2">Weeds</td><td colspan="2">Avg (4 datasets)</td></tr><tr><td>N 26554</td><td>0OV 1507</td><td>N 13675</td><td>OOV 2475</td><td>N 5010</td><td>OOV 1464</td><td>N 2928</td><td>0OV 643</td><td>N 48167</td><td>OOv 6089</td></tr><tr><td colspan="2">Medical</td><td colspan="2"></td><td colspan="2"></td><td colspan="2">Kotlerman 2010</td><td colspan="2"></td></tr><tr><td colspan="2">N</td><td colspan="2">LEDS</td><td colspan="2">TM14</td><td colspan="2"></td><td colspan="2">HyperNet</td></tr><tr><td>12602</td><td>OOV 3711</td><td>N</td><td>OOV 28</td><td>N</td><td>OOV 178</td><td>N</td><td>OOV 89</td><td>N</td><td>OOV 9424</td></tr><tr><td colspan="2"></td><td colspan="2">2770</td><td colspan="2">2188</td><td colspan="2">2940</td><td colspan="2">17670</td></tr><tr><td colspan="2">WordNet</td><td colspan="2">Avg(10 datasets)</td><td colspan="2">HyperLex</td><td colspan="2"></td><td colspan="2"></td></tr><tr><td colspan="2">N OOV</td><td colspan="2">N</td><td colspan="2">N</td><td colspan="2"></td><td colspan="2"></td></tr><tr><td colspan="2">8000 3596</td><td colspan="2">94337</td><td colspan="2">2616</td><td colspan="2">0OV 59</td><td colspan="2"></td></tr></table>
|
| 401 |
+
|
| 402 |
+
hypernym relations in Table 10. The direction is classified correctly if the generality score is greater than 0 (hypernym is indeed predicted as the more general word). For instance, summation difference $( \Delta \mathsf { S } )$ classifies correctly if $\vert \mathbf { \bar { w } } _ { p } \vert _ { 1 } - \vert \mathbf { w } _ { q } \vert _ { 1 } > 0$ $( | \bar { \mathbf { w } _ { p } } | _ { 1 } > | \mathbf { w } _ { q } | _ { 1 } )$ .
|
| 403 |
+
|
| 404 |
+
From the table, we can see that the simple summation difference performs better than SQLS Sub, and DIVE predicts directionality as well as SBOW. Notice that whenever we encounter OOV, the directionality is predicted randomly. If OOV is excluded, the accuracy of predicting directionality using unsupervised methods can reach around 0.7-0.75.
|
| 405 |
+
|
| 406 |
+
# A.3 EXPERIMENTAL DETAILS FOR HYPERNYMY DETECTION
|
| 407 |
+
|
| 408 |
+
In HyperNet and WordNet, some hypernym relations are determined between phrases instead of words. Phrase embeddings are composed by averaging word embeddings or SBOW features. For WordNet, we assume the Part of Speech (POS) tags of the words are the same as the phrase. All part-of-speech (POS) tags in the experiments come from NLTK.
|
| 409 |
+
|
| 410 |
+
The window size $| W |$ of SBOW, DIVE, and GE are set as 20 (left 10 words and right 10 words). For DIVE, the number of epochs is 15, the learning rate is 0.001, the batch size is 128, the threshold in PMI filter $k _ { f }$ is set to be 30, and the ratio between negative and positive samples ${ \mathrm { ( k ) } }$ is 1.5. The hyper-parameters of DIVE were decided based on the performance of HyperNet training set. The window size of skip-grams (word2vec) is 10. The number of negative samples $( k ^ { \prime } )$ in skip-gram is set as 5. When composing skip gram into phrase embedding, average embedding is used.
|
| 411 |
+
|
| 412 |
+
For Gaussian embedding (GE), the number of mixture is 1, the number of dimension is 100, the learning rate is 0.01, the lowest variance is 0.1, the highest variance is 100, the highest Gaussian mean is 10, and other hyper-parameters are the default value in https://github.com/ benathi/word2gm. The hyper-parameters of GE were also decided based on the performance of HyperNet training set. When determining the score between two phrases, we use the average score of every pair of tokens in two phrases.
|
| 413 |
+
|
| 414 |
+
The number of testing pairs $_ \mathrm { N }$ and the number of OOV word pairs is presented in Table 11.
|
| 415 |
+
|
| 416 |
+
# A.4 CLUSTERING DIMENSIONS FOR WORD SENSE DISAMBIGUATION
|
| 417 |
+
|
| 418 |
+
We use all the default hyper-parameters of the spectral clustering library in Scikit-learn 0.18.2 (Pedregosa et al., 2011) except the number of clusters is set manually. A simple way to prepare the feature of each dimension $f ( c _ { i } )$ is to use the embedding values in that dimension $\mathbf { w } [ c _ { i } ]$ of all the words in our vocabulary $w \in V$ . That is,
|
| 419 |
+
|
| 420 |
+
$$
|
| 421 |
+
f ( c _ { i } ) = [ \mathbf { w } [ c _ { i } ] ] _ { w \in V } .
|
| 422 |
+
$$
|
| 423 |
+
|
| 424 |
+
However, clustering on the global features might group topics together based on the co-occurrence of words which are unrelated to the query words and we want to make the similarity dependent on the query word. For example, a country topic should be clustered together with a city topic if the query word is place, but it makes more sense to group the country topic with the money topic together if the query word is bank like we did in the word sense disambiguation experiment (Table 7). This means we want to focus on the geographical meaning of country when the query is related to geography, while focus on the economic meaning of country when the query is about economics.
|
| 425 |
+
|
| 426 |
+
To create query dependent similarity measurement, we only consider the embedding of words which are related to the query word when preparing the features of dimensions. Specifically, given a query word $q$ , the feature vector of the $i$ th dimension $f ( c _ { i } , q )$ is defined as:
|
| 427 |
+
|
| 428 |
+
$$
|
| 429 |
+
f ( c _ { i } , q ) = \bigoplus _ { j = 1 } ^ { d _ { 0 } } \left[ \mathbf { w } [ c _ { i } ] \cdot \mathbf { w } _ { q } [ c _ { j } ] \right] _ { w \in C _ { j } ( n ) } ,
|
| 430 |
+
$$
|
| 431 |
+
|
| 432 |
+
where ${ \bf w } _ { q } [ c _ { j } ]$ is the value of $j$ th dimension of query word embedding, $C _ { j } ( n )$ is the set of embeddings of top $n$ words in the $j$ th dimension, and the operator $\oplus$ means concatenation. This means instead of considering all the words in the vocabulary, we only take the top $n$ words of every dimension $j$ (n is fixed as 100 in the experiment), weight the feature based on how likely to observe query word in dimension $j$ $( \mathbf { w } _ { q } [ c _ { j } ] )$ , and concatenate all features together. That is, when measuring the similarity of dimensions, we only consider the aspects related to query word (e.g. mostly considering words related to facility and money when the query word is bank).
|
| 433 |
+
|
| 434 |
+
After the features of all dimensions are collected, we normalize the feature of each dimension to have the norm 1, compute the pairwise similarity and run the spectral clustering to get the clustering results.
|
| 435 |
+
|
| 436 |
+
# A.5 EFFICIENT WAY TO COMPUTE ASYMMETRIC L1 $( A L _ { 1 } )$
|
| 437 |
+
|
| 438 |
+
Recall that Equation (8) defines $A L _ { 1 }$ as follows:
|
| 439 |
+
|
| 440 |
+
$$
|
| 441 |
+
A L _ { 1 } = \mathcal { L } = \operatorname* { m i n } _ { a } \ \sum _ { c } w _ { 0 } \operatorname* { m a x } ( a \mathbf { d } _ { q } [ c ] - \mathbf { d } _ { p } [ c ] , 0 ) + \operatorname* { m a x } ( \mathbf { d } _ { p } [ c ] - a \mathbf { d } _ { q } [ c ] , 0 ) ,
|
| 442 |
+
$$
|
| 443 |
+
|
| 444 |
+
where $\mathbf { d } _ { p } [ c ]$ is one of dimension in the feature vector of hypernym $\mathbf { d } _ { p }$ , $a \mathbf { d } _ { q }$ is the feature vector of hyponym after proper scaling. In Figure 2, an simple example is visualized to illustrate the intuition behind the distance function.
|
| 445 |
+
|
| 446 |
+
By adding slack variables $\zeta$ and $\xi$ , the problem could be converted into a linear programming problem:
|
| 447 |
+
|
| 448 |
+
$$
|
| 449 |
+
\begin{array} { l } { \mathcal { L } = \displaystyle \operatorname* { m i n } _ { a , \zeta , \xi } ~ w _ { 0 } \sum _ { c } \zeta _ { c } + \sum _ { c } \xi _ { c } } \\ { ~ \zeta _ { c } \geq a \mathbf { d } _ { q } [ c ] - \mathbf { d } _ { p } [ c ] , ~ \zeta _ { c } \geq 0 } \\ { \displaystyle ~ \xi _ { c } \geq \mathbf { d } _ { p } [ c ] - a \mathbf { d } _ { q } [ c ] , ~ \xi _ { c } \geq 0 } \\ { ~ a \geq 0 , ~ } \end{array}
|
| 450 |
+
$$
|
| 451 |
+
|
| 452 |
+
so it can be simply solved by a general linear programming library.
|
| 453 |
+
|
| 454 |
+
Nevertheless, the structure in the problem actually allows us to solve this optimization by a simple sorting. In this section, we are going to derive the efficient optimization algorithm.
|
| 455 |
+
|
| 456 |
+
By introducing Lagrangian multiplier for the constraints, we can rewrite the problem as
|
| 457 |
+
|
| 458 |
+
$$
|
| 459 |
+
\begin{array} { l l } { { \mathcal { L } = \displaystyle \operatorname* { m i n } _ { a , \zeta , \xi } \operatorname* { m a x } _ { \alpha , \beta , \gamma , \delta } w _ { 0 } \sum _ { c } \zeta _ { c } + \sum _ { c } \xi _ { c } - \sum _ { c } \alpha _ { c } ( \zeta _ { c } - a { \bf d } _ { q } [ c ] + { \bf d } _ { p } [ c ] ) } } \\ { { \mathrm { ~ } } } \\ { { \mathrm { ~ } - \sum _ { c } \beta _ { c } ( \xi _ { c } - { \bf d } _ { p } [ c ] + a { \bf d } _ { q } [ c ] ) - \sum _ { c } \gamma _ { c } \zeta _ { c } - \sum _ { c } \delta _ { c } \xi _ { c } } } \\ { { \mathrm { ~ } } } \\ { { \zeta _ { c } \geq 0 , \xi _ { c } \geq 0 , \alpha _ { c } \geq 0 , \beta _ { c } \geq 0 , \gamma _ { c } \geq 0 , \delta _ { c } \geq 0 , a \geq 0 } } \end{array}
|
| 460 |
+
$$
|
| 461 |
+
|
| 462 |
+

|
| 463 |
+
Figure 2: An example of $A L _ { 1 }$ distance. If the word pair indeed has the hypernym relation, the context distribution of hyponym $( \mathbf { d } _ { q } )$ tends to be included in the context distribution of hypernym $( \mathbf { d } _ { p } )$ after proper scaling according to DIH. Thus, the context words only appear beside the hyponym candidate $( a \mathbf { d } _ { q } [ c ] - \mathbf { d } _ { p } [ c ] )$ causes higher penalty.
|
| 464 |
+
|
| 465 |
+
First, we eliminate the slack variables by taking derivatives with respect to them:
|
| 466 |
+
|
| 467 |
+
$$
|
| 468 |
+
\begin{array} { r l r } { \displaystyle \frac { \partial \mathcal { L } } { \partial \zeta _ { c } } = 0 = 1 - \beta _ { c } - \delta _ { c } } & { } & \\ { \displaystyle \delta _ { c } = 1 - \beta _ { c } , ~ \beta _ { c } \le 1 } & { } \\ { \displaystyle \frac { \partial \mathcal { L } } { \partial \xi _ { c } } = 0 = 1 - \gamma _ { c } - \alpha _ { c } } & { } \\ { \displaystyle \gamma _ { c } = w _ { 0 } - \alpha _ { c } , ~ \alpha _ { c } \le w _ { 0 } . } & { } \end{array}
|
| 469 |
+
$$
|
| 470 |
+
|
| 471 |
+
By substituting in these values for $\gamma _ { c }$ and $\delta _ { c }$ , we get rid of the slack variables and have a new Lagrangian:
|
| 472 |
+
|
| 473 |
+
$$
|
| 474 |
+
\begin{array} { c l l } { { } } & { { { \mathcal { L } } = \underset { a } { \mathrm { m i n } } \underset { \alpha , \beta } { \mathrm { m a x } } ~ - \sum _ { c } \alpha _ { c } ( - a \mathbf { d } _ { q } [ c ] + \mathbf { d } _ { p } [ c ] ) - \sum _ { c } \beta _ { c } ( - \mathbf { d } _ { p } [ c ] + a \mathbf { d } _ { q } [ c ] ) } } \\ { { } } & { { } } \\ { { } } & { { 0 \leq \alpha _ { c } \leq w _ { 0 } , 0 \leq \beta _ { c } \leq 1 , a \geq 0 } } \end{array}
|
| 475 |
+
$$
|
| 476 |
+
|
| 477 |
+
We can introduce a new dual variable $\lambda _ { c } = \alpha _ { c } - \beta _ { c } + 1$ and rewrite this as:
|
| 478 |
+
|
| 479 |
+
$$
|
| 480 |
+
\begin{array} { c } { \mathcal { L } = \displaystyle \underset { a } { \mathrm { m i n } } \displaystyle \operatorname* { m a x } _ { \lambda } \ \sum _ { c } ( \lambda _ { c } - 1 ) ( a \mathbf { d } _ { q } [ c ] - \mathbf { d } _ { p } [ c ] ) } \\ { 0 \leq \lambda _ { c } \leq w _ { 0 } + 1 , a \geq 0 } \end{array}
|
| 481 |
+
$$
|
| 482 |
+
|
| 483 |
+
Let’s remove the constraint on $a$ and replace with a dual variable $\eta$ :
|
| 484 |
+
|
| 485 |
+
$$
|
| 486 |
+
\begin{array} { c } { \mathcal { L } = \displaystyle \underset { a } { \mathrm { m i n } } \displaystyle \operatorname* { m a x } _ { \lambda } \ \sum _ { c } ( \lambda _ { c } - 1 ) ( a \mathbf { d } _ { q } [ c ] - \mathbf { d } _ { p } [ c ] ) - \eta a } \\ { 0 \leq \lambda _ { c } \leq w _ { 0 } + 1 , \eta \geq 0 } \end{array}
|
| 487 |
+
$$
|
| 488 |
+
|
| 489 |
+
Now let’s differentiate with respect to $a$ to get rid of the primal objective and add a new constraint:
|
| 490 |
+
|
| 491 |
+
$$
|
| 492 |
+
\begin{array} { c } { { \displaystyle \frac { \partial \mathcal { L } } { \partial a } = 0 = \sum _ { c } \lambda _ { c } \mathbf { d } _ { q } [ c ] - \sum _ { c } \mathbf { d } _ { q } [ c ] - \eta } } \\ { { \displaystyle \sum _ { c } \lambda _ { c } \mathbf { d } _ { q } [ c ] = \sum _ { c } \mathbf { d } _ { q } [ c ] + \eta } } \\ { { \displaystyle \mathcal { L } = \operatorname* { m a x } _ { \lambda } \ \sum _ { c } \mathbf { d } _ { p } [ c ] - \sum _ { c } \lambda _ { c } \mathbf { d } _ { p } [ c ] } } \\ { { \displaystyle \sum _ { c } \lambda _ { c } \mathbf { d } _ { q } [ c ] = \sum _ { c } \mathbf { d } _ { q } [ c ] + \eta } } \\ { { \displaystyle 0 \leq \lambda _ { c } \leq w _ { 0 } + 1 , \eta \geq 0 } } \end{array}
|
| 493 |
+
$$
|
| 494 |
+
|
| 495 |
+
Now we have some constant terms that are just the sums of $\mathbf { d } _ { p }$ and ${ \mathbf { d } } _ { q }$ , which will be 1 if they are distributions.
|
| 496 |
+
|
| 497 |
+
$$
|
| 498 |
+
\begin{array} { l } { \displaystyle \mathcal { L } = \displaystyle \operatorname* { m a x } _ { \lambda } ~ 1 - \sum _ { c } \lambda _ { c } \mathbf { d } _ { p } [ c ] } \\ { \displaystyle \sum _ { c } \lambda _ { c } \mathbf { d } _ { q } [ c ] = 1 + \eta } \\ { \displaystyle 0 \leq \lambda _ { c } \leq w _ { 0 } + 1 , \eta \geq 0 } \end{array}
|
| 499 |
+
$$
|
| 500 |
+
|
| 501 |
+
Now we introduce a new set of variables $\mu _ { c } = \lambda _ { c } \mathbf { d } _ { q } [ c ]$ and we can rewrite the objective as:
|
| 502 |
+
|
| 503 |
+
$$
|
| 504 |
+
\begin{array} { l } { \displaystyle \mathcal { L } = \underset { \mu } { \mathrm { m a x } } ~ 1 - \sum _ { c } \mu _ { c } \frac { \mathbf { d } _ { p } [ c ] } { \mathbf { d } _ { q } [ c ] } } \\ { \displaystyle \sum _ { c } \mu _ { c } = 1 + \eta } \\ { \displaystyle 0 \leq \mu _ { c } \leq ( w _ { 0 } + 1 ) \mathbf { d } _ { q } [ c ] , \eta \geq 0 } \end{array}
|
| 505 |
+
$$
|
| 506 |
+
|
| 507 |
+
Note that for terms where $\mathbf { d } _ { q } [ c ] = 0$ we can just set $\mathbf { d } _ { q } [ c ] = \epsilon$ for some very small epsilon, and in practice, our algorithm will not encounter these because it sorts.
|
| 508 |
+
|
| 509 |
+
So $\mu$ we can think of as some fixed budget that we have to spend up until it adds up to 1, but it has a limit of how much we can spend for each coordinate, given by $( w _ { 0 } + 1 ) { \bf d } _ { q } [ c ]$ . Since we’re trying to minimize the term involving $\mu$ , we want to allocate as much budget as possible to the smallest terms in the summand, and then 0 to the rest once we’ve spent the budget. This also shows us that our optimal value for the dual variable $\eta$ is just 0 since we want to minimize the amount of budget we have to allocate.
|
| 510 |
+
|
| 511 |
+
To make presentation easier, lets assume we sort the vectors in order of increasing $\begin{array} { r } { \frac { \mathbf { d } _ { p } [ c ] } { \mathbf { d } _ { q } [ c ] } } \end{array}$ , so that $\frac { \mathbf { d } _ { p } [ 1 ] } { \mathbf { d } _ { q } [ 1 ] }$ is the smallest element, etc. We can now give the following algorithm to find the optimal $\mu$ .
|
| 512 |
+
|
| 513 |
+
$$
|
| 514 |
+
\begin{array} { r l } & { \operatorname { i n i t } \ S = 0 , c = 1 , \mu = 0 } \\ & { \operatorname { w h i l e } \ S \le 1 : } \\ & { \ \mu _ { c } = \operatorname* { m i n } ( 1 - S , ( w _ { 0 } + 1 ) { \bf d } _ { q } [ c ] ) } \\ & { \ { S = S + \mu _ { c } } } \\ & { \ { c = c + 1 } } \end{array}
|
| 515 |
+
$$
|
| 516 |
+
|
| 517 |
+
At the end we can just plug in this optimal $\mu$ to the objective to get the value of our scoring function.
|
md/train/YqYt54gU-XV/YqYt54gU-XV.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DiBS: Differentiable Bayesian Structure Learning
|
| 2 |
+
|
| 3 |
+
Lars Lorch ETH Zurich Zurich, Switzerland lars.lorch@inf.ethz.ch
|
| 4 |
+
|
| 5 |
+
Jonas Rothfuss ETH Zurich Zurich, Switzerland jonas.rothfuss@inf.ethz.ch
|
| 6 |
+
|
| 7 |
+
Bernhard Schölkopf
|
| 8 |
+
MPI for Intelligent Systems
|
| 9 |
+
Tübingen, Germany
|
| 10 |
+
bs@tuebingen.mpg.de
|
| 11 |
+
|
| 12 |
+
Andreas Krause ETH Zurich Zurich, Switzerland krausea@ethz.ch
|
| 13 |
+
|
| 14 |
+
# Abstract
|
| 15 |
+
|
| 16 |
+
Bayesian structure learning allows inferring Bayesian network structure from data while reasoning about the epistemic uncertainty—a key element towards enabling active causal discovery and designing interventions in real world systems. In this work, we propose a general, fully differentiable framework for Bayesian structure learning (DiBS) that operates in the continuous space of a latent probabilistic graph representation. Contrary to existing work, DiBS is agnostic to the form of the local conditional distributions and allows for joint posterior inference of both the graph structure and the conditional distribution parameters. This makes our formulation directly applicable to posterior inference of complex Bayesian network models, e.g., with nonlinear dependencies encoded by neural networks. Using DiBS, we devise an efficient, general purpose variational inference method for approximating distributions over structural models. In evaluations on simulated and real-world data, our method significantly outperforms related approaches to joint posterior inference.1
|
| 17 |
+
|
| 18 |
+
# 1 Introduction
|
| 19 |
+
|
| 20 |
+
Discovering the statistical and causal dependencies that underlie the variables of a data-generating system is of central scientific interest. Bayesian networks (BNs) [1] and structural equation models are commonly used for this purpose [2–5]. Structure learning, the task of learning a BN from observations of its variables, is well-studied, but computationally very challenging due to the combinatorially large number of candidate graphs and the constraint of graph acyclicity.
|
| 21 |
+
|
| 22 |
+
While structure learning methods arrive at a single plausible graph or its Markov equivalence class (MEC), e.g., [6–9], Bayesian structure learning aims to infer a full posterior distribution over BNs given the observations. A distribution over structures allows quantifying the epistemic uncertainty and the degree of confidence in any given BN model, e.g., when the amount of data is small. Most importantly, downstream tasks such as experimental design and active causal discovery rely on a posterior distribution over BNs to quantify the information gain from specific interventions and uncover the causal structure in a small number of experiments [10–15].
|
| 23 |
+
|
| 24 |
+
A key challenge in Bayesian structure learning is working with a posterior over BNs—a distribution over the joint space of (discrete) directed acyclic graphs and (continuous) conditional distribution parameters. Most of the practically viable approaches to Bayesian structure learning revolve around
|
| 25 |
+
|
| 26 |
+
Markov chain Monte Carlo (MCMC) sampling in combinatorial spaces and bootstrapping of classical score and constraint-based structure learning methods, e.g., in causal discovery [10–15]. However, these methods marginalize out the parameters and thus require a closed form for the marginal likelihood of the observations given the graph to remain tractable. This limits inference to simple and by now well-studied linear Gaussian and categorical BN models [16–18] and makes it difficult to infer more expressive BNs that, e.g., model nonlinear relationships among the variables. Due to the discrete nature of these approaches, recent advances in approximate inference and gradient-based optimization could not yet be translated into similar performance improvements in Bayesian structure learning.
|
| 27 |
+
|
| 28 |
+
In this work, we propose a novel, fully differentiable framework for Bayesian structure learning (DiBS) that operates in the continuous space of a latent probabilistic graph representation. Contrary to existing work, our formulation is agnostic to the distributional form of the BN and allows for inference of the joint posterior over both the conditional distribution parameters and the graph structure. This makes our approach directly applicable to more flexible BN models where neither the marginal likelihood nor the maximum likelihood parameter estimate have a closed form. We instantiate DiBS with the particle variational inference method of Liu and Wang [19] and present a general purpose method for approximate Bayesian structure learning. In our experiments on synthetic and real-world data, DiBS outperforms all alternative approaches to joint posterior inference of graphs and parameters and when modeling nonlinear interactions among the variables, often by a significant margin. This allows us to narrow down plausible causal graphs with greater precision and make better predictions under interventions—an important stepping stone towards active causal discovery.
|
| 29 |
+
|
| 30 |
+
# 2 Background
|
| 31 |
+
|
| 32 |
+
Bayesian networks A Bayesian network $( \mathbf { G } , \mathbf { \Theta } _ { \mathbf { \Theta } }$ models the joint density $p ( \mathbf { x } )$ of a set of $d$ variables $\mathbf { x } = x _ { 1 : d }$ using (1) a directed acyclic graph (DAG) $\mathbf { G }$ encoding the conditional independencies of $\mathbf { x }$ and (2) parameters $\Theta$ defining the local conditional distributions of each variable given its parents in the DAG. When modeling $p ( \mathbf { x } )$ using a BN, each variable is assumed to be independent of its non-descendants given its parents, thus allowing for a compact factorization of the joint $p ( \mathbf { x } | \mathbf { G } , \Theta )$ into a product of local conditional distributions for each variable and its parents in $\mathbf { G }$ .
|
| 33 |
+
|
| 34 |
+
Bayesian inference of BNs Given independent observations $\mathcal { D } = \{ \mathbf { x } ^ { ( 1 ) } , \ldots , \mathbf { x } ^ { ( N ) } \}$ , we consider the task of inferring a full posterior density over Bayesian networks that model the observations. Following Friedman and Koller [20], given a prior distribution over DAGs $p ( \mathbf G )$ and a prior over BN parameters $p ( \Theta | \mathbf G )$ , Bayes’ Theorem yields the joint and marginal posterior distributions
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\begin{array} { r } { p ( \mathbf { G } , \boldsymbol { \Theta } | \mathcal { D } ) \propto p ( \mathbf { G } ) p ( \boldsymbol { \Theta } | \mathbf { G } ) p ( \mathcal { D } | \mathbf { G } , \boldsymbol { \Theta } ) \ , } \\ { p ( \mathbf { G } | \mathcal { D } ) \propto p ( \mathbf { G } ) p ( \mathcal { D } | \mathbf { G } ) \qquad } \end{array}
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
where $\begin{array} { r } { p ( \mathcal { D } \mid \mathbf { G } ) = \int p ( \Theta \mid \mathbf { G } ) p ( \mathcal { D } \mid \mathbf { G } , \Theta ) d \Theta } \end{array}$ is the marginal likelihood. Thus, $p ( \mathbf G | \mathcal D )$ in (2) is only tractable in special conjugate cases where the integral over $\Theta$ can be computed in closed form. The Bayesian formalism allows us to compute expectations of the form
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\begin{array} { r l } { \mathbb { E } _ { p ( \mathbf { G } , \boldsymbol { \Theta } \mid \mathcal { D } ) } \Big [ f ( \mathbf { G } , \boldsymbol { \Theta } ) \Big ] \qquad \mathrm { o r } \qquad \mathbb { E } _ { p ( \mathbf { G } \mid \mathcal { D } ) } \Big [ f ( \mathbf { G } ) \Big ] } \end{array}
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
for any function $f$ of interest. For instance, to perform Bayesian model averaging, we would use $f ( \mathbf { G } , \boldsymbol { \Theta } ) = p ( \mathbf { x } \mid \mathbf { G } , \boldsymbol { \Theta } )$ or $f ( \mathbf { G } ) = p ( \mathbf { x } | \mathbf { G } )$ , respectively [21, 22]. In active learning of causal BN structures, a commonly used $f$ is the expected decrease in entropy of $\mathbf { G }$ after an intervention [10–12, 14, 15]. Inferring either posterior is computationally challenging because there are $\mathcal { O } ( d ! 2 ^ { ( \frac { d } { 2 } ) } )$ possible DAGs with $d$ nodes [23]. Thus, computing the normalization constant $p ( \mathcal { D } )$ is generally intractable.
|
| 47 |
+
|
| 48 |
+
Continuous characterization of acyclic graphs Orthogonal to the work on Bayesian inference, Zheng et al. [9] have recently proposed a differentiable characterization of acyclic graphs for structure learning. In this work, we adopt the formulation of $\mathrm { Y u }$ et al. [24], who show that a graph with adjacency matrix $\mathbf { G } \in \{ 0 , 1 \} ^ { d \times \dot { d } }$ does not have any cycles if and only if $h ( \mathbf G ) = 0$ , where
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\begin{array} { r } { h ( \mathbf G ) : = \mathrm { t r } \left[ ( \mathbf I + \frac 1 d \mathbf G ) ^ { d } \right] - d . } \end{array}
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
If $h ( \mathbf G ) > 0$ , the function can be interpreted as quantifying the cyclicity or non-DAG-ness of $\mathbf { G }$ . Follow-up work has leveraged this insight to model nonlinear relationships [24–27], time-series data [28], in the context of generative modeling [29, 30], for causal inference [31–33], and contributed to its theoretical understanding [34, 35]. So far, a connection to Bayesian structure learning has been missing.
|
| 55 |
+
|
| 56 |
+
# 3 Related Work
|
| 57 |
+
|
| 58 |
+
The existing literature on Bayesian Structure Learning predominantly focuses on inferring the marginal graph posterior $p ( \mathbf G | \mathcal D )$ . Since this requires $p ( \mathcal { D } | \mathbf { G } )$ to be tractable, inference is limited to BNs with linear Gaussian or Categorical conditional distributions [16–18]. By contrast, the formulation we introduce overcomes this fundamental restriction by allowing for joint inference of the graph and the parameters, thereby facilitating the active (causal) discovery of more expressive BNs.
|
| 59 |
+
|
| 60 |
+
MCMC Sampling from the posterior over graphs is the most general approach to approximate Bayesian structure learning. Structure MCMC $\mathrm { ( M C ^ { 3 } ) }$ [36, 37] performs Metropolis-Hastings in the space of DAGs by changing one edge at a time. Several works try to remedy its poor mixing behavior [38–40]. Alternatively, order MCMC draws samples in the smaller but still exponential space of node orders, which typically requires a hard limit on the maximum parent set size [20]. Attempts to correct for its unintended structural bias are themselves NP-hard to compute and/or limit the parent size [38, 41]. By performing variational inference in a continuous latent space, the method we propose circumvents such mixing issues and parent size limitations.
|
| 61 |
+
|
| 62 |
+
Bootstrapping The nonparametric DAG bootstrap [42] performs model averaging by bootstrapping $\mathcal { D }$ , where each resampled data set is used to learn a single graph, e.g., using the GES or PC algorithms [6, 7]. The obtained set of DAGs approximates the posterior by weighting each unique graph by its unnormalized posterior probability. In simple cases, a closed-form maximum likelihood parameter estimate may be used to approximate the joint posterior [14], but only if $p ( \mathcal { D } | \mathbf { G } )$ is tractable in the first place.
|
| 63 |
+
|
| 64 |
+
Exact methods A few notable exceptions use dynamic programming to achieve exact marginal inference in time $O ( d 2 ^ { d } )$ , which is only feasible for $d \leq 2 0$ nodes [43, 44]. In special cases, e.g., for tree structures or known node orderings, exact inference can be performed more efficiently [45, 46].
|
| 65 |
+
|
| 66 |
+
# 4 A Fully Differentiable Framework for Bayesian Structure Learning
|
| 67 |
+
|
| 68 |
+
# 4.1 General Approach
|
| 69 |
+
|
| 70 |
+
With the goal of moving beyond the restrictive conjugate setups required by most discrete sampling methods for Bayesian structure learning, we propose to transfer the posterior inference task into the latent space of a probabilistic graph representation. Our resulting framework is consistent with the original Bayesian structure learning task in (3), enforces the acyclicity of $\mathbf { G }$ via the latent space prior, and provides the score of the continuous latent posterior, thus making general purpose inference methods applicable off-the-shelf.
|
| 71 |
+
|
| 72 |
+
Without loss of generality, we assume that there exists a latent variable $\mathbf { Z }$ that models the generative process of $\mathbf { G }$ . Specifically, the default generative model described in Section 2 is generalized into the following factorization:
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 1: Generative model of BNs with latent variable $\mathbf { Z }$ This formulation generalizes the standard Bayesian setup in (1) where only $\mathbf { G }$ , $\Theta$ , and $\mathbf { x }$ are modeled explicitly.
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
p ( \mathbf { Z } , \mathbf { G } , \boldsymbol { \Theta } , \mathcal { D } ) = p ( \mathbf { Z } ) p ( \mathbf { G } \mid \mathbf { Z } ) p ( \boldsymbol { \Theta } \mid \mathbf { G } ) p ( \mathcal { D } \mid \mathbf { G } , \boldsymbol { \Theta } )
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
Figure 1 displays the corresponding graphical model. The following insight provides us with an equivalence between the expectation we ultimately want to approximate and an expectation over the posterior of the continuous variable $\mathbf { Z }$ :
|
| 82 |
+
|
| 83 |
+
Proposition 1 (Latent posterior expectation). Under the generative model in (5), it holds that
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\begin{array} { r l } & { \mathbb { E } _ { p ( { \mathbf G } \mid \mathcal { D } ) } \Big [ f ( { \mathbf G } ) \Big ] \ = \ \mathbb { E } _ { p ( { \mathbf G } \mid \mathcal { D } ) } \Bigg [ \frac { \mathbb { E } _ { p ( { \mathbf G } \mid { \mathbf Z } ) } \big [ f ( { \mathbf G } ) p ( \mathcal { D } \mid { \mathbf G } ) \big ] } { \mathbb { E } _ { p ( { \mathbf G } \mid { \mathbf Z } ) } \big [ p ( \mathcal { D } \mid { \mathbf G } ) \big ] } \Bigg ] \ , a n d } \\ & { \mathbb { E } _ { p ( { \mathbf G } , { \boldsymbol \Theta } \mid \mathcal { D } ) } \Big [ f ( { \mathbf G } , { \boldsymbol \Theta } ) \Big ] \ = \ \mathbb { E } _ { p ( { \mathbf Z } , { \boldsymbol \Theta } \mid \mathcal { D } ) } \Bigg [ \frac { \mathbb { E } _ { p ( { \mathbf G } \mid { \mathbf Z } ) } \big [ f ( { \mathbf G } , { \boldsymbol \Theta } ) p ( { \boldsymbol \Theta } \mid { \mathbf G } ) p ( \mathcal { D } \mid { \mathbf G } , { \boldsymbol \Theta } ) \big ] } { \mathbb { E } _ { p ( { \mathbf G } \mid { \mathbf Z } ) } \big [ p ( { \boldsymbol \Theta } \mid { \mathbf G } ) p ( \mathcal { D } \mid { \mathbf G } , { \boldsymbol \Theta } ) \big ] } \Bigg ] \ . } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
A proof is provided in Appendix A.1. Rather than approximating $p ( \mathbf G | \mathcal D )$ or $p ( \mathbf { G } , \boldsymbol { \Theta } | \mathcal { D } )$ , our goal will be to infer $p ( \mathbf { Z } | \bar { \mathcal { D } } )$ or $p ( \mathbf { Z } , \boldsymbol { \Theta } | \mathcal { D } )$ instead, which by Proposition 1 allows us to compute
|
| 90 |
+
|
| 91 |
+
expectations of the form in (3). In the following, we first discuss how to define the two factors $p ( \mathbf { \bar { G } } | \mathbf { Z } )$ and $p ( \mathbf { Z } )$ in a way that models only directed acyclic graphs. Then, we provide the details necessary to perform black box inference of the posteriors of the continuous latent variable $\mathbf { Z }$ .
|
| 92 |
+
|
| 93 |
+
# 4.2 Representing DAGs in a Continuous Latent Space
|
| 94 |
+
|
| 95 |
+
Generative model of directed graphs We define the latent variable $\mathbf { Z }$ as consisting of two embedding matrices U $\boldsymbol { \mathrm { I } } , \boldsymbol { \mathbf { V } } \in \mathbb { R } ^ { k \times \smile }$ , i.e., $\mathbf { Z } = [ \mathbf { U } , \mathbf { V } ]$ . Building on Kipf and Welling [47], we propose to use a bilinear generative model for the adjacency matrix $\mathbf { G } \in \{ 0 , 1 \} ^ { d \times d }$ of directed graphs using the inner product between the latent variables in $\mathbf { Z }$ :
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
p _ { \alpha } ( \mathbf { G } \mid \mathbf { Z } ) = \prod _ { i = 1 } ^ { d } \prod _ { j \neq i } ^ { d } p _ { \alpha } ( g _ { i j } \mid \mathbf { u } _ { i } , \mathbf { v } _ { j } ) \quad { \mathrm { w i t h } } \quad p _ { \alpha } ( g _ { i j } = 1 \mid \mathbf { u } _ { i } , \mathbf { v } _ { j } ) = \sigma _ { \alpha } ( \mathbf { u } _ { i } ^ { \top } \mathbf { v } _ { j } )
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $\sigma _ { \alpha } ( x ) = 1 / ( 1 + \exp ( - \alpha x ) )$ denotes the sigmoid function with inverse temperature $\alpha$ . We denote the corresponding matrix of edge probabilities in $\mathbf { G }$ given $\mathbf { Z }$ by $\mathbf { G } _ { \alpha } ( \mathbf { Z } ) \in [ 0 , 1 ] ^ { d \times d }$ with
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\mathbf { G } _ { \alpha } ( \mathbf { Z } ) _ { i j } : = p _ { \alpha } ( g _ { i j } = 1 | \mathbf { u } _ { i } , \mathbf { v } _ { j } ) .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
Since we model acyclic graphs, which do not contain self-loops, we set $p _ { \alpha } ( g _ { i i } = 1 | \mathbf { Z } ) : = 0$ . The latent dimensionality $k$ trades off the complexity of the variable interactions with tractability during inference. For $k \geq d$ , the matrix of edge probabilities ${ \bf G } _ { \alpha } ( { \bf Z } )$ is not constrained in rank, and the generative model in (6) can represent any adjacency matrix without self-loops. That said, the size of the latent representation $\mathbf { Z }$ only grows $O ( d \cdot k )$ and, in principle, $k$ can be chosen independently of $d$ . Note that the formulation in (6) models directed graphs since $\sigma _ { \alpha } ( \mathbf { u } _ { i } ^ { \top } \mathbf { v } _ { j } ) \neq \sigma _ { \alpha } ( \mathbf { u } _ { j } ^ { \top } \mathbf { v } _ { i } )$ . We can even interpret $\mathbf { u } _ { i }$ and $\mathbf { v } _ { i }$ as node embeddings that may encode more information than mere edge probabilities, e.g., for graph neural networks. The fact that $p _ { \alpha } ( \mathbf { G } \mid \mathbf { Z } )$ is invariant to orthogonal transformations of $\mathbf { U }$ and $\mathbf { V }$ is not an issue in practice.
|
| 108 |
+
|
| 109 |
+
Acyclicity via the latent prior distribution A major constraint in learning BNs is the acyclicity of $\mathbf { G }$ . With a latent graph model $p ( \mathbf G | \mathbf Z )$ in place, we design the prior $p ( \mathbf { Z } )$ to act as a soft constraint enforcing that only DAGs are modeled. Specifically, we define the prior of $\mathbf { Z }$ as the product of independent Gaussians with a Gibbs distribution that penalizes the expected cyclicity of $\mathbf { G }$ given $\mathbf { Z }$ :
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
p _ { \beta } ( \mathbf { Z } ) \propto \exp \left( - \beta \operatorname { \mathbb { E } } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } \Bigl [ h ( \mathbf { G } ) \Bigr ] \right) \prod _ { i j } \mathcal { N } ( z _ { i j } ; 0 , \sigma _ { z } ^ { 2 } )
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
Here, $h$ is the DAG constraint function given in (4) and $\beta$ is an inverse temperature parameter controlling how strongly the acyclicity is enforced. As $\beta \to \infty$ , the support of $p _ { \beta } ( \mathbf { Z } )$ reduces to all $\mathbf { Z }$ that only model valid DAGs. The Gaussian component ensures that the norm of $\mathbf { Z }$ is well-behaved. Traditional graph priors of the form $p ( \mathbf { G } ) \propto f ( \bar { \mathbf { G } } )$ that induce, e.g., sparsity of $\mathbf { G }$ , can be flexibly incorporated into $p _ { \beta } ( \mathbf { Z } )$ by means of an additional factor involving $f ( \mathbf { G } _ { \alpha } ( \mathbf { Z } ) )$ or $\mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } [ f ( \mathbf { G } ) ]$ . Unless highlighting a specific point, we omit writing the hyperparameters $\alpha$ and $\beta$ to simplify notation.
|
| 116 |
+
|
| 117 |
+
# 4.3 Estimators for Gradient-Based Bayesian Inference
|
| 118 |
+
|
| 119 |
+
The extended generative model in (5) not only allows us to incorporate the notoriously difficult acyclicity constraint into the Bayesian framework. By rephrasing the posteriors $p ( \mathbf G | \mathcal D )$ and $p ( \mathbf { \dot { G } } , \mathbf { \Theta } , \vert \mathbf { \mathcal { D } } )$ in terms of $p ( \mathbf { Z } | D )$ and $p ( \mathbf { Z } , \boldsymbol { \Theta } | D )$ , respectively, it also makes Bayesian structure learning amenable to variational inference techniques that operate in continuous space and rely on the gradient of the unnormalized log posterior, also known as the score. The following result provides us with the score of both latent posteriors. Detailed derivations can be found in Appendix A.2.
|
| 120 |
+
|
| 121 |
+
Proposition 2 (Latent posterior score). Under the generative graph model defined in (5), the gradient of the log posterior density of $\mathbf { Z }$ is given by
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
( a ) \qquad \nabla _ { \mathbf { Z } } \log p ( \mathbf { Z } | \mathcal { D } ) = \nabla _ { \mathbf { Z } } \log p ( \mathbf { Z } ) + \frac { \nabla _ { \mathbf { Z } } \mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } \left[ p ( \mathcal { D } \mid \mathbf { G } ) \right] } { \mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } \left[ p ( \mathcal { D } \mid \mathbf { G } ) \right] }
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
which is relevant when the marginal likelihood $p ( \mathcal { D } | \mathbf { G } )$ can be computed efficiently. In the general case, when inferring the joint posterior of $\mathbf { Z }$ and $\Theta$ , the gradients of the log posterior are given by
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\nabla _ { \mathbf { Z } } \log p ( \mathbf { Z } , \boldsymbol { \Theta } | \mathcal { D } ) = \nabla _ { \mathbf { Z } } \log p ( \mathbf { Z } ) + \frac { \nabla _ { \mathbf { Z } } \mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } \left[ p ( \boldsymbol { \Theta } , \mathcal { D } \mid \mathbf { G } ) \right] } { \mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } \left[ p ( \boldsymbol { \Theta } , \mathcal { D } \mid \mathbf { G } ) \right] }
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\quad ( c ) \qquad \nabla _ { \Theta } \log p ( \mathbf { Z } , \boldsymbol { \Theta } | \mathcal { D } ) = \frac { \mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } \bigl [ \nabla _ { \boldsymbol { \Theta } } p ( \boldsymbol { \Theta } , \mathcal { D } \mid \mathbf { G } ) \bigr ] } { \mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } \bigl [ p ( \boldsymbol { \Theta } , \mathcal { D } \mid \mathbf { G } ) \bigr ] }
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where $p ( \Theta , \mathcal { D } | \mathbf { G } ) = p ( \Theta | \mathbf { G } ) p ( \mathcal { D } | \mathbf { G } , \Theta )$ , which is efficient to compute by construction.
|
| 138 |
+
|
| 139 |
+
The expectations have tractable Monte Carlo approximations because sampling from $p ( \mathbf G | \mathbf Z )$ in (6) is simple and parallelizable. The gradient terms of the form $\nabla _ { \mathbf { Z } } \mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } [ \cdot ]$ , which also appear inside $\nabla _ { \mathbf { Z } } \log p ( \mathbf { Z } )$ , can be estimated using two different techniques, depending on the BN model inferred.
|
| 140 |
+
|
| 141 |
+
Differentiable (marginal) likelihood Using the Gumbel-softmax trick [48, 49], we can separate the randomness from $\mathbf { Z }$ when sampling from $\bar { p } ( \mathbf G \mid \mathbf Z )$ and obtain the following estimator:
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\nabla _ { \mathbf { Z } } \mathbb { E } _ { p ( \mathbf { G } \mid \mathbf { Z } ) } { \big [ } p ( { \mathcal { D } } \mid \mathbf { G } ) { \big ] } \approx \mathbb { E } _ { p ( \mathbf { L } ) } { \Big [ } \nabla _ { \mathbf { G } } p ( { \mathcal { D } } \mid \mathbf { G } ) { \big | } _ { \mathbf { G } = \mathbf { G } _ { \tau } ( \mathbf { L } , \mathbf { Z } ) } \cdot \nabla _ { \mathbf { Z } } \mathbf { G } _ { \tau } ( \mathbf { L } , \mathbf { Z } ) { \Big ] }
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
where $\mathbf L \sim \mathrm { L o g i s t i c } ( 0 , 1 ) ^ { d \times d }$ i.i.d.. The matrix-valued function ${ \bf G } _ { \tau } ( \cdot )$ is defined elementwise as
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
\mathbf { G } _ { \tau } ( \mathbf { L } , \mathbf { Z } ) _ { i j } : = \left\{ \begin{array} { l l } { \sigma _ { \tau } \left( l _ { i j } + \alpha \mathbf { u } _ { i } ^ { \top } \mathbf { v } _ { j } \right) } & { \mathrm { i f } i \neq j } \\ { 0 } & { \mathrm { i f } i = j } \end{array} \right.
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
The estimator applies equally to $p ( \Theta , \mathcal { D } | \mathbf { G } )$ in place of $p ( \mathcal { D } | \mathbf { G } )$ . For the estimator to be welldefined, $p ( \mathcal { D } | \bar { \mathbf { G } } )$ or $p ( \Theta , \mathcal { D } | \mathbf { G } )$ , respectively, needs to be differentiable with respect to $\mathbf { G }$ . More specifically, the gradient $\nabla _ { \mathbf G } p ( \mathcal { D } | \mathbf G )$ or $\nabla _ { \mathbf G } \dot { p } ( \mathcal D , \mathbf { \Theta } ) | \mathbf G )$ needs to be defined when $\mathbf { G }$ lies on the interior of $[ 0 , 1 ] ^ { d \times d }$ and not at its discrete endpoints. This depends on the parameterization of the BN model we want to infer. In case $p ( \mathcal { D } | \mathbf { G } )$ or $p ( \Theta , \mathcal { D } | \mathbf { G } )$ is only defined for discrete $\mathbf { G }$ , it is possible to evaluate $\nabla _ { \mathbf { G } } p ( \mathcal { D } | \mathbf { G } )$ or $\nabla _ { \mathbf G } p ( \Theta , \mathcal { D } | \mathbf G )$ using hard Gumbel-max samples of $\mathbf { G }$ (i.e., with $\tau = \infty$ ) and a straight-through gradient estimator. Since the DAG constraint $h$ is differentiable, the Gumbel-softmax trick can always be applied inside $\nabla _ { \mathbf { Z } } \log p ( \mathbf { Z } )$ . In practice, we always use $\tau = 1$ .
|
| 154 |
+
|
| 155 |
+
Non-differentiable (marginal) likelihood In general, $\nabla _ { \mathbf { G } } p ( \mathcal { D } | \mathbf { G } )$ or $\nabla _ { \mathbf G } p ( \mathcal D , \Theta | \mathbf G )$ depending on the inference task might be not available or ill-defined. In this setting, the score function estimator provides us with a way to estimate the gradient we need [50]:
|
| 156 |
+
|
| 157 |
+
$$
|
| 158 |
+
\nabla _ { \mathbf { Z } } \mathbb { E } _ { p \left( \mathbf { G } \mid \mathbf { Z } \right) } { \big [ } p ( { \mathcal { D } } \mid \mathbf { G } ) { \big ] } = \mathbb { E } _ { p \left( \mathbf { G } \mid \mathbf { Z } \right) } { \Big [ } { \big ( } p ( { \mathcal { D } } \mid \mathbf { G } ) - b { \big ) } \nabla _ { \mathbf { Z } } \log p ( \mathbf { G } \mid \mathbf { Z } ) { \Big ] }
|
| 159 |
+
$$
|
| 160 |
+
|
| 161 |
+
The estimator likewise applies for $p ( \Theta , \mathcal { D } | \mathbf { G } )$ in place of $p ( \mathcal { D } | \mathbf { G } )$ . Here, $b$ is a constant with respect to $\mathbf { G }$ that can be used for variance reduction [51], and $\nabla _ { \mathbf { Z } } \log { p ( \mathbf { G } \mid \mathbf { Z } ) }$ is trivial to compute. The derivations of both (12) and (14), alongside a more detailed discussion, can be found in Appendix $\mathrm { B }$ .
|
| 162 |
+
|
| 163 |
+
# 5 Particle Variational Inference for Structure Learning
|
| 164 |
+
|
| 165 |
+
In the previous section, we have proposed a differentiable formulation for Bayesian structure learning $( D i B S )$ that is agnostic to the form of the local BN conditionals and, more importantly, translates learning discrete graph structures into an inference problem over the continuous variable $\mathbf { Z }$ . In the following, we overcome the remaining challenge of inferring the intractable DiBS posteriors $p ( \mathbf { Z } \mid \mathcal { D } )$ and $p ( \mathbf { Z } , \boldsymbol { \Theta } | \mathcal { D } )$ by employing Stein variational gradient descent (SVGD) [19], a gradient-based and general purpose variational inference method. The resulting algorithm infers a particle approximation of the marginal or joint posterior density over BNs given observational data.
|
| 166 |
+
|
| 167 |
+
SVGD for posterior inference Since Proposition 2 provides us with the gradient of the latent posterior score functions, we can apply SVGD off-the-shelf. SVGD minimizes the KL divergence to a target distribution by iteratively transporting a set of particles using a sequence of kernel-based transformation steps. We provide a more detailed overview of SVGD in Appendix C. Following this paradigm for DiBS, we iteratively update a fixed set $\{ \mathbf { Z } ^ { ( m ) } \} _ { m = 1 } ^ { M }$ or $\{ \mathbf { Z } ^ { ( m ) } , \mathbf { \bar { \Theta } } ^ { ( m ) } \} _ { m = 1 } ^ { M }$ to approximate $p ( \mathbf { Z } \mid \mathcal { D } )$ or $p ( \mathbf { Z } , \boldsymbol { \Theta } | \mathcal { D } )$ , respectively. If the BN model we aim to infer has a properly-defined likelihood gradient with respect to $\mathbf { G }$ , we use the Gumbel-softmax estimator in (12) to approximate the posterior score. Otherwise, we resort to the score function estimator in (14). We use a simple kernel for SVGD:
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
k \big ( ( \mathbf { Z } , \boldsymbol { \Theta } ) , ( \mathbf { Z } ^ { \prime } , \boldsymbol { \Theta } ^ { \prime } ) \big ) : = \exp \left( - \frac { 1 } { \gamma _ { z } } | | \mathbf { Z } - \mathbf { Z } ^ { \prime } | | _ { 2 } ^ { 2 } \right) + \exp \left( - \frac { 1 } { \gamma _ { \theta } } | | \boldsymbol { \Theta } - \boldsymbol { \Theta } ^ { \prime } | | _ { 2 } ^ { 2 } \right)
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
with bandwidths $\gamma _ { z } , \gamma _ { \theta }$ . For inference of $p ( \mathbf { Z } | \mathcal { D } )$ , we leave out the second term involving $\Theta , \Theta ^ { \prime }$ . While $\mathbf { Z }$ is invariant to orthogonal transformations, more elaborate kernels that are, e.g., invariant to such transforms empirically perform worse in our experiments.
|
| 174 |
+
|
| 175 |
+
# Algorithm 1 DiBS with SVGD [19] for inference of $p ( \mathbf G | \mathcal D )$
|
| 176 |
+
|
| 177 |
+
<table><tr><td>Output: Set of discrete graph particles {G(m)}M</td><td>}M=1, kernel k,schedules for αt, βt,and stepsizes nt }m=1 approximating p(G |D)</td></tr><tr><td>1: Incorporate prior belief of p(G) into p(Z)</td><td> See Section 4.2</td></tr><tr><td>for iteration t=O to T-1 do</td><td></td></tr><tr><td>Estimate score Vz log p(Z|D) given in (9) for each Z(m)</td><td>> See (12)and (14)</td></tr><tr><td>for particle m = 1 to M do</td><td></td></tr><tr><td>Z 5: ↑ +nt Φt(Z(m)</td><td> SVGD step</td></tr><tr><td>M 1</td><td></td></tr><tr><td>where 𝜙t(·) := M</td><td>[k(Z(),)Vz(c) logp(Z(k)|D)+Vz(c)k((Z(),)]</td></tr><tr><td>M</td><td></td></tr><tr><td>k=1</td><td></td></tr><tr><td>6: return{G(Z(m)}m=1</td><td></td></tr><tr><td></td><td> See (16)and (17)</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>
|
| 178 |
+
|
| 179 |
+
Annealing $\alpha$ and $\beta$ The latent variable $\mathbf { Z }$ not only probabilistically models the graph $\mathbf { G }$ , but can also be viewed as a continuous relaxation of $\mathbf { G }$ , with $\alpha$ trading off smoothness with accuracy. As $\alpha \to \infty$ , the sigmoid $\sigma _ { \alpha } ( \cdot )$ converges to the unit step function. Hence, as $\alpha \to \infty$ in the graph model $p _ { \alpha } ( \mathbf { G } \mid \mathbf { Z } )$ in (6), the expectations in Proposition 1 simplify to:
|
| 180 |
+
|
| 181 |
+
$$
|
| 182 |
+
\begin{array} { r l } { \mathbb { E } _ { p ( \mathbf { G } \mid \mathcal { D } ) } \Big [ f ( \mathbf { G } ) \Big ] } & { \to \ \mathbb { E } _ { p ( \mathbf { Z } \mid \mathcal { D } ) } \Big [ f \big ( \mathbf { G } _ { \infty } ( \mathbf { Z } ) \big ) \Big ] } \\ { \mathbb { E } _ { p ( \mathbf { G } , \boldsymbol { \Theta } \mid \mathcal { D } ) } \Big [ f ( \mathbf { G } , \boldsymbol { \Theta } ) \Big ] } & { \to \ \mathbb { E } _ { p ( \mathbf { Z } , \boldsymbol { \Theta } \mid \mathcal { D } ) } \Big [ f \big ( \mathbf { G } _ { \infty } ( \mathbf { Z } ) , \boldsymbol { \Theta } \big ) \Big ] } \end{array}
|
| 183 |
+
$$
|
| 184 |
+
|
| 185 |
+
where ${ \bf G } _ { \infty } ( { \bf Z } )$ denotes the single limiting graph implied by $\mathbf { Z } = [ \mathbf { U } , \mathbf { V } ]$ and is defined as
|
| 186 |
+
|
| 187 |
+
$$
|
| 188 |
+
\mathbf { G } _ { \infty } ( \mathbf { Z } ) _ { i j } : = \left\{ { \begin{array} { l l } { 1 } & { { \mathrm { i f } } \mathbf { u } _ { i } ^ { \top } \mathbf { v } _ { j } > 0 { \mathrm { a n d } } i \neq j } \\ { 0 } & { { \mathrm { o t h e r w i s e } } } \end{array} } \right.
|
| 189 |
+
$$
|
| 190 |
+
|
| 191 |
+
See Appendix A.3. In this case, $p _ { \alpha } ( \mathbf { G } \mid \mathbf { Z } )$ converges to representing only a single graph. To be able to invoke this simplification, we anneal $\alpha \to \infty$ over the iterations of SVGD and, upon termination, convert the latent variables $\mathbf { Z }$ to the single discrete $\mathbf { G } _ { \infty } ( \mathbf { Z } )$ . Furthermore, we similarly let $\beta \to \infty$ in the latent prior $p _ { \beta } ( \mathbf { Z } )$ over the iterations to enforce that the latent representation of $\mathbf { G }$ only models DAGs. By Equation (16), the resulting DAGs form a consistent particle approximation of $p ( \mathbf G | \mathcal D )$ or $p ( \mathbf { G } , \boldsymbol { \Theta } | \mathcal { D } )$ , respectively. Algorithm 1 summarizes DiBS instantiated with SVGD for inference of $p ( \mathbf G | \mathcal D )$ . The general case of inferring $p ( \mathbf { G } , \boldsymbol { \Theta } | \mathcal { D } )$ is given in Algorithm 2 of Appendix D.
|
| 192 |
+
|
| 193 |
+
Single-particle approximation SVGD reduces to regular gradient ascent for the maximum a posteriori estimate when transporting only a single particle [19]. In this special case, DiBS with SVGD recovers some of the existing continuous structure learning methods: gradient ascent on a linear Gaussian likelihood solves an optimization problem similar to NOTEARS [9]. The cyclicity penalizer acts analogously. However, not only does DiBS automatically turn into a full Bayesian approach when using more particles, it is also not limited to settings such as linear Gaussian conditionals, where the adjacency matrix $\mathbf { G }$ and the parameters $\Theta$ can be modeled together by a weighted adjacency matrix.
|
| 194 |
+
|
| 195 |
+
Weighted particle mixture In high dimensional settings, it may be beneficial to move beyond a uniform weighting of the inferred particles of BN models to approximate $p ( \mathbf G | \mathcal D )$ or $p ( \mathbf { G } , \mathbf { \dot { \Theta } } | \mathbf { \mathcal { D } } )$ . We consider a particle mixture that weights each particle by its unnormalized posterior probability $p ( \mathbf G , \mathcal { D } )$ or $p ( \mathbf { G } , \boldsymbol { \Theta } , \mathcal { D } )$ , respectively, under the BN model. While we do not have a strong theoretical justification for the weighting, our motivation is that most of the particles in the empirical distribution will be unique as a consequence of the super-exponentially large space of DAGs, which may result in a crude approximation of their posterior probability mass function. In our experiments, DiBS and its instantiation with SVGD are used interchangeably, and $\mathrm { D i B S + }$ denotes the weighted particle mixture.
|
| 196 |
+
|
| 197 |
+
# 6 Evaluation on Synthetic Data
|
| 198 |
+
|
| 199 |
+
# 6.1 Experimental Setup
|
| 200 |
+
|
| 201 |
+
Synthetic data We compare DiBS to a set of related methods in marginal and joint posterior inference of synthetic linear and nonlinear Gaussian BNs. Our setup follows [9, 24, 27, 52], who consider inferring BNs with Erdos-Rényi and scale-free random structures [ ˝ 53, 54]. For each graph, here with $d \in \{ 2 0 , 5 0 \}$ nodes and $2 d$ edges in expectation, we sample a set of ground truth parameters and then generate training, held-out, and interventional data sets. In all settings, we use $N = 1 0 0$ observations for inference, emulating the use case of Bayesian structure learning where the uncertainty about the graph structure is significant.
|
| 202 |
+
|
| 203 |
+

|
| 204 |
+
Figure 2: Marginal posterior inference of 20-node linear Gaussian BNs using the BGe marginal likelihood. Higher scores on AUROC and lower scores on $\mathbb { E }$ -SHD, neg. MLL, neg. I-MLL are preferred. $\mathrm { D i B S + }$ performs competitively across all metrics, in particular $\mathbb { E }$ -SHD and neg. (I-)MLL.
|
| 205 |
+
|
| 206 |
+
Graph priors For Erdos-Rényi ˝ graphs, all methods use the prior $p ( \mathbf G ) \propto q ^ { \| \mathbf G \| _ { 1 } } ( 1 - q ) ^ { \binom { d } { 2 } - \| \mathbf G \| _ { 1 } }$ , capturing that each edge exists independently w.p. $q$ [53]. For scale-free graphs, we define the prior $p ( \mathbf { \bar { G } } ) \propto \mathbf { \breve { \prod } } _ { i = 1 } ^ { d } ( 1 + \lVert \mathbf { G } _ { i } ^ { \top } \rVert _ { 1 } ) ^ { - 3 }$ , analogous to their power law degree distribution $p ( \mathrm { d e g } ) \sim \mathrm { d e g } ^ { - 3 }$ [54]. Here, $\mathbf { G } _ { i } ^ { \top }$ is the $i$ -th column of the adjacency matrix. DiBS implements either prior by using the corresponding term above as an additional factor in $p ( \mathbf { Z } )$ with $\mathbf { G } : = \mathbf { G } _ { \alpha } ( \mathbf { Z } )$ (see Section 4.2).
|
| 207 |
+
|
| 208 |
+
Metrics Since neither density nor samples of the ground truth posteriors are available for BNs of $d \in \{ 2 0 , 5 0 \}$ variables, we follow the evaluation metrics used by previous work. We define the expected structural Hamming distance to the ground truth graph $\mathbf { G } ^ { \ast }$ under the inferred posterior as
|
| 209 |
+
|
| 210 |
+
$$
|
| 211 |
+
\operatorname { \mathbb { E } \mathrm { - } S H D } ( p , \mathbf { G } ^ { * } ) : = \sum _ { \mathbf { G } } p ( \mathbf { G } | \mathcal { D } ) \cdot \operatorname { S H D } ( \mathbf { G } , \mathbf { G } ^ { * } )
|
| 212 |
+
$$
|
| 213 |
+
|
| 214 |
+
where $\mathrm { S H D } ( \mathbf { G } , \mathbf { G } ^ { * } )$ counts the edge changes that separate the essential graphs representing the MECs of $\mathbf { G }$ and $\mathbf { G } ^ { \ast }$ [8, 55]. In addition, we follow Friedman and Koller [20] and Ellis and Wong [41] and compute the area under the receiver operating characteristic curve $( A U R O C )$ for pairwise edge predictions when varying the confidence threshold under the inferred marginal $p ( g _ { i j } = 1 | \mathcal { D } )$ . Finally, following Murphy [10], we also evaluate the ability to predict future observations by computing the average negative (marginal) log likelihood on 100 held-out observations Dtest:
|
| 215 |
+
|
| 216 |
+
$$
|
| 217 |
+
\mathrm { n e g . L L } ( p , \mathcal { D } ^ { \mathrm { t e s t } } ) : = - \sum _ { \mathbf { G } , \Theta } p ( \mathbf { G } , \Theta | \mathcal { D } ) \cdot \log p ( \mathcal { D } ^ { \mathrm { t e s t } } | \mathbf { G } , \Theta )
|
| 218 |
+
$$
|
| 219 |
+
|
| 220 |
+
When inferring $p ( \mathbf G | \mathcal D )$ , the corresponding neg. MLL metric instead uses $p ( \mathcal { D } ^ { \mathrm { t e s t } } | \mathbf { G } )$ . Analogously, we also compute the interventional log likelihoods I-LL and I-MLL, a relevant metric in causal inference [10, 12]. Here, an interventional data set $( \mathcal { D } ^ { \mathrm { i n t } } , \mathcal { T } )$ is instead used to compute $p ( \mathcal { D } ^ { \mathrm { i n t } } | \mathbf { G } , \Theta , \mathcal { T } )$ and $p ( \mathcal { D } ^ { \mathrm { i n t } } | \mathbf { G } , \mathcal { Z } )$ in (19), respectively. Scores are the average of 10 interventional data sets. All reported metrics in this section are aggregated for inference of 30 random synthetic BNs.
|
| 221 |
+
|
| 222 |
+
In the remainder, DiBS is always run for 3,000 iterations and with $k = d$ for inference of $d$ -variable BNs, which leaves the matrix of edge probabilities unconstrained in rank. We discard a DiBS particle in the rare case that a returned graph is cyclic. Complete details on Gaussian BNs, the evaluation metrics, hyperparameters, and all baselines can be found in Appendix E.
|
| 223 |
+
|
| 224 |
+
# 6.2 Linear Gaussian Bayesian Networks
|
| 225 |
+
|
| 226 |
+
Marginal posterior inference For linear Gaussian BNs, we first evaluate the classical setting of inferring the marginal posterior $p ( \mathbf G | \mathcal D )$ since $p ( \mathcal { D } | \mathbf { G } )$ can be computed in closed form. To this end, we employ the commonly used Bayesian Gaussian Equivalent (BGe) marginal likelihood, which scores Markov equivalent structures equally [16, 17]. The form of the BGe score requires DiBS to use the score function estimator in (14).
|
| 227 |
+
|
| 228 |
+

|
| 229 |
+
Figure 3: Joint posterior inference of graphs and parameters of linear Gaussian networks with $d = 2 0$ nodes. $\mathrm { D i B S + }$ performs best across all of the metrics. ${ \mathrm { B G E S ^ { * } } }$ , the next-best alternative, yields substantially worse performance in E-SHD, i.e., in recovering the overall graph structure and MEC. Recall that higher AUROC and lower $\mathbb { E }$ -SHD, neg. LL, and neg. I-LL scores are preferable.
|
| 230 |
+
|
| 231 |
+
We compare DiBS with the nonparametric DAG bootstrap [42] using the constraint-based PC [7] and the score-based GES [6] algorithms (BPC and BGES). For MCMC, we only consider structure MCMC $( \mathbf { M C } ^ { 3 } )$ [37] as a comparison. Order MCMC or hybrid DP approaches bound the number of parents and thus often exclude the ground truth graph a priori, especially for scale-free BN structures. Burn-in and thinning for $\mathbf { M C ^ { 3 } }$ are chosen to make the wall time comparable with DiBS run on CPUs. In the remainder of the paper, each method uses 30 samples to approximate the posterior over BNs.
|
| 232 |
+
|
| 233 |
+
Figure 2 summarizes the results for 30 randomly generated BNs with $d = 2 0$ nodes. We find that $\mathrm { D i B S + }$ performs well compared to the other methods, all of which were specifically developed for the marginal inference scenario evaluated here. $\mathrm { D i B S + }$ appears to be preferable to DiBS.
|
| 234 |
+
|
| 235 |
+
Joint posterior inference When inferring the joint posterior $p ( \mathbf { G } , \boldsymbol { \Theta } | \mathcal { D } )$ , we can employ a more explicit representation of linear Gaussian BNs, where the conditional distribution parameters are standard Gaussian. Here, DiBS can leverage the Gumbel-softmax estimator in (12) because $p ( \mathbf { G } , \boldsymbol { \Theta } | \mathcal { D } )$ is well-defined when $\mathbf { G }$ lies on the interior of $[ 0 , 1 ] ^ { d \times d }$ (see Appendix E.1). To provide a comparison with DiBS in the absence of an applicable MCMC method, we propose two variants of $\mathbf { M C ^ { 3 } }$ as baselines. Metropolis-Hastings $\mathbf { M C ^ { 3 } }$ (M-MC3) jointly samples parameters and structures, and Metropolis-within-Gibbs $\mathbf { M C ^ { 3 } }$ $\mathrm { \bf { \bar { G } } { - } } \mathrm { \bf { M } } { \bf C } ^ { 3 } .$ ) alternates in proposing structure and parameters [56]. Moreover, we extend the bootstrap methods by taking the closed-form maximum likelihood estimate [57] as the posterior parameter sample for a given graph inferred using the BGe score $\mathrm { { \cdot { \bf { B } P C } ^ { * } } }$ and ${ \mathrm { B G E S } } ^ { * }$ ), an approach taken in, e.g., causal BN learning [14].
|
| 236 |
+
|
| 237 |
+
Figure 3 shows the results for $d = 2 0$ nodes, where $\mathbb { E }$ -SHD and AUROC are computed by empirically marginalizing out the parameters. We find that $\mathrm { D i B S + }$ is the only considered method that performs well across all of the metrics, often outperforming the baselines by a significant margin. As for marginal posterior inference of linear Gaussian BNs, $\mathrm { D i B S + }$ performs slightly better than DiBS.
|
| 238 |
+
|
| 239 |
+
# 6.3 Nonlinear Gaussian Bayesian Networks
|
| 240 |
+
|
| 241 |
+
We also consider joint inference of nonlinear Gaussian BNs where the mean of each local conditional Gaussian is parameterized by a 2-layer dense neural network with five hidden nodes and ReLU activation functions (see Appendix E.1). Since the marginal likelihood does not have a closed form, we are unable to use $\mathbf { B P C ^ { * } }$ and ${ \mathrm { B G E S ^ { * } } }$ as a means of comparison. Figure 4 displays the results for $d = 2 0$ variables, where a given BN model has $| \Theta | = 2 , 2 2 0$ weights and biases. Analogous to joint inference of linear Gaussian BNs, DiBS and $\mathrm { D i B S + }$ outperform the MCMC baselines across the considered metrics. To the best of our knowledge, this is the first time that such nonlinear Gaussian BN models have been inferred under the Bayesian paradigm, which opens up exciting avenues in the active learning of more sophisticated causal structures.
|
| 242 |
+
|
| 243 |
+

|
| 244 |
+
Figure 4: Joint posterior inference of nonlinear Gaussian BNs with $d = 2 0$ nodes. Here, the mean of the local conditional distribution of each node is parameterized by a 2-layer neural network with five hidden nodes. DiBS and $\mathrm { D i B S + }$ perform favorably across the board, particularly in the graph metrics.
|
| 245 |
+
|
| 246 |
+
Appendix F complements Sections 6.2 and 6.3 with details on computing time and efficient implementation of DiBS with SVGD, showing that GPU wall times of the above inference experiments lie on the order of seconds or only a few minutes. In addition, Appendix $\mathbf { G }$ provides results for $d = 5 0$ variables, where $\mathrm { D i B S + }$ likewise performs favorably when jointly inferring $p ( \mathbf { G } , \boldsymbol { \Theta } | \mathcal { D } )$ . For marginal posterior inference of $p ( \mathbf G | \mathcal D )$ under the BGe marginal likelihood, DiBS appears to require more Monte Carlo samples to compensate for the high variance of the score function estimator in this high-dimensional setting.
|
| 247 |
+
|
| 248 |
+
# 6.4 DiBS with SVGD: Additional Analyses and Ablation Studies
|
| 249 |
+
|
| 250 |
+
Having compared DiBS and its instantiation with SVGD to existing approaches, we finally devote Appendix $_ \mathrm { H }$ to empirically analyzing some properties of the algorithm. One of our key results is that, all other things held equal, substituting our inner product model in (6) with $p _ { \alpha } ( g _ { i j } = 1 | \mathbf { Z } ) = \sigma _ { \alpha } ( z _ { i j } )$ , where single scalars encode the edge probabilities, results in significantly worse evaluation metrics.
|
| 251 |
+
|
| 252 |
+
We additionally study the uncertainty quantification in (non)identifiable edge structures and show the effects of reducing the latent dimensionality $k$ or the number of iterations $T$ . Our findings suggest that reducing either hyperparameter still allows for competitive posterior approximations and enables trading off posterior inference quality with computational efficiency, e.g., in large-scale applications.
|
| 253 |
+
|
| 254 |
+
# 7 Application: Inferring Protein Signaling Networks From Cell Data
|
| 255 |
+
|
| 256 |
+
A widely used benchmark in structure learning is the proteomics data set by Sachs et al. [3]. The data contain $N = 7$ , 466 continuous measurements of $d = 1 1$ proteins involved in human immune system cells as well as an established causal network of their signaling interactions.
|
| 257 |
+
|
| 258 |
+
We infer both linear and nonlinear Gaussian BNs with Erdos-Rényi ˝ graph priors exactly as in Section 6. The AUROC results in Table 1 indicate that the posterior by DiBS under the BGe model provides the most calibrated edge confidence scores. Not penalizing model complexity as much, the marginal BGe posterior of DiBS $( \mathrm { D i B S + } )$ ) averages a high expected number of 39.0 (35.0) edges, compared to 12.7 (14.2) and 12.6 (14.2) for its joint posteriors over linear and nonlinear BNs, respectively. Appendix I provides further details and analyses on this matter. The $\mathbb { E }$ -SHD scores show that, among all the methods, DiBS is closest in structure to the consensus network when performing joint inference with nonlinear Gaussian BNs. This further highlights the need for nonlinear conditionals and joint inference of the graph and parameters in complex real-world settings.
|
| 259 |
+
|
| 260 |
+
Table 1: Inference of protein signaling pathways with Gaussian BNs. Metrics are the mean $\pm \thinspace \mathrm { S D }$ of 30 random restarts.
|
| 261 |
+
|
| 262 |
+
<table><tr><td>MC3</td><td>E-SHD</td><td>AUROC</td></tr><tr><td>BPC + BGES DiBS DiBS+</td><td>34.0± 0.7 25.5± 2.3 33.7 ±1.7 37.4 ± 0.5 34.7 ± 1.5</td><td>0.616± 0.027 0.566 ± 0.020 0.641 ± 0.030 0.647 ± 0.047 0.629 ± 0.045</td></tr><tr><td>8</td><td>M-MC3 G-MC³ DiBS DiBS+</td><td>37.3± 3.5 0.551 ± 0.078 30.5 ± 3.2 0.527 ± 0.067 23.4± 0.5 0.598 ± 0.052 22.9 ± 2.7 0.557 ± 0.052</td></tr><tr><td>T</td><td>M-MC3 25.2±3.0 G-MC3 35.1±3.2 DiBS 22.6 ± 0.5 DiBS+ 22.8 ±1.9</td><td>0.526± 0.084 0.540 ± 0.080 0.577 ± 0.039 0.535 ± 0.041</td></tr></table>
|
| 263 |
+
|
| 264 |
+
† Linear Gaussian BN; graph only via BGe marginal lik. § Linear Gaussian BN; graph and parameters jointly ¶Nonlinear Gaussian BN; graph and parameters jointly
|
| 265 |
+
|
| 266 |
+
# 8 Conclusion
|
| 267 |
+
|
| 268 |
+
We have presented a general, fully differentiable approach to inference of posterior distributions over BNs. Our framework is based on a continuous latent representation of DAGs, whose posterior can be equivalently inferred—without loss of generality and using existing black box inference methods. While we have used SVGD [19] for this purpose, our general approach could also be instantiated with, e.g., gradient-based sampling methods that rely on the score of the target density [58, 59]. This may improve upon the asymptotic runtime of DiBS with SVGD, which scales quadratically in the number of sampled particles. We expect that our end-to-end approach can be extended to handle missing and interventional data as well as to amortized contexts, where rich unstructured data is available.
|
| 269 |
+
|
| 270 |
+
Broader impact Our work is relevant to any scientific discipline that aims at inferring the (causal) structure of a system or reasoning about the effects of interventions. If algorithms and decisions are grounded in the structural understanding of a data-generating system and take into account the epistemic uncertainty, we expect them to be more robust and have fewer unforeseen side-effects. However, the assumptions allowing for a causal interpretation of DAGs, e.g., the absence of unmeasured confounders, are often untestable and to be taken with care [60], particularly in safety-critical and societally-sensitive applications. Hence, while potential misuse can never be ruled out, our presented method predominantly promises positive societal and scientific impact.
|
| 271 |
+
|
| 272 |
+
# Acknowledgments and Disclosure of Funding
|
| 273 |
+
|
| 274 |
+
This project received funding from the Swiss National Science Foundation under NCCR Automation under grant agreement 51NF40 180545, the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program grant agreement no. 815943, and was supported with compute resources by Oracle Cloud Services. This work was also supported by the German Federal Ministry of Education and Research (BMBF): Tübingen AI Center, FKZ: 01IS18039B, and by the Machine Learning Cluster of Excellence, EXC number 2064/1 – Project number 390727645. We thank Nicolo Ruggeri and Guillaume Wang for their valuable feedback.
|
| 275 |
+
|
| 276 |
+
# References
|
| 277 |
+
|
| 278 |
+
[1] Judea Pearl. Probabilistic reasoning in intelligent systems: networks of plausible inference. 1988.
|
| 279 |
+
[2] Dana Pe’er, Aviv Regev, Gal Elidan, and Nir Friedman. Inferring subnetworks from perturbed expression profiles. Bioinformatics, 17:S215–S224, 2001.
|
| 280 |
+
[3] Karen Sachs, Omar Perez, Dana Pe’er, Douglas A Lauffenburger, and Garry P Nolan. Causal proteinsignaling networks derived from multiparameter single-cell data. Science, 308(5721):523–529, 2005.
|
| 281 |
+
[4] Chikako Van Koten and AR Gray. An application of bayesian network for predicting object-oriented software maintainability. Information and Software Technology, 48(1):59–67, 2006.
|
| 282 |
+
[5] Philippe Weber, Gabriela Medina-Oliva, Christophe Simon, and Benoît Iung. Overview on bayesian networks applications for dependability, risk analysis and maintenance areas. Engineering Applications of Artificial Intelligence, 25(4):671–682, 2012.
|
| 283 |
+
[6] David Maxwell Chickering. Optimal structure identification with greedy search. J. Mach. Learn. Res., 3: 507–554, March 2003.
|
| 284 |
+
[7] Peter Spirtes, Clark N. Glymour, and Richard Scheines. Causation, prediction, and search. Adaptive computation and machine learning. MIT Press, Cambridge, Mass, 2nd ed edition, 2000.
|
| 285 |
+
[8] Ioannis Tsamardinos, Laura E Brown, and Constantin F Aliferis. The max-min hill-climbing bayesian network structure learning algorithm. Machine learning, 65(1):31–78, 2006.
|
| 286 |
+
[9] Xun Zheng, Bryon Aragam, Pradeep K Ravikumar, and Eric P Xing. DAGs with NO TEARS: Continuous optimization for structure learning. In Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018.
|
| 287 |
+
[10] Kevin P Murphy. Active learning of causal bayes net structure. 2001.
|
| 288 |
+
[11] Simon Tong and Daphne Koller. Active learning for structure in bayesian networks. In International joint conference on artificial intelligence, volume 17, pages 863–869, 2001.
|
| 289 |
+
[12] Hyunghoon Cho, Bonnie Berger, and Jian Peng. Reconstructing causal biological networks through active learning. PloS one, 11(3):e0150611, 2016.
|
| 290 |
+
[13] Robert Osazuwa Ness, Karen Sachs, Parag Mallick, and Olga Vitek. A bayesian active learning experimental design for inferring signaling networks. In International Conference on Research in Computational Molecular Biology, pages 134–156. Springer, 2017.
|
| 291 |
+
[14] Raj Agrawal, Chandler Squires, Karren Yang, Karthikeyan Shanmugam, and Caroline Uhler. ABCDStrategy: Budgeted experimental design for targeted causal structure discovery. In Proceedings of Machine Learning Research, volume 89, pages 3400–3409. PMLR, 16–18 Apr 2019.
|
| 292 |
+
[15] Julius von Kügelgen, Paul K Rubenstein, Bernhard Schölkopf, and Adrian Weller. Optimal experimental design via bayesian optimization: active causal structure learning for gaussian process networks. arXiv preprint arXiv:1910.03962, 2019.
|
| 293 |
+
[16] Dan Geiger and David Heckerman. Learning gaussian networks. In Proceedings of the Tenth International Conference on Uncertainty in Artificial Intelligence, UAI’94, page 235–243, San Francisco, CA, USA, 1994.
|
| 294 |
+
[17] Dan Geiger and David Heckerman. Parameter priors for directed acyclic graphical models and the characterization of several probability distributions. Ann. Statist., 30(5):1412–1440, October 2002. Publisher: The Institute of Mathematical Statistics.
|
| 295 |
+
[18] David Heckerman, Dan Geiger, and David M. Chickering. Learning Bayesian Networks: The Combination of Knowledge and Statistical Data. Machine Learning, 20(3):197–243, September 1995.
|
| 296 |
+
[19] Qiang Liu and Dilin Wang. Stein variational gradient descent: A general purpose bayesian inference algorithm. In Proceedings of the 30th International Conference on Neural Information Processing Systems, NIPS’16, page 2378–2386, 2016.
|
| 297 |
+
[20] Nir Friedman and Daphne Koller. Being Bayesian About Network Structure. A Bayesian Approach to Structure Discovery in Bayesian Networks. Machine Learning, 50(1):95–125, January 2003.
|
| 298 |
+
[21] David Madigan and Adrian E Raftery. Model selection and accounting for model uncertainty in graphical models using occam’s window. Journal of the American Statistical Association, 89(428):1535–1546, 1994.
|
| 299 |
+
[22] David Madigan, Jonathan Gavrin, and Adrian E Raftery. Eliciting prior information to enhance the predictive performance of bayesian graphical models. Communications in Statistics-Theory and Methods, 24(9):2271–2292, 1995.
|
| 300 |
+
[23] R.W. Robinson. Counting labeled acyclic digraphs. New Directions in the Theory of Graphs, 1973.
|
| 301 |
+
[24] Yue Yu, Jie Chen, Tian Gao, and Mo Yu. DAG-GNN: DAG structure learning with graph neural networks. In Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 7154–7163. PMLR, 09–15 Jun 2019.
|
| 302 |
+
[25] Sébastien Lachapelle, Philippe Brouillard, Tristan Deleu, and Simon Lacoste-Julien. Gradient-based neural dag learning. In International Conference on Learning Representations, 2020.
|
| 303 |
+
[26] Ignavier Ng, Shengyu Zhu, Zhitang Chen, and Zhuangyan Fang. A graph autoencoder approach to causal structure learning. In NeurIPS 2019 Workshop “Do the right thing”: machine learning and causal inference for improved decision making, 2019.
|
| 304 |
+
[27] Xun Zheng, Chen Dan, Bryon Aragam, Pradeep Ravikumar, and Eric Xing. Learning sparse nonparametric dags. In International Conference on Artificial Intelligence and Statistics, pages 3414–3425. PMLR, 2020.
|
| 305 |
+
[28] Roxana Pamfil, Nisara Sriwattanaworachai, Shaan Desai, Philip Pilgerstorfer, Konstantinos Georgatzis, Paul Beaumont, and Bryon Aragam. Dynotears: Structure learning from time-series data. In Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pages 1595–1605. PMLR, 2020.
|
| 306 |
+
[29] Mengyue Yang, Furui Liu, Zhitang Chen, Xinwei Shen, Jianye Hao, and Jun Wang. Causalvae: Disentangled representation learning via neural structural causal models. arXiv preprint arXiv: 2004.08697, 2020.
|
| 307 |
+
[30] Muhan Zhang, Shali Jiang, Zhicheng Cui, Roman Garnett, and Yixin Chen. D-vae: A variational autoencoder for directed acyclic graphs. In Advances in Neural Information Processing Systems, volume 32, 2019.
|
| 308 |
+
[31] Nan Rosemary Ke, Olexa Bilaniuk, Anirudh Goyal, Stefan Bauer, Hugo Larochelle, Chris Pal, and Yoshua Bengio. Learning neural causal models from unknown interventions. arXiv preprint arXiv: 1910.01075, 2019.
|
| 309 |
+
[32] Ignavier Ng, Zhuangyan Fang, Shengyu Zhu, Zhitang Chen, and Jun Wang. Masked gradient-based causal structure learning. arXiv preprint arXiv:1910.08527, 2019.
|
| 310 |
+
[33] Philippe Brouillard, Sébastien Lachapelle, Alexandre Lacoste, Simon Lacoste-Julien, and Alexandre Drouin. Differentiable causal discovery from interventional data. arXiv preprint arXiv:2007.01754, 2020.
|
| 311 |
+
[34] Dennis Wei, Tian Gao, and Yue Yu. Dags with no fears: A closer look at continuous optimization for learning bayesian networks. Advances in Neural Information Processing Systems, 2020.
|
| 312 |
+
[35] Ignavier Ng, Sébastien Lachapelle, Nan Rosemary Ke, and Simon Lacoste-Julien. On the convergence of continuous constrained optimization for structure learning. arXiv preprint arXiv:2011.11150, 2020.
|
| 313 |
+
[36] David Madigan, Jeremy York, and Denis Allard. Bayesian graphical models for discrete data. International Statistical Review/Revue Internationale de Statistique, pages 215–232, 1995.
|
| 314 |
+
[37] Paolo Giudici and Robert Castelo. Improving markov chain monte carlo model search for data mining. Machine learning, 50(1-2):127–158, 2003.
|
| 315 |
+
[38] Daniel Eaton and Kevin Murphy. Bayesian structure learning using dynamic programming and MCMC. In Proceedings of the Twenty-Third Conference on Uncertainty in Artificial Intelligence (UAI), 2007.
|
| 316 |
+
[39] Marco Grzegorczyk and Dirk Husmeier. Improving the structure MCMC sampler for Bayesian networks by introducing a new edge reversal move. Machine Learning, 71(2):265, April 2008.
|
| 317 |
+
[40] Jack Kuipers and Giusi Moffa. Partition mcmc for inference on acyclic digraphs. Journal of the American Statistical Association, 112(517):282–299, 2017.
|
| 318 |
+
[41] Byron Ellis and Wing Hung Wong. Learning causal bayesian network structures from experimental data. Journal of the American Statistical Association, 103(482):778–789, 2008.
|
| 319 |
+
[42] N. Friedman, M. Goldszmidt, and A. J. Wyner. Data analysis with Bayesian networks: A bootstrap approach. In Proceedings of the Fifteenth Conference on Uncertainty in Artificial Intelligence, 1999.
|
| 320 |
+
[43] Mikko Koivisto and Kismat Sood. Exact bayesian structure discovery in bayesian networks. Journal of Machine Learning Research, 5(May):549–573, 2004.
|
| 321 |
+
[44] Mikko Koivisto. Advances in exact bayesian structure discovery in bayesian networks. In Proceedings of the Twenty-Second Conference on Uncertainty in Artificial Intelligence, page 241–248, 2006.
|
| 322 |
+
[45] Marina Meila and Tommi S Jaakkola. Tractable bayesian learning of tree belief networks. Statistics and Computing, (16):77–92, 2006.
|
| 323 |
+
[46] Denver Dash and Gregory F Cooper. Model averaging for prediction with discrete bayesian networks. Journal of Machine Learning Research, 5(Sep):1177–1203, 2004.
|
| 324 |
+
[47] Thomas N Kipf and Max Welling. Variational graph auto-encoders. arXiv preprint arXiv:1611.07308, 2016.
|
| 325 |
+
[48] Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In Proceedings International Conference on Learning Representations, 2017.
|
| 326 |
+
[49] Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparametrization with gumbel-softmax. In Proceedings International Conference on Learning Representations 2017, April 2017.
|
| 327 |
+
[50] Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 328 |
+
[51] Shakir Mohamed, Mihaela Rosca, Michael Figurnov, and Andriy Mnih. Monte carlo gradient estimation in machine learning. Journal of Machine Learning Research, 21(132):1–62, 2020.
|
| 329 |
+
[52] Ignavier Ng, AmirEmad Ghassami, and Kun Zhang. On the role of sparsity and dag constraints for learning linear dags. Advances in Neural Information Processing Systems, 2020.
|
| 330 |
+
[53] P. Erdos and A Rényi. On random graphs. ˝ Publicationes Mathematicae, 6:290–297, 1959.
|
| 331 |
+
[54] Albert-László Barabási and Réka Albert. Emergence of scaling in random networks. Science, 286(5439): 509–512, 1999.
|
| 332 |
+
[55] Steen A Andersson, David Madigan, Michael D Perlman, et al. A characterization of markov equivalence classes for acyclic digraphs. Annals of statistics, 25(2):505–541, 1997.
|
| 333 |
+
[56] W Keith Hastings. Monte carlo sampling methods using markov chains and their applications. 1970.
|
| 334 |
+
[57] Alain Hauser and Peter Bühlmann. Jointly interventional and observational data: estimation of interventional markov equivalence classes of directed acyclic graphs. Journal of the Royal Statistical Society: Series B: Statistical Methodology, pages 291–318, 2015.
|
| 335 |
+
[58] Radford M Neal et al. Mcmc using hamiltonian dynamics. Handbook of Markov chain Monte Carlo, 2 (11):2, 2011.
|
| 336 |
+
[59] Max Welling and Yee Whye Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th International Conference on International Conference on Machine Learning, ICML’11, page 681–688, 2011.
|
| 337 |
+
[60] A. Philip Dawid. Beware of the DAG! In Proceedings of Workshop on Causality: Objectives and Assessment at NIPS 2008, pages 59–86, 2010.
|
| 338 |
+
[61] Jonas Peters and Peter Bühlmann. Identifiability of gaussian structural equation models with equal error variances. Biometrika, 101(1):219–228, 2014.
|
| 339 |
+
[62] Jack Kuipers, Giusi Moffa, and David Heckerman. Addendum on the scoring of Gaussian directed acyclic graphical models. Ann. Statist., 42(4):1689–1691, August 2014. Publisher: The Institute of Mathematical Statistics.
|
| 340 |
+
[63] Diviyan Kalainathan, Olivier Goudet, Isabelle Guyon, David Lopez-Paz, and Michèle Sebag. Structural agnostic modeling: Adversarial learning of causal graphs. arXiv preprint arXiv:1803.04929, 2018.
|
| 341 |
+
[64] Chris Sherlock, Paul Fearnhead, Gareth O Roberts, et al. The random walk metropolis: linking theory and practice through a case study. Statistical Science, 25(2):172–190, 2010.
|
| 342 |
+
[65] Dorit Dor and Michael Tarsi. A simple algorithm to construct a consistent extension of a partially oriented graph. 1992.
|
| 343 |
+
[66] Yangbo He, Jinzhu Jia, and Bin Yu. Counting and exploring sizes of markov equivalence classes of directed acyclic graphs. The Journal of Machine Learning Research, 16(1):2589–2609, 2015.
|
| 344 |
+
[67] Diviyan Kalainathan and Olivier Goudet. Causal discovery toolbox: Uncover causal relationships in python. arXiv preprint arXiv:1903.02278, 2019. URL https://github.com/FenTechSolutions/CausalDiscoveryToolbox.
|
| 345 |
+
[68] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax.
|
| 346 |
+
[69] Yoshua Bengio, Tristan Deleu, Nasim Rahaman, Nan Rosemary Ke, Sebastien Lachapelle, Olexa Bilaniuk, Anirudh Goyal, and Christopher Pal. A meta-transfer objective for learning to disentangle causal mechanisms. In International Conference on Learning Representations, 2020.
|
md/train/_89s8ViNwwj/_89s8ViNwwj.md
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Parameterized Knowledge Transfer for Personalized Federated Learning
|
| 2 |
+
|
| 3 |
+
Jie Zhang1, Song $\mathbf { G u o } ^ { 1 , * }$ , Xiaosong $\mathbf { M } \mathbf { a } ^ { 1 }$ , Haozhao Wang2, Wencao $\mathbf { X } \mathbf { u } ^ { 1 }$ , and Feijie $\mathbf { W } \mathbf { u } ^ { 1 }$
|
| 4 |
+
|
| 5 |
+
1Department of Computing, The Hong Kong Polytechnic University 2Department of Computer Science and Technology, HUST {jieaa.zhang,harli.wu}@connect.polyu.hk, hz_wang@hust.edu.cn, {song.guo,xiaosma,wenchao.xu}@polyu.edu.hk
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
In recent years, personalized federated learning (pFL) has attracted increasing attention for its potential in dealing with statistical heterogeneity among clients. However, the state-of-the-art pFL methods rely on model parameters aggregation at the server side, which require all models to have the same structure and size, and thus limits the application for more heterogeneous scenarios. To deal with such model constraints, we exploit the potentials of heterogeneous model settings and propose a novel training framework to employ personalized models for different clients. Specifically, we formulate the aggregation procedure in original pFL into a personalized group knowledge transfer training algorithm, namely, KT-pFL, which enables each client to maintain a personalized soft prediction at the server side to guide the others’ local training. KT-pFL updates the personalized soft prediction of each client by a linear combination of all local soft predictions using a knowledge coefficient matrix, which can adaptively reinforce the collaboration among clients who own similar data distribution. Furthermore, to quantify the contributions of each client to others’ personalized training, the knowledge coefficient matrix is parameterized so that it can be trained simultaneously with the models. The knowledge coefficient matrix and the model parameters are alternatively updated in each round following the gradient descent way. Extensive experiments on various datasets (EMNIST, Fashion_MNIST, CIFAR-10) are conducted under different settings (heterogeneous models and data distributions). It is demonstrated that the proposed framework is the first federated learning paradigm that realizes personalized model training via parameterized group knowledge transfer while achieving significant performance gain comparing with state-of-the-art algorithms.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Federated Learning (FL) [1] has emerged as an efficient paradigm to collaboratively train a shared machine learning model among multiple clients without directly accessing their private data. By periodically aggregating parameters from the clients for global model updating, it can converge to high accuracy and strong generalization. FL has shown its capability to protect user privacy while there remains a crucial challenge that significantly degrades the learning performance, i.e., statistic heterogeneity in users’ local datasets. Given the Non-Independent and Identically Distributed (Non-IID) user data, the trained global model often cannot be generalized well over each client [2–5].
|
| 14 |
+
|
| 15 |
+
To deal with the above issues, employing personalized models appears to be an effective solution in FL, i.e., personalized federated learning (pFL). Recent works regarding pFL include regularizationbased methods [6–8] (i.e., pFedMe [6], L2SGD [7], FedAMP [8]), meta-learning-based Per-FedAvg [9] and cluster-based IFCA [10, 11]. However, in order to aggregate the parameters from all clients, it is inevitable for them to have identical model structure and size. Such constraints would prevent status quo pFL methods from further application in practical scenarios, where clients are often willing to own unique models, i.e., with customized neural architectures to adapt to heterogeneous capacities in computation, communication and storage space, etc. Motivated by the paradigm of Knowledge Distillation (KD) [12–16] that knowledge can be transferred from a neural network to another via exchanging soft predictions instead of using the whole model parameters, KD-based FL training methods have been studied [12, 14–19] to collaboratively train heterogeneous models in a privacy-preserving way. However, these works have neglected the further personalization requirement of FL clients, which can be well satisfied via the personalized knowledge transfer for heterogeneous FL users.
|
| 16 |
+
|
| 17 |
+
In this paper, we seek to develop a novel training framework that can accommodate heterogeneous model structures for each client and achieve personalized knowledge transfer in each FL training round. To this end, we formulate the aggregation phase in FL to a personalized group knowledge transfer training algorithm dubbed KT-pFL, whose main idea is to allow each client to maintain a personalized soft prediction at the server that can be updated by a linear combination of all clients’ local soft predictions using a knowledge coefficient matrix. The principle of doing so is to reinforce the collaboration between clients with similar data distributions. Furthermore, to quantify the contribution of each client to other’s personalized soft prediction, we parameterize the knowledge coefficient matrix so that it can be trained simultaneously with the models following an alternating way in each iteration round.
|
| 18 |
+
|
| 19 |
+
We show that KT-pFL not only breaks down the barriers of homogeneous model restriction, which requires to transfer the entire parameters set in each round, whose data volume is much larger than that of the soft prediction, but also improves the training efficiency by using a parameterized update mechanism. Experimental results on different datasets and models show that our method can significantly improve the training efficiency and reduce the communication overhead. Our contributions are:
|
| 20 |
+
|
| 21 |
+
• To the best of our knowledge, this paper is the first to study the personalized knowledge transfer in FL. We propose a novel training framework, namely, KT-pFL, that maintains a personalized soft prediction for each client in the server to transfer knowledge among all clients. • To encourage clients with similar data distribution to collaborate with each other during the training process, we propose the ‘knowledge coefficient matrix’ to identify the contribution from one client to others’ local training. To show the efficiency of the parameterized method, we compared KT-pFL with two non-parameterized learning methods, i.e., TopK-pFL and Sim-pFL, which calculate the knowledge coefficient matrix on the cosine similarity between different model parameters. • We provide theoretical performance guarantee for KT-pFL and conduct extensive experiments over various deep learning models and datasets. The efficiency superiority of KT-pFL is demonstrated by comparing our proposed training framework with traditional pFL methods.
|
| 22 |
+
|
| 23 |
+
# 2 Related Work
|
| 24 |
+
|
| 25 |
+
Personalized FL with Homogeneous Models. Recently, various approaches have been proposed to realize personalized FL with homogeneous local model structure, which can be categorized into three types according to the number of global models applied in the server, i.e., single global model, multiple global models and no global model.
|
| 26 |
+
|
| 27 |
+
single global model type is a close variety of conventional FL, e.g., FedAvg [1], that combine global model optimization process with additional local model customization, and consist of four different kinds of approaches: local fine-tuning [20–23], regularization (e.g., pFedMe [6], L2SGD [7, 24], Ditto [25]), hybrid local and global models [11, 26, 27] and meta learning [9, 28]. All of these pFL methods apply a single global model, and thus limit the customized level of the local model at the client side. Therefore, some researchers [8, 10, 11] propose to train multiple global models at the server, where clients are clustered into several groups according to their similarity and different models are trained for each group. FedAMP [8] and FedFomo [29] can be regarded as special cases of the clustered-based method that each client owns a personalized global model at the server side. As a contrast, some literature waive the global model to deal with the heterogeneity problem [30, 31], such as multi-task learning based (i.e., MOCHA [31]) and hypernetwork-based framework (i.e.,
|
| 28 |
+
|
| 29 |
+
FedHN [30]). However, all these methods require aggregating the model parameters from the clients, who have to apply identical model structure and size, which hinders further personalization, e.g., employing personalized model architectures for heterogeneous clients is not feasible.
|
| 30 |
+
|
| 31 |
+
Heterogeneous FL and Knowledge Distillation. To enable heterogeneous model architectures in FL, Diao et al. [32] propose to upload a different subset of global model to the server for aggregation with the objective to produce a single global inference model. Another way of personalization is to use Knowledge Distillation (KD) in heterogeneous FL systems ([12, 14, 15, 17–19, 33, 34]). The principle is to aggregate local soft-predictions instead of local model parameters in the server, whereby each client can update the local model to approach the averaged global predictions. As KD is independent with model structure, some literature [13, 16] are proposed to take advantage of such independence to implement personalized FL with heterogeneous models at client sides. For example, Li et al. [13] propose FedMD to perform ensemble distillation for each client to learn well-personalized models. Different from FedMD that exchanging soft-predictions between the clients and the server, FedDF [16] first aggregates local model parameters for model averaging at the server side. Then, the averaged global models can be updated by performing knowledge transfer from all received (heterogeneous) client models.
|
| 32 |
+
|
| 33 |
+
To sum up, most of these schemes construct an ensembling teacher by simply averaging the teachers’ soft predictions, or by heuristically combining the output of the teacher models, which are far away from producing optimal combination of teachers. In our framework, KD is used in a more efficient way that the weights of the clients’ soft predictions are updated together with the model parameters during every FL training iteration.
|
| 34 |
+
|
| 35 |
+
# 3 Problem Formulation
|
| 36 |
+
|
| 37 |
+
We aim to collaboratively train personalized models for a set of clients applying different model structures in FL. Consider supervised learning whose goal is to learn a function that maps every input data to the correct class out of $\mathcal { C }$ possible options. We assume that there are $N$ clients, and each client $n$ can only access to his private dataset $\mathbf { \widetilde { D } } _ { n } : = \{ x _ { i } ^ { n } , y _ { i } \}$ , where $x _ { i }$ is the $i$ -th input data sample, $y _ { i }$ is the corresponding label of $x _ { i }$ , $y _ { i } \in \{ 1 , 2 , \cdots , \dot { C } \}$ . The number of data samples in dataset $\mathbb { D } _ { n }$ is denoted by $D _ { n }$ . $\mathbb { D } = \{ \mathbb { D } _ { 1 } , \mathbb { D } _ { 2 } , \cdot \cdot \cdot , \mathbb { D } _ { N } \}$ , $\begin{array} { r } { D = \sum _ { n = 1 } ^ { N } D _ { n } } \end{array}$ . In conventional $\mathrm { F L }$ , the goal of the learning system is to learn a global model w that minimizes the total empirical loss over the entire dataset $\mathbb { D }$ :
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\underset { \mathbf { w } } { \mathop { \operatorname* { m i n } } } \mathcal { L } ( \mathbf { w } ) : = \sum _ { n = 1 } ^ { N } \frac { D _ { n } } { D } \mathcal { L } _ { n } ( \mathbf { w } ) , \mathrm { ~ w h e r e ~ } \mathcal { L } _ { n } ( \mathbf { w } ) = \frac { 1 } { D _ { n } } \sum _ { i = 1 } ^ { D _ { n } } \mathcal { L } _ { C E } ( \mathbf { w } ; x _ { i } , y _ { i } ) ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $\mathcal { L } _ { n } ( \mathbf { w } )$ is the $n$ -th client’s local loss function that measures the local empirical risk over the private dataset $\mathbb { D } _ { n }$ and $\mathcal { L } _ { C E }$ is the cross-entropy loss function that measures the difference between the predicted values and the ground truth labels.
|
| 44 |
+
|
| 45 |
+
However, this formulation requires all local clients to have a unified model structure, which cannot be extended to more general cases where each client applies a unique model. Therefore, we need to reformulate the above optimization problem to break the barrier of homogeneous model structure. Besides, given the Non-IID clients’ datasets, it is inappropriate to just minimize the total empirical loss (i.e., $\begin{array} { r } { \operatorname* { m i n } _ { \mathbf { w } ^ { 1 } , \cdots , \mathbf { w } ^ { N } } \mathcal { L } ( \mathbf { w } ^ { 1 } , \cdots , \mathbf { w } ^ { N } ) : = \sum _ { n = 1 } ^ { N } \frac { D _ { n } } { D } \bar { L } _ { n } ( \mathbf { w } ^ { n } ) ) } \end{array}$ . To that end, we propose the following training framework:
|
| 46 |
+
|
| 47 |
+
Definition 3.1. Let $s ( \mathbf { w } ^ { n } , \hat { x } )$ denote the collaborative knowledge from client $n$ , and $\hat { x }$ denote a data sample from a public dataset $\mathbb { D } _ { r }$ that all clients can access to. Define the personalized loss function of client $n$ as
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\mathcal { L } _ { p e r , n } ( \mathbf { w } ^ { n } ) : = \mathcal { L } _ { n } ( \mathbf { w } ^ { n } ) + \lambda \sum _ { \hat { x } \in \mathbb { D } _ { r } } \mathcal { L } _ { K L } \left( \sum _ { m = 1 } ^ { N } c _ { m n } \cdot s ( \mathbf { w } ^ { m } , \hat { x } ) , s ( \mathbf { w } ^ { n } , \hat { x } ) \right) ,
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $\lambda > 0$ is a hyper-parameters, $\mathcal { L } _ { K L }$ stands for Kullback–Leibler (KL) Divergence function and is added to the loss function to transfer personalized knowledge from a teacher to another. $c _ { m n }$ is the knowledge coefficient which is used to estimate the contribution from client $m$ to $n$ . The second term in (2) allows each client to build his own personalized aggregated knowledge in the server and enhance the collaboration effect between clients with large c. The concept of collaborative knowledge can either refer to soft predictions or model parameters depending on the definition in different situations. For example, $s ( \mathbf { w } ^ { n } , \hat { x } )$ can be deemed to be a soft prediction of the client $n$ , which are calculated with the softmax of logits $z ^ { n }$ , i.e., $\begin{array} { r } { s ( \mathbf { w } ^ { n } , \hat { x } ) = \frac { \exp ( z _ { c } ^ { n } / T ) } { \sum _ { c = 1 } ^ { C } \exp ( z _ { c } ^ { n } / T ) } } \end{array}$ , logits $z ^ { n }$ is the output of the last fully connected layer on client $n$ ’s model, $T$ is the temperature hyperparameter of the softmax function.
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 1: Illustration of the KT-pFL framework. The workflow includes 6 steps: $\textcircled{1}$ local training on private data; $\textcircled{2}$ , $\textcircled{3}$ each client outputs the local soft prediction on public data and sends it to the server; $\textcircled{4}$ the server calculates each client’s personalized soft prediction via a linear combination of local soft predictions and knowledge coefficient matrix; $\textcircled{5}$ each client downloads the personalized soft prediction to perform distillation phase; $\textcircled{6}$ the server updates the knowledge coefficient matrix.
|
| 57 |
+
|
| 58 |
+
Definition 3.2. We define $\mathbf { c } \in \mathbb { R } ^ { N \times N }$ as the knowledge coefficient matrix:
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\mathbf { c } = \left. \begin{array} { c c c c } { c _ { 1 1 } } & { c _ { 1 2 } } & { \cdots } & { c _ { 1 N } } \\ { c _ { 2 1 } } & { c _ { 2 2 } } & { \cdots } & { c _ { 2 N } } \\ { \vdots } & { \vdots } & { \ddots } & { \vdots } \\ { c _ { N 1 } } & { c _ { N 2 } } & { \cdots } & { c _ { N N } } \end{array} \right. .
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
Our objective is to minimize
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
\operatorname* { m i n } _ { \mathbf { w } , \mathbf { c } } \mathcal { L } ( \mathbf { w } , \mathbf { c } ) : = \sum _ { n = 1 } ^ { N } \frac { D _ { n } } { D } \mathcal { L } _ { p e r , n } ( \mathbf { w } ^ { n } ) + \rho \| \mathbf { c } - \frac { \mathbf { 1 } } { N } \| ^ { 2 } ,
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
where $\mathbf { w } = [ \mathbf { w } ^ { 1 } , \cdots , \mathbf { w } ^ { N } ] \in \mathbb { R } ^ { \sum _ { n = 1 } ^ { N } d _ { n } }$ is the concatenated vector of all weights, $d _ { n }$ represents the dimensions of model parameter $\mathbf { w } ^ { n }$ . $\mathbf { 1 } \in \mathbb { R } ^ { n ^ { 2 } }$ is the identity matrix whose elements are all equal to 1. The second term in (4) is a regularization term that ensures generalization ability of the whole learning system. Without the regularization term, a client with a completely different data distribution tends to set large values of the knowledge coefficient (i.e., equal to 1), and no collaboration will be conducted during training in this case. $\rho$ is a regularization parameter that is larger than 0.
|
| 71 |
+
|
| 72 |
+
# 4 KT-pFL Algorithm
|
| 73 |
+
|
| 74 |
+
In this section, we introduce the proposed KT-pFL algorithm, where the local model parameters and knowledge coefficient matrix are updated alternatively. To enable personalized knowledge transfer in FL, we train personalized models locally according to the related collaborative knowledge. Insert (2) into (4), and we can design an alternating optimization approach to solve (4), that in each round we fix either w or c by turns, and optimize the unfixed one following an alternating way until a convergence point is reached.
|
| 75 |
+
|
| 76 |
+
Update w: In each communication round, we first fix c and optimize (train) w for several epochs locally. In this case, updating w depends on both the private data (i.e., $\mathcal { L } _ { C E }$ on $\mathbb { D } _ { n } , n \in [ 1 , \cdots , N ] )$ , that can only be accessed by the corresponding client, and the public data (i.e., $\mathcal { L } _ { K L }$ on $\mathbb { D } _ { r }$ ), which is accessible for all clients. We propose a two-stage updating framework for w:
|
| 77 |
+
|
| 78 |
+
# Algorithm 1 KT-pFL Algorithm
|
| 79 |
+
|
| 80 |
+
Input: $\mathbb { D }$ , $\mathbb { D } _ { r }$ , $\eta _ { 1 } , \eta _ { 2 } , \eta _ { 3 }$ and $T$
|
| 81 |
+
Output: $\mathbf { w } = [ \mathbf { w } ^ { 1 } , \cdots , \mathbf { w } ^ { N } ]$
|
| 82 |
+
1: Initialize $\mathbf { w } _ { 0 }$ and $\mathbf { c } _ { 0 }$
|
| 83 |
+
2: procedure SERVER-SIDE OPTIMIZATION
|
| 84 |
+
3: Distribute $\mathbf { w } _ { 0 }$ and $\mathbf { c } _ { 0 }$ to each client
|
| 85 |
+
4: for each communication round $t \in \{ 1 , 2 , . . . , T \}$ do
|
| 86 |
+
5: for each client $n$ in parallel do
|
| 87 |
+
6: $\mathbf { w } _ { t + 1 } ^ { n } C l i e n t L o c a l U p d a t e ( n , \mathbf { w } _ { t } ^ { n } , \mathbf { c } _ { t , n } )$
|
| 88 |
+
7: Update knowledge coefficient matrix c via (7)
|
| 89 |
+
8: Distribute $\mathbf { c } _ { t + 1 }$ to all clients
|
| 90 |
+
9: procedure CLIENTLOCALUPDATE $\mathbf { \Delta } _ { : } ( n , \mathbf { w } _ { t } ^ { n } , \mathbf { c } _ { t , n } )$
|
| 91 |
+
10: Client $n$ receives $\mathbf { w } _ { t } ^ { n }$ and $\mathbf { c } _ { n }$ from the server
|
| 92 |
+
11: for each local epoch $i$ from 1 to $E$ do
|
| 93 |
+
12: for mini-batch $\xi _ { t } \subseteq \mathbb { D } _ { n }$ do
|
| 94 |
+
13: Local Training: update model parameters on private data via (5)
|
| 95 |
+
14: for each distillation step $j$ from 1 to $R$ do
|
| 96 |
+
15: for mini-batch $\xi _ { r , t } \subseteq \mathbb { D } _ { r }$ do
|
| 97 |
+
16: Distillation: update model parameters on public data via (6)
|
| 98 |
+
return local parameters $\mathbf { w } _ { t + 1 } ^ { n }$
|
| 99 |
+
|
| 100 |
+
• Local Training: Train w on each client’s private data by applying a gradient descent step:
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\begin{array} { r } { \mathbf { w } ^ { n } \mathbf { w } ^ { n } - \eta _ { 1 } \nabla _ { \mathbf { w } ^ { n } } \mathcal { L } _ { n } ( \mathbf { w } ^ { n } ; \boldsymbol { \xi } _ { n } ) , } \end{array}
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
where $\xi _ { n }$ denotes the mini-batch of data $\mathbb { D } _ { n }$ used in local training, $\eta _ { 1 }$ is the learning rate.
|
| 107 |
+
|
| 108 |
+
• Distillation: Transfer knowledge from personalized soft prediction to each local client based on public dataset:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\mathbf { w } ^ { n } \mathbf { w } ^ { n } - \eta _ { 2 } \nabla _ { \mathbf { w } ^ { n } } \mathcal { L } _ { K L } ( \sum _ { m = 1 } ^ { N } \mathbf { c } _ { m } ^ { * , T } \cdot s ( \mathbf { w } ^ { m } , \boldsymbol { \xi } _ { r } ) , s ( \mathbf { w } ^ { n } , \boldsymbol { \xi } _ { r } ) ) ,
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
where $\xi _ { r }$ denotes the mini-batch of public data $\mathbb { D } _ { r }$ , and $\eta _ { 2 }$ is the learning rate. c ∗m $\mathrm { ~ \bf ~ c ~ } _ { m } ^ { * } =$ $[ c _ { m 1 } , c _ { m 2 } , \cdots , c _ { m N } ]$ is the knowledge coefficient vector for client $m$ , which can be found in $m$ -th row of $\mathbf { c }$ . Note that all collaborative knowledge and knowledge coefficient matrix are required to obtain the personalized soft prediction in this stage, which can be collected in the server.
|
| 115 |
+
|
| 116 |
+
Update c: After updating w locally for several epochs, we turn to fix w and update $\mathbf { c }$ in the server.
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\mathbf { c } \gets \mathbf { c } - \eta _ { 3 } \lambda \sum _ { n = 1 } ^ { N } \frac { D _ { n } } { D } \nabla _ { \mathbf { c } } \mathcal { L } _ { K L } \left( \sum _ { m = 1 } ^ { N } \mathbf { c } _ { m } \cdot s ( \mathbf { w } ^ { m , * } , \boldsymbol { \xi } _ { r } ) , s ( \mathbf { w } ^ { n , * } , \boldsymbol { \xi } _ { r } ) \right) - 2 \eta _ { 3 } \rho ( \mathbf { c } - \frac { 1 } { N } ) ,
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
where $\eta _ { 3 }$ is the learning rate for updating c.
|
| 123 |
+
|
| 124 |
+
Algorithm 1 demonstrates the proposed KT-pFL algorithm and the idea behind it is shown in Figure 1. In every communication round of training, the clients use local SGD to train several epochs based on the private data and then send the collaborative knowledge (e.g., soft predictions on public data) to the server. When the server receives the collaborative knowledge from each client, it aggregates them to form the personalized soft predictions according to the knowledge coefficient matrix. The server then sends back the personalized soft prediction to each client to perform local distillation. The clients then iterate for multiple steps over public dataset 2. After that, the knowledge coefficient matrix is updated in the server while fixing the model parameters w.
|
| 125 |
+
|
| 126 |
+
Performance Guarantee. Theorem 4.1 provides the performance analysis of the personalized model when each client owns Non-IID data. Detailed description and derivations are deferred to Appendix A.
|
| 127 |
+
|
| 128 |
+
Theorem 4.1. Denote the n-th local distribution and its empirical distribution by $\mathcal { D } _ { n }$ and $\hat { \mathcal { D } } _ { n }$ respectively, and the hypothesis $h \in \mathcal H$ trained on $\hat { \mathcal { D } } _ { n }$ by $h _ { \hat { \mathcal { D } } _ { n } }$ . There always exist $c _ { m , n } ^ { * } , m = 1 , \ldots , N ,$ uch that the expected loss of the personalized ensemble model for the dais not larger than that of the single model only trained with local data: $\mathcal { D } _ { n }$ $n$ $\begin{array} { r } { \mathcal { L } _ { \mathcal { D } _ { n } } ( \sum _ { m = 1 } ^ { N } c _ { m , n } ^ { * } h _ { \hat { D } _ { m } } ) ^ { } \leq } \end{array}$ $\mathcal { L } _ { D _ { n } } ( h _ { \hat { D } _ { n } } )$ . Besides, there exist some problems where the personalized ensemble model is strictly better, i.e., $\begin{array} { r } { \mathcal { L } _ { \mathcal { D } _ { n } } ( \sum _ { m = 1 } ^ { N } c _ { m , n } ^ { * } h _ { \hat { \mathcal { D } } _ { m } } ) < \mathcal { L } _ { \mathcal { D } _ { n } } ( h _ { \hat { \mathcal { D } } _ { n } } ) , } \end{array}$ .
|
| 129 |
+
|
| 130 |
+
Theorem 4.1 indicates that the performance of the personalized ensemble model under some suitable coefficient matrices is better than that of the model only trained on its local private data, which theoretically demonstrates the necessity of the parameterized personalization. However, it is challenging to find such matrices due to the complexity and diversity of machine learning models and data distributions. In this paper, our designed algorithm KT-pFL can find the desired coefficient matrix in a gradient descent manner, hence achieving the performance boost. Besides, we have the similar claim for the relationship between the personalized ensemble model and average ensemble model.
|
| 131 |
+
|
| 132 |
+
Remark 4.1. There always exist $c _ { m , n } ^ { * } , m = 1 , \ldots , N$ , such that the expected loss of the personalized ensemble model for the data distribution $\mathcal { D } _ { n }$ of client $n$ is not larger than that of the average ensemble model: $\begin{array} { r } { \ L \dot { \mathcal L } _ { \mathcal D _ { n } } ( \sum _ { m = 1 } ^ { N } c _ { m , n } ^ { * } h _ { \hat { \mathcal D } _ { m } } ) \leq { \mathcal L } _ { \mathcal D _ { n } } ( \frac { 1 } { N } \sum _ { m = 1 } ^ { N } h _ { \hat { \mathcal D } _ { m } } ) } \end{array}$ . Besides, there exist some problems where the personalized ensemble model is strictly better, i.e., $\begin{array} { r } { \mathcal { L } _ { \mathcal { D } _ { n } } ( \sum _ { m = 1 } ^ { N } c _ { m , n } ^ { * } h _ { \hat { D } _ { m } } ) ^ { } < } \end{array}$ $\begin{array} { r } { \mathcal { L } _ { \mathcal { D } _ { n } } \big ( \frac { 1 } { N } \sum _ { m = 1 } ^ { N } h _ { \hat { \mathcal { D } } _ { m } } \big ) } \end{array}$ .
|
| 133 |
+
|
| 134 |
+
# 5 Evaluations
|
| 135 |
+
|
| 136 |
+
# 5.1 Experimental Setup
|
| 137 |
+
|
| 138 |
+
Task and Datasets We evaluate our proposed training framework on three different image classification tasks: EMNIST [35], Fashion_MNIST [36] and CIFAR-10 [37]. For each dataset, we apply two different Non-IID data settings: 1) each client only contains two classes of samples; 2) each client contains all classes of samples, while the number of samples for each class is different from that of a different client. All datasets are split randomly with $7 5 \%$ and $2 5 \%$ for training and testing, respectively. The testing data on each client has the same distribution with its training data. For all methods, we record the average test accuracy of all local models for evaluation.
|
| 139 |
+
|
| 140 |
+
Model Structure: Four different lightweight model structures including LeNet [38], AlexNet [39], ResNet-18 [40], and ShuffleNetV2 [41] are adopted in our experiments. Our pFL system has 20 clients, who are assigned with four different model structures, i.e., five clients per model.
|
| 141 |
+
|
| 142 |
+
Baselines: Although KT-pFL is designed for effective personalized federated learning, it can be applied to both heterogeneous and homogeneous model cases. We first conduct experiments on heterogeneous systems where the neural architecture of the local models are different among clients. We compare the performance of KT-pFL to the non-personalized distillation-based methods: FedMD [13], FedDF [16] and the personalized distillation-based method pFedDF3 and other simple versions of KT-pFL including Sim-pFL and TopK-pFL. Sim-pFL calculates the knowledge coefficient by using cosine similarity between two local soft predictions. Instead of combining the knowledge from all clients, TopK-pFL obtains the personalized soft predictions only from $K$ clients4 who have higher value of cosine similarity.
|
| 143 |
+
|
| 144 |
+
To demonstrate the generalization and effectiveness of our proposed training framework, we further compare KT-pFL to FedAvg [1] and state-of-the-art pFL methods including Per-Fedavg [9], FedavgLocal FT[23], pFedMe [6], FedAMP [8], FedFomo[29] and FedHN[30] under the homogeneous model setting. Note that Per-FedAvg is a MAML-based method which aims to optimize the one-step gradient update for its personalized model. pFedMe and FedAMP are two regularized-based methods. The former one obtains personalized models by controlling the distance between local model and global model, while the later one facilitates the collaboration of clients with similar data distribution.
|
| 145 |
+
|
| 146 |
+
Implementation The experiments are implemented in PyTorch. We simulate a set of clients and a centralized server on one deep learning workstation (i.e., Intel(R) Core(TM) i9-9900KF CPU $@$ 3.6GHz with one NVIDIA GeForce RTX 2080Ti GPU).
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 2: Performance comparison of FedMD, FedDF, pFedDF, TopK-pFD, Sim-pFD, and KT-pFL in average test accuracy on three datasets (Non-IID case 1: each client contains all labels).
|
| 150 |
+
|
| 151 |
+

|
| 152 |
+
Figure 3: Performance comparison of FedMD, FedDF, pFedDF, TopK-pFD, Sim-pFD, and KT-pFL in average test accuracy on three datasets (Non-IID case 2: each client contains only two labels).
|
| 153 |
+
|
| 154 |
+
# 5.2 Results
|
| 155 |
+
|
| 156 |
+
Subject to space constraints, we only report the most important experimental results in this section. Please refer to Appendix B for the details of different Non-IID data settings on EMNIST, Fashion_MNIST and CIFAR10, the implementation details and the hyperparameter settings of all the methods, and also extra results about the convergence and robustness analysis. In our experiments, we run each experiment multiple times and record the average results.
|
| 157 |
+
|
| 158 |
+
Table 1: The comparison of final test accuracy $( \% )$ on different datasets with heterogeneous models (i.e., Lenet, AlexNet, ResNet-18 and ShuffleNetV2).
|
| 159 |
+
|
| 160 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">EMNIST</td><td colspan="2">Fashion_MNIST</td><td colspan="2">CIFAR-10</td></tr><tr><td>Non-IID_1</td><td>Non-IID_2</td><td>Non-IID_1</td><td>Non-IID_2</td><td>Non-IID_1</td><td>Non-IID_2</td></tr><tr><td>FedMD [13]</td><td>71.37</td><td>70.15</td><td>68.02</td><td>66.10</td><td>39.14</td><td>35.56</td></tr><tr><td>FedDF[16]</td><td>71.92</td><td>72.79</td><td>70.32</td><td>70.83</td><td>40.19</td><td>37.81</td></tr><tr><td>pFedDF</td><td>78.59</td><td>75.72</td><td>72.69</td><td>73.45</td><td>42.83</td><td>39.54</td></tr><tr><td>Sim-pFD</td><td>82.72</td><td>74.42</td><td>72.82</td><td>72.71</td><td>42.50</td><td>39.90</td></tr><tr><td>TopK-pFD</td><td>83.00</td><td>73.91</td><td>72.24</td><td>73.39</td><td>42.58</td><td>39.34</td></tr><tr><td>KT-pFL</td><td>84.65</td><td>76.30</td><td>75.48</td><td>75.60</td><td>43.82</td><td>41.04</td></tr></table>
|
| 161 |
+
|
| 162 |
+
# 5.2.1 Performance Comparison
|
| 163 |
+
|
| 164 |
+
Heterogeneous FL. For all the methods and all the data settings, the batch size on private data and public data are 128 and 256, respectively, the number of local epochs is 20 and the distillation steps is 1 in each communication round of pFL training. Unless mentioned, otherwise the public data used for EMNIST and Fashion_MNIST is MNIST, and the public data used for CIFAR-10 is CIFAR-100. the size of public data used in each communication round is 3000, the learning rate is set to 0.01 for EMNIST and Fashion_MNIST, and 0.02 for CIFAR-10.
|
| 165 |
+
|
| 166 |
+
Figure 2 and 3 show the curves of the average test accuracy during the training process on four different models with three datasets, which include the results of FedMD, FedDF, pFedDF, Sim-pFL,
|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
Figure 4: Performance comparison of FedAvg, Per-Fedavg, Fedavg-Local FT, pFedMe, FedAMP, FedFomo, FedHN and KT-pFL in average test accuracy on three datasets. The Non-IID data setting: each client contains all labels. 20 clients with homogeneous models: CNN [1]. Learning rate: 0.005.
|
| 170 |
+
|
| 171 |
+
Table 2: The comparison of final test accuracy $( \% )$ on different datasets with different number of homogeneous models (i.e., the same CNN architecture as [1]). For large-scale FL system with 100 clients, we set the client sampling rate as 0.1.
|
| 172 |
+
|
| 173 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">EMNIST</td><td colspan="2">Fashion_MNIST</td><td colspan="2">CIFAR-10</td></tr><tr><td>20 clients</td><td>100 clients</td><td>20 clients</td><td>100 clients</td><td>20 clients</td><td>100 clients</td></tr><tr><td>Fedavg [1]</td><td>85.86</td><td>76.84</td><td>80.69</td><td>72.36</td><td>51.94</td><td>43.56</td></tr><tr><td>Per-Fedavg [9]</td><td>86.16</td><td>82.87</td><td>85.91</td><td>77.93</td><td>55.61</td><td>49.82</td></tr><tr><td>Fedavg-Local FT[23]</td><td>86.59</td><td>84.55</td><td>90.17</td><td>80.93</td><td>42.88</td><td>50.91</td></tr><tr><td>pFedMe [6]</td><td>84.26</td><td>86.14</td><td>90.97</td><td>84.02</td><td>62.79</td><td>52.46</td></tr><tr><td>FedAMP[8]</td><td>88.51</td><td>85.63</td><td>90.79</td><td>84.72</td><td>60.75</td><td>51.26</td></tr><tr><td>FedFomo [29]</td><td>92.58</td><td>90.08</td><td>88.33</td><td>87.76</td><td>63.11</td><td>55.73</td></tr><tr><td>pFedHN[30]</td><td>94.27</td><td>92.21</td><td>92.22</td><td>89.14</td><td>65.31</td><td>57.38</td></tr><tr><td>KT-pFL</td><td>94.40</td><td>92.50</td><td>93.93</td><td>90.37</td><td>66.96</td><td>58.29</td></tr></table>
|
| 174 |
+
|
| 175 |
+
TopK-pFL and KT-pFL. We also summarize the final average test accuracy in Table 1. In two cases of Non-IID settings, KT-pFL obtains comparable or even better accuracy performance than others. The performances of FedMD, FedDF, pFedDF are worse than the other three methods. The reason is that taking the global aggregation of all local soft predictions trained on the Non-IID data from different clients produces only one global soft prediction, which cannot be well adapted to each client. The other two personalized methods, i.e., Sim-pFL and TopK-pFL, achieve comparably performance on most of cases with pFedDF. Our proposed method KT-pFL has the best performance, because each client can adaptively aggregate all local soft predictions to form a personalized one instead of being restricted to a global soft prediction.
|
| 176 |
+
|
| 177 |
+
Homogeneous FL. Apart from heterogeneous system, we further extend KT-pFL to homogeneous model setting. To conduct fair comparison with baselines, we exchange model parameters with the server to perform knowledge transfer. Specifically, each client maintains a personalized global model at the server side and each personalized global model is aggregated by a linear combination of local model parameters and knowledge coefficient matrix (Appendix C). In this case, we compare the performance of homogeneous-version of KT-pFL with FedAvg, Per-Fedavg, Fedavg-Local FT, pFedMe, FedAMP, FedFomo and FedHN. Figure 4 and Table 2 show the curve of the average test accuracy during training and the final average test accuracy on three different datasets, respectively. For all datasets, KT-pFL dominates the other seven methods on average test accuracy with less variance. Besides, the concept of FedAMP and FedFomo is similar with our proposed method KT-pFL. The difference is that the weights for each local model during personalized aggregation phase are updated in a gradient descent manner in KT-pFL.
|
| 178 |
+
|
| 179 |
+
To verify the efficiency of KT-pFL on large-scale FL system, we conduct experiments on 100 clients and apply the same client selection mechanism as other baselines. Specifically, in KT-pFL, only partial of elements in the knowledge coefficient matrix c will be updated in each communication round on large-scale FL systems. From the results in Table 2, it is obvious that our proposed method can work well both on small-scale and large-scale FL systems.
|
| 180 |
+
|
| 181 |
+
Table 3: The comparison of final test accuracy on different setting of local epochs $E$ and distillation steps $R$ .
|
| 182 |
+
|
| 183 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="4"># Local epochs (E)</td><td colspan="4"># Distillation steps (R)</td></tr><tr><td>5</td><td>10</td><td>15</td><td>20</td><td>1</td><td>2</td><td>3</td><td>5</td></tr><tr><td>EMNIST (%)</td><td>90.15</td><td>92.76</td><td>91.03</td><td>90.15</td><td>91.76</td><td>91.40</td><td>91.18</td><td>91.54</td></tr><tr><td>Fashion_MNIST (%)</td><td>88.73</td><td>89.14</td><td>88.58</td><td>89.42</td><td>89.14</td><td>89.90</td><td>89.07</td><td>88.08</td></tr><tr><td>CIFAR-10 (%)</td><td>58.30</td><td>59.38</td><td>59.34</td><td>59.24</td><td>59.24</td><td>57.99</td><td>59.22</td><td>58.91</td></tr></table>
|
| 184 |
+
|
| 185 |
+
Table 4: The comparison of final test accuracy on different setting of regularization parameter $\rho$
|
| 186 |
+
|
| 187 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="4"># Regularization parameter p</td></tr><tr><td>0.1</td><td>0.3</td><td>0.5</td><td>0.7</td></tr><tr><td>EMNIST (%)</td><td>90.96</td><td>90.66</td><td>90.88</td><td>91.76</td></tr><tr><td>Fashion_MNIST (%)</td><td>89.49</td><td>89.30</td><td>89.56</td><td>89.14</td></tr><tr><td>CIFAR-10 (%)</td><td>59.08</td><td>58.52</td><td>59.56</td><td>58.40</td></tr></table>
|
| 188 |
+
|
| 189 |
+
# 5.2.2 Effect of hyperparameters
|
| 190 |
+
|
| 191 |
+
To understand how different hyperparameters such as $E$ , $R$ , $\rho$ , and $\left| \mathbb { D } _ { r } \right|$ can affect the training performance of KT-pFL in different settings, we conduct various experiments on three datasets with η1 = η2 = η3 = 0.01.
|
| 192 |
+
|
| 193 |
+
Effect of Local Epochs $E$ . To reduce communication overhead, the server tends to allow clients to have more local computation steps, which can lead to less global updates and thus faster convergence. Therefore, we monitor the behavior of KT-pFL using a number of values of $E$ , whose results are given in Table 3. The results show that larger values of $E$ can benefit the convergence of the personalized models. There is, nevertheless, a trade-off between the computations and communications, i.e., while larger $E$ requires more computations at local clients, smaller $E$ needs more global communication rounds to converge. To do such trade-off, we fix $E = 2 0$ and evaluate the effect of other hyperparameters accordingly.
|
| 194 |
+
|
| 195 |
+
Effect of Distillation Steps $R$ . As the performance of the knowledge transfer is directly related to the number of distillation steps $R$ , we compare the performance of KT-pFL under different setting of distillation steps (e.g., $R = 1 , 2 , 3 , 5$ ). The number of local epochs is set to 20. The results show that larger value of $R$ cannot always lead to better performance, which means a moderate number of the distillation steps is necessary to approach to the optimal performance.
|
| 196 |
+
|
| 197 |
+
Effect of $\rho$ . As mentioned in Eq (4), $\rho$ is the regularization term to do the trade-off between personalization ability and generalization ability. For example, larger value of $\rho$ means that the knowledge coefficient of each local soft prediction should approach to $\scriptstyle { \frac { 1 } { N } }$ , and thus more generalization ability should be guaranteed. Table 4 shows the results of $\mathrm { K T - p F L }$ with different value of $\rho$ . In most settings, a significantly large value of $\rho$ will hurt the performance of KT-pFL.
|
| 198 |
+
|
| 199 |
+
Table 5: Performance of KT-pFL under different setting of public dataset (Task: Fashion_MNIST; Unlabeled Open Dataset: divided from Fashion_MNIST).
|
| 200 |
+
|
| 201 |
+
<table><tr><td>Public dataset</td><td>Test Accuracy</td></tr><tr><td>MNIST</td><td>89.14 (± 0.15)</td></tr><tr><td>EMNIST</td><td>88.76(± 0.21)</td></tr><tr><td>Unlabeled Open Dataset</td><td>89.03 (± 0.11)</td></tr></table>
|
| 202 |
+
|
| 203 |
+
Effect of different public dataset. Besides, we compare the performance of our proposed method on different public datasets (Table 5). From the experimental results, we can observe that different settings of the public dataset have little effect on the training performance.
|
| 204 |
+
|
| 205 |
+
Effect of $\left| \mathbb { D } _ { r } \right|$ . Table 6 demonstrates the effect of public data size $\left| \mathbb { D } _ { r } \right|$ used in local distillation phase. When the size of the public data is increased, KT-pFL has higher average test accuracy. However, very large $\left| \mathbb { D } _ { r } \right|$ will not only slow down the convergence of KT-pFL but also incur higher computation time at the clients. During the experiments, the value of $\left| \mathbb { D } _ { r } \right|$ is configured to 3000.
|
| 206 |
+
|
| 207 |
+
Table 6: The comparison of final test accuracy on different setting of the public data size $\left| \mathbb { D } _ { r } \right|$ .
|
| 208 |
+
|
| 209 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="6"># Size of public data (IDrl)</td></tr><tr><td>10</td><td>100</td><td>500</td><td>1000</td><td>3000</td><td>5000</td></tr><tr><td>EMNIST (%)</td><td>56.19</td><td>73.44</td><td>91.25</td><td>91.47</td><td>91.66</td><td>91.32</td></tr><tr><td>Fashion_MNIST (%)</td><td>50.80</td><td>67.43</td><td>88.08</td><td>89.40</td><td>89.50</td><td>89.14</td></tr><tr><td>CIFAR-10 (%)</td><td>39.08</td><td>47.70</td><td>58.93</td><td>58.79</td><td>58.91</td><td>58.40</td></tr></table>
|
| 210 |
+
|
| 211 |
+
# 5.2.3 Efficiency Evaluation
|
| 212 |
+
|
| 213 |
+
To evaluate the communication overhead, we record three aspects information: Data (batch size used in distillation phase), Param (model parameters) and Soft Prediction without using data compression techniques. The results are shown in Figure 5. Compared with conventional parameter-based pFL methods, the communication overhead on soft prediction-based KT-pFL is far less than Conv-pFL.
|
| 214 |
+
|
| 215 |
+

|
| 216 |
+
Figure 5: Communication Efficiency (X-axis units: MBytes) on three datasets. KL-pFL: soft prediction-based personalized federated learning; Conv-pFL: conventional parameter-based personalized federated learning. (20 models, 30 communication rounds for all datasets. In this experiment, the public dataset is stored on the server.)
|
| 217 |
+
|
| 218 |
+
# Broader Impact
|
| 219 |
+
|
| 220 |
+
FL has been emerged as new paradigm to collaboratively train models among multiple clients in a privacy-preserving manner. Due to the diversity of users (e.g., statistical and systematic heterogeneity, etc.), applying personalization in FL is essential for future trend. Our method KT-pFL not only breaks the barriers of homogeneous model constraint, which can significantly reduce the communication overhead during training, but also improves the training efficiency via a parameterized update mechanism without additional computation overhead at the client side. This research has the potential to enable various devices to cooperatively train ML tasks based on customized neural network architectures.
|
| 221 |
+
|
| 222 |
+
# Acknowledgements
|
| 223 |
+
|
| 224 |
+
This research was supported by the funding from Hong Kong RGC Research Impact Fund (RIF) with the Project No. R5060-19, General Research Fund (GRF) with the Project No. 152221/19E and 15220320/20E, the National Natural Science Foundation of China (61872310), and Shenzhen Science and Technology Innovation Commission (R2020A045).
|
| 225 |
+
|
| 226 |
+
# References
|
| 227 |
+
|
| 228 |
+
[1] Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Agüera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, AISTATS, 2017.
|
| 229 |
+
|
| 230 |
+
[2] Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. In Proceedings of Machine Learning and Systems, MLSys, 2020.
|
| 231 |
+
[3] Mehryar Mohri, Gary Sivek, and Ananda Theertha Suresh. Agnostic federated learning. In Proceedings of International Conference on Machine Learning, ICML, pages 4615–4625, 2019.
|
| 232 |
+
[4] Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank Reddi, Sebastian Stich, and Ananda Theertha Suresh. Scaffold: Stochastic controlled averaging for federated learning. In Proceedings of International Conference on Machine Learning, ICML, pages 5132–5143, 2020.
|
| 233 |
+
[5] Tian Li, Maziar Sanjabi, Ahmad Beirami, and Virginia Smith. Fair resource allocation in federated learning. In Proceedings of 8th International Conference on Learning Representations, ICLR, 2020.
|
| 234 |
+
[6] Canh T. Dinh, Nguyen H. Tran, and Tuan Dung Nguyen. Personalized federated learning with moreau envelopes. In Proceedings of Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems, NeurIPS, 2020.
|
| 235 |
+
[7] Filip Hanzely and Peter Richtárik. Federated learning of a mixture of global and local models. arXiv preprint arXiv:2002.05516, 2020.
|
| 236 |
+
[8] Yutao Huang, Lingyang Chu, Zirui Zhou, Lanjun Wang, Jiangchuan Liu, Jian Pei, and Yong Zhang. Personalized cross-silo federated learning on non-iid data. In Proceedings of the AAAI Conference on Artificial Intelligence, AAAI, 2021.
|
| 237 |
+
[9] Alireza Fallah, Aryan Mokhtari, and Asuman E. Ozdaglar. Personalized federated learning with theoretical guarantees: A model-agnostic meta-learning approach. In Proceedings of Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems, NeurIPS, 2020.
|
| 238 |
+
[10] Avishek Ghosh, Jichan Chung, Dong Yin, and Kannan Ramchandran. An efficient framework for clustered federated learning. In Proceedings of Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems, NeurIPS, 2020.
|
| 239 |
+
[11] Yishay Mansour, Mehryar Mohri, Jae Ro, and Ananda Theertha Suresh. Three approaches for personalization with applications to federated learning. arXiv preprint arXiv:2002.10619, 2020.
|
| 240 |
+
[12] Eunjeong Jeong, Seungeun Oh, Hyesung Kim, Jihong Park, Mehdi Bennis, and Seong-Lyun Kim. Communication-efficient on-device machine learning: Federated distillation and augmentation under non-iid private data. arXiv preprint arXiv:1811.11479, 2018.
|
| 241 |
+
[13] Daliang Li and Junpu Wang. FedMD: Heterogenous federated learning via model distillation. arXiv, oct 2019.
|
| 242 |
+
[14] Hongyan Chang, Virat Shejwalkar, Reza Shokri, and Amir Houmansadr. Cronus: Robust and heterogeneous collaborative learning with black-box knowledge transfer. arXiv preprint arXiv:1912.11279, 2019.
|
| 243 |
+
[15] Sohei Itahara, Takayuki Nishio, Yusuke Koda, Masahiro Morikura, and Koji Yamamoto. Distillation-based semi-supervised federated learning for communication-efficient collaborative training with non-iid private data. arXiv preprint arXiv:2008.06180, 2020.
|
| 244 |
+
[16] Tao Lin, Lingjing Kong, Sebastian U. Stich, and Martin Jaggi. Ensemble distillation for robust model fusion in federated learning. In Proceedings of Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems, NeurIPS, 2020.
|
| 245 |
+
[17] Hong-You Chen and Wei-Lun Chao. Fedbe: Making bayesian model ensemble applicable to federated learning. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021.
|
| 246 |
+
[18] Yanlin Zhou, George Pu, Xiyao Ma, Xiaolin Li, and Dapeng Wu. Distilled one-shot federated learning. CoRR, abs/2009.07999, 2020.
|
| 247 |
+
[19] Lichao Sun and Lingjuan Lyu. Federated model distillation with noise-free differential privacy. In Zhi-Hua Zhou, editor, Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI 2021, pages 1563–1570. ijcai.org, 2021.
|
| 248 |
+
[20] Kangkang Wang, Rajiv Mathews, Chloé Kiddon, Hubert Eichner, Françoise Beaufays, and Daniel Ramage. Federated evaluation of on-device personalization. arXiv preprint arXiv:1910.10252, 2019.
|
| 249 |
+
[21] Johannes Schneider and Michail Vlachos. Personalization of deep learning. arXiv preprint arXiv:1909.02803, 2019.
|
| 250 |
+
[22] Manoj Ghuhan Arivazhagan, Vinay Aggarwal, Aaditya Kumar Singh, and Sunav Choudhary. Federated learning with personalization layers. arXiv preprint arXiv:1912.00818, 2019.
|
| 251 |
+
[23] Tao Yu, Eugene Bagdasaryan, and Vitaly Shmatikov. Salvaging federated learning by local adaptation. CoRR, abs/2002.04758, 2020.
|
| 252 |
+
[24] Filip Hanzely, Slavomír Hanzely, Samuel Horváth, and Peter Richtárik. Lower bounds and optimal algorithms for personalized federated learning. In Proceedings of Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems, NeurIPS, 2020.
|
| 253 |
+
[25] Tian Li, Shengyuan Hu, Ahmad Beirami, and Virginia Smith. Ditto: Fair and robust federated learning through personalization. In International Conference on Machine Learning, pages 6357–6368. PMLR, 2021.
|
| 254 |
+
[26] Yuyang Deng, Mohammad Mahdi Kamani, and Mehrdad Mahdavi. Adaptive personalized federated learning. arXiv preprint arXiv:2003.13461, 2020.
|
| 255 |
+
[27] Matthias Reisser, Christos Louizos, Efstratios Gavves, and Max Welling. Federated mixture of experts. arXiv preprint arXiv:2107.06724, 2021.
|
| 256 |
+
[28] Yihan Jiang, Jakub Konecnˇ y, Keith Rush, and Sreeram Kannan. Improving federated learning \` personalization via model agnostic meta learning. arXiv preprint arXiv:1909.12488, 2019.
|
| 257 |
+
[29] Michael Zhang, Karan Sapra, Sanja Fidler, Serena Yeung, and Jose M. Alvarez. Personalized federated learning with first order model optimization. In 9th International Conference on Learning Representations, ICLR 2021. OpenReview.net, 2021.
|
| 258 |
+
[30] Aviv Shamsian, Aviv Navon, Ethan Fetaya, and Gal Chechik. Personalized federated learning using hypernetworks. In Marina Meila and Tong Zhang, editors, Proceedings of the 38th International Conference on Machine Learning, ICML 2021, volume 139, pages 9489–9502. PMLR, 2021.
|
| 259 |
+
[31] Virginia Smith, Chao-Kai Chiang, Maziar Sanjabi, and Ameet S. Talwalkar. Federated multitask learning. In Proceedings of Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems, NeurIPS, 2017.
|
| 260 |
+
[32] Enmao Diao, Jie Ding, and Vahid Tarokh. Heterofl: Computation and communication efficient federated learning for heterogeneous clients. In 9th International Conference on Learning Representations, ICLR 2021. OpenReview.net, 2021.
|
| 261 |
+
[33] Neel Guha, Ameet Talwalkar, and Virginia Smith. One-shot federated learning. CoRR, abs/1902.11175, 2019.
|
| 262 |
+
[34] Chaoyang He, Salman Avestimehr, and Murali Annavaram. Group knowledge transfer: Collaborative training of large cnns on the edge. arXiv preprint arXiv:2007.14513, 2020.
|
| 263 |
+
[35] Gregory Cohen, Saeed Afshar, Jonathan Tapson, and André van Schaik. EMNIST: extending MNIST to handwritten letters. In Proceedings of 2017 International Joint Conference on Neural Networks, IJCNN, 2017.
|
| 264 |
+
[36] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
|
| 265 |
+
[37] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 266 |
+
[38] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 267 |
+
[39] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Proceedings of Advances in Neural Information Processing Systems 25: 26th Annual Conference on Neural Information Processing Systems, NeurIPS, pages 1106–1114, 2012.
|
| 268 |
+
[40] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR, pages 770–778, 2016.
|
| 269 |
+
[41] Ningning Ma, Xiangyu Zhang, Hai-Tao Zheng, and Jian Sun. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European conference on computer vision, ECCV, pages 116–131, 2018.
|
md/train/mjyMGFL8N2/mjyMGFL8N2.md
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Provable Guarantees for Self-Supervised Deep Learning with Spectral Contrastive Loss
|
| 2 |
+
|
| 3 |
+
Jeff Z. HaoChen Stanford University jhaochen@stanford.edu
|
| 4 |
+
|
| 5 |
+
Colin Wei Stanford University colinwei@stanford.edu
|
| 6 |
+
|
| 7 |
+
Adrien Gaidon Toyota Research Institute adrien.gaidon@tri.global
|
| 8 |
+
|
| 9 |
+
Tengyu Ma Stanford University tengyuma@stanford.edu
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
Recent works in self-supervised learning have advanced the state-of-the-art by relying on the contrastive learning paradigm, which learns representations by pushing positive pairs, or similar examples from the same class, closer together while keeping negative pairs far apart. Despite the empirical successes, theoretical foundations are limited – prior analyses assume conditional independence of the positive pairs given the same class label, but recent empirical applications use heavily correlated positive pairs (i.e., data augmentations of the same image). Our work analyzes contrastive learning without assuming conditional independence of positive pairs using a novel concept of the augmentation graph on data. Edges in this graph connect augmentations of the same datapoint, and ground-truth classes naturally form connected sub-graphs. We propose a loss that performs spectral decomposition on the population augmentation graph and can be succinctly written as a contrastive learning objective on neural net representations. Minimizing this objective leads to features with provable accuracy guarantees under linear probe evaluation. By standard generalization bounds, these accuracy guarantees also hold when minimizing the training contrastive loss. Empirically, the features learned by our objective can match or outperform several strong baselines on benchmark vision datasets. In all, this work provides the first provable analysis for contrastive learning where guarantees for linear probe evaluation can apply to realistic empirical settings.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Recent empirical breakthroughs have demonstrated the effectiveness of self-supervised learning, which trains representations on unlabeled data with surrogate losses and self-defined supervision signals [4, 6, 10, 14, 23, 24, 35, 38, 41, 42, 50–52]. Self-supervision signals in computer vision are often defined by using data augmentation to produce multiple views of the same image. For example, the recent contrastive learning objectives [3, 12, 13, 15, 22] encourage closer representations for augmentations (views) of the same natural data than for randomly sampled pairs of data.
|
| 18 |
+
|
| 19 |
+
Despite the empirical successes, there is a limited theoretical understanding of why self-supervised losses learn representations that can be adapted to downstream tasks, for example, using linear heads. Recent mathematical analyses by Arora et al. [3], Lee et al. $\pmb { \pmb { 2 8 } }$ , Tosh et al. [44, 45] provide guarantees under the assumption that two views are somewhat independent conditioned on the label. However, the pair of augmented examples used in practical algorithms usually exhibit a strong correlation, even conditioned on the label. For instance, two augmentations of the same dog image share much more similarity than augmentations of two different random dog images. Thus the existing theory does not explain the practical success of self-supervised learning.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Left: demonstration of the population augmentation graph. Two augmented data are connected if they are views of the same natural data. Augmentations of data from different classes in the downstream tasks are assumed to be nearly disconnected, whereas there are more connections within the same class. We allow the existence of disconnected sub-graphs within a class corresponding to potential sub-classes. Right: decomposition of the learned representations. The representations (rows in the RHS) learned by minimizing the population spectral contrastive loss can be decomposed as the LHS. The scalar $s _ { x _ { i } }$ is positive for every augmented data $x _ { i }$ . Columns of the matrix labeled “eigenvectors” are the top eigenvectors of the normalized adjacency matrix of the augmentation graph defined in Section ${ \bar { 3 . } } 1 .$ The operator $\odot$ multiplies row-wise each $s _ { x _ { i } }$ with the $x _ { i }$ -th row of the eigenvector matrix. When classes (or sub-classes) are exactly disconnected in the augmentation graph, the eigenvectors are sparse and align with the sub-class structure. The invertible $Q$ matrix does not affect the performance of the rows under the linear probe.
|
| 23 |
+
|
| 24 |
+
This paper presents a theoretical framework for self-supervised learning without requiring conditional independence. We design a principled, practical loss function for learning neural net representations that resembles state-of-the-art contrastive learning methods. We prove that, under a simple and realistic data assumption, linear classification using representations learned on a polynomial number of unlabeled data samples can recover the ground-truth labels of the data with high accuracy.
|
| 25 |
+
|
| 26 |
+
The fundamental data property that we leverage is a notion of continuity of the population data within the same class. Though a random pair of examples from the same class can be far apart, the pair is often connected by (many) sequences of examples, where consecutive examples in the sequences are close neighbors within the same class. This property is more salient when the neighborhood of an example includes many different types of augmentations. Prior work $\mathbb { H }$ empirically demonstrates this type of connectivity property and uses it in the analysis of pseudolabeling algorithms.
|
| 27 |
+
|
| 28 |
+
More formally, we define the population augmentation graph, whose vertices are all the augmented data in the population distribution, which can be an exponentially large or infinite set. Two vertices are connected with an edge if they are augmentations of the same natural example. Our main assumption is that for some proper $m \in { \mathcal { Z } } ^ { + }$ , the sparsest $m$ -partition (Definition 3.4) is large. This intuitively states that we can’t split the augmentation graph into too many disconnected sub-graphs by only removing a sparse set of edges. This assumption can be seen as a graph-theoretic version of the continuity assumption on population data. We also assume that there are very few edges across different ground-truth classes (Assumption $\textcircled { 3 . 5 }$ . Figure $\bigtriangledown$ (left) illustrates a realistic scenario where dog and cat are the ground-truth categories, between which edges are very rare. Each breed forms a sub-graph that has sufficient inner connectivity and thus cannot be further partitioned.
|
| 29 |
+
|
| 30 |
+
Our assumption fundamentally does not require conditional independence and can allow disconnected sub-graphs within a class. The classes in the downstream task can be also somewhat flexible as long as they are disconnected in the augmentation graph. For example, when the augmentation graph consists of $m$ disconnected sub-graphs corresponding to fine-grained classes, our assumptions allow the downstream task to have any $r \leq m$ coarse-grained classes containing these fine-grained classes as a sub-partition. Prior work $\boxed { \boxplus 9 }$ on pseudolabeling algorithms essentially requires an exact alignment between sub-graphs and downstream classes (i.e., $r = m$ ). They face this limitation because their analysis requires fitting discrete pseudolabels on the unlabeled data. We avoid this difficulty because we consider directly learning continuous representations on the unlabeled data.
|
| 31 |
+
|
| 32 |
+
We apply spectral decomposition—a classical approach for graph partitioning, also known as spectral clustering $\textcircled { 1 3 7 } , \textcircled { 3 9 } \textcircled { 1 }$ in machine learning—to the adjacency matrix defined on the population augmentation graph. We form a matrix where the top- $k$ eigenvectors are the columns and interpret each row of the matrix as the representation (in $\mathbb { R } ^ { k }$ ) of an example. Somewhat surprisingly, we show that this feature extractor can be also recovered (up to some linear transformation) by minimizing the following population objective which is similar to the standard contrastive loss (Section $\textcircled { 3 . 2 }$
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
\mathcal { L } ( f ) = - 2 \cdot \mathbb { E } _ { x , x ^ { + } } \left[ f ( x ) ^ { \top } f ( x ^ { + } ) \right] + \mathbb { E } _ { x , x ^ { \prime } } \big [ \left( f ( x ) ^ { \top } f ( x ^ { \prime } ) \right) ^ { 2 } \big ] ,
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
where $( x , x ^ { + } )$ is a pair of augmentations of the same data, $( x , x ^ { \prime } )$ is a pair of independently random augmented data, and $f$ is a parameterized function from augmented data to $\mathbb { R } ^ { k }$ . Figure $\boxed { 1 }$ (right) illustrates the relationship between the eigenvector matrix and the learned representations. We call this loss the population spectral contrastive loss.
|
| 39 |
+
|
| 40 |
+
We analyze the linear classification performance of the representations learned by minimizing the population spectral contrastive loss. Our main result (Theorem $\textcircled { 3 . 7 }$ shows that when the representation dimension exceeds the maximum number of disconnected sub-graphs, linear classification with learned representations is guaranteed to have a small error. Our theorem reveals a trend that a larger representation dimension is needed when there are a larger number of disconnected sub-graphs. Our analysis relies on novel techniques tailored to linear probe performance, which have not been studied in the spectral graph theory community to the best of our knowledge.
|
| 41 |
+
|
| 42 |
+
The spectral contrastive loss also works on empirical data. Since our approach optimizes parametric loss functions, guarantees involving the population loss can be converted to finite sample results using off-the-shelf generalization bounds. The sample complexity is polynomial in the Rademacher complexity of the model family and other relevant parameters (Theorem 4.1 and Theorem $\boxed { 4 . 2 }$ .
|
| 43 |
+
|
| 44 |
+
In summary, our main theoretical contributions are: 1) we propose a simple contrastive loss motivated by spectral decomposition of the population data graph, 2) under simple and realistic assumptions, we provide downstream classification guarantees for the representation learned by minimizing this loss on population data, and 3) our analysis is easily applicable to deep networks with polynomial unlabeled samples via off-the-shelf generalization bounds.
|
| 45 |
+
|
| 46 |
+
In addition, we implement and test the proposed spectral contrastive loss on standard vision benchmark datasets. We demonstrate that the features learned by our algorithm can match or outperform several strong baselines [12, 14, 15, 21] when evaluated using a linear probe.
|
| 47 |
+
|
| 48 |
+
# 2 Additional related works
|
| 49 |
+
|
| 50 |
+
Empirical works on self-supervised learning. Self-supervised learning algorithms have been shown to successfully learn representations that benefit downstream tasks [4, 6, 10, 12, 13, 15, 22– 24, 35, 38, 41, 42, 50–52]. Many recent self-supervised learning algorithms learn features with siamese networks $\textcircled { 8 } \textcircled { 1 8 }$ , where two neural networks of shared weights are applied to pairs of augmented data. Introducing asymmetry to siamese networks either with a momentum encoder like BYOL [21] or by stopping gradient propagation for one branch of the siamese network like SimSiam [14] has been shown to effectively avoid collapsing. Contrastive methods [12, 15, 22] minimize the InfoNCE loss $\pmb { \Vert 3 8 } \Vert$ , where two views of the same data are attracted while views from different data are repulsed.
|
| 51 |
+
|
| 52 |
+
Theoretical works on self-supervised learning. In addition to works [3, 28, 44, 45] discussed in the introduction, several other works [5, 43, 47, 48] also theoretically study self-supervised learning. The work Tsai et al. $\boxed { \boxplus 7 }$ prove that self-supervised learning methods can extract task-relevant information and discard task-irrelevant information, but lacks guarantees for solving downstream tasks efficiently with simple (e.g., linear) models. Tian et al. $\bar { \bigtriangledown } 4 3 \|$ study why non-contrastive selfsupervised learning methods can avoid feature collapse. Cai et al. $\pmb { \mathbb { Q } } \|$ analyze domain adaptation algorithms for subpopulation shift with a similar expansion condition as $| \dot { \overline { { { \vert 4 9 \vert } } } }$ while also allowing disconnected parts within each class, but require access to ground-truth labels during training. In contrast, our algorithm doesn’t need labels during pre-training.
|
| 53 |
+
|
| 54 |
+
# 3 Spectral contrastive learning on population data
|
| 55 |
+
|
| 56 |
+
In this section, we introduce our theoretical framework, the spectral contrastive loss, and the main analysis of the performance of the representations learned on population data.
|
| 57 |
+
|
| 58 |
+
We use $\overline { { \mathcal { X } } }$ to denote the set of all natural data (raw inputs without augmentation). We assume that each ${ \bar { x } } \in { \overline { { \mathcal { X } } } }$ belongs to one of $r$ classes, and let $y : \overline { { \mathcal { X } } } [ r ]$ denote the ground-truth (deterministic) labeling function. Let $\mathcal { P } _ { \overline { { \mathcal { X } } } }$ be the population distribution over $\overline { { \mathcal { X } } }$ from which we draw training data and test our final performance. For the ease of exposition, we assume $\overline { { \mathcal { X } } }$ to be a finite but exponentially large set (e.g., all real vectors in $\mathbb { R } ^ { d }$ with bounded precision).1
|
| 59 |
+
|
| 60 |
+
We next formulate data augmentations. Given a natural data sample ${ \bar { x } } \in { \overline { { \mathcal { X } } } }$ , we use $\boldsymbol { \mathcal { A } } ( \cdot | \boldsymbol { \bar { x } } )$ to denote the distribution of its augmentations. For instance, when $\bar { x }$ represents an image, $\boldsymbol { \mathcal { A } } ( \cdot | \boldsymbol { \bar { x } } )$ can be the distribution of common augmentations $\mathbb { \left[ 1 2 \right] }$ that includes Gaussian blur, color distortion and random cropping. We use $\mathcal { X }$ to denote the set of all augmented data, which is the union of supports of all $\boldsymbol { \mathcal { A } } ( \cdot | \boldsymbol { \bar { x } } )$ for $\bar { x } \in \overline { { \mathcal { X } } }$ . As with $\overline { { \mathcal { X } } }$ , we also assume that $\mathcal { X }$ is a finite but exponentially large set, and denote $N = | { \mathcal { X } } |$ .
|
| 61 |
+
|
| 62 |
+
We will learn an embedding function $f : \mathcal { X } \to \mathbb { R } ^ { k }$ , and then evaluate its quality by the minimum error achieved with a linear probe. Concretely, a linear classifier has weights $B \in \mathbb { R } ^ { \bar { k } \times r }$ and predicts $\begin{array} { r } { g _ { f , B } ( x ) = \arg \operatorname* { m a x } _ { i \in [ r ] } ( f ( \dot { x } ) ^ { \top } B ) _ { i } } \end{array}$ for an augmented data $x$ (arg max breaks tie arbitrarily). Then, given a natural data sample $\bar { x }$ , we ensemble the predictions on augmented data and predict:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\bar { g } _ { f , B } ( \bar { x } ) : = \underset { i \in [ r ] } { \arg \operatorname* { m a x } } \ \underset { x \sim \mathcal { A } ( \cdot | \bar { x } ) } { \operatorname* { P r } } \left[ g _ { f , B } ( x ) = i \right] .
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
Define the linear probe error as the error of the best possible linear classifier on the representations:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\mathcal { E } ( f ) : = \operatorname* { m i n } _ { B \in \mathbb { R } ^ { k \times r } } \operatorname* { P r } _ { \bar { x } \sim \mathcal { P } _ { \overline { { \mathcal { X } } } } } [ y ( \bar { x } ) \neq \bar { g } _ { f , B } ( \bar { x } ) ]
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
# 3.1 Augmentation graph and spectral decomposition
|
| 75 |
+
|
| 76 |
+
Our approach is based on the central concept of population augmentation graph, denoted by $G ( \mathcal { X } , w )$ , where the vertex set is all augmentation data $\mathcal { X }$ and $w$ denotes the edge weights defined below. For any two augmented data $x , x ^ { \prime } \in { \mathcal { X } }$ , define the weight $w _ { x x ^ { \prime } }$ as the marginal probability of generating the pair $x$ and $x ^ { \prime }$ from a random natural data $\hat { x } \sim \mathcal { P } _ { \overline { { x } } }$ :
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
w _ { x x ^ { \prime } } : = \mathbb { E } _ { \bar { x } \sim \mathcal { P } _ { \overline { { \mathcal { X } } } } } \left[ A ( x | \bar { x } ) A ( x ^ { \prime } | \bar { x } ) \right]
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
Therefore, the weights sum to 1 because the total probability mass is 1: $\begin{array} { r } { \sum _ { x , x ^ { \prime } \in \mathcal { X } } w _ { x x ^ { \prime } } = 1 } \end{array}$ The relative magnitude intuitively captures the closeness between $x$ and $x ^ { \prime }$ with respect to the augmentation transformation. For most of the unrelated $x$ and $x ^ { \prime }$ , the value $w _ { x x ^ { \prime } }$ will be significantly smaller than the average value. For example, when $x$ and $x ^ { \prime }$ are random croppings of a cat and a dog respectively, $w _ { x x ^ { \prime } }$ will be essentially zero because no natural data can be augmented into both $x$ and $x ^ { \prime }$ . On the other hand, when $x$ and $x ^ { \prime }$ are very close in $\ell _ { 2 }$ -distance or very close in $\ell _ { 2 }$ -distance up to color distortion, $w _ { x x ^ { \prime } }$ is nonzero because they may be augmentations of the same image with Gaussian blur and color distortion. We say that $x$ and $x ^ { \prime }$ are connected with an edge if $w _ { x x ^ { \prime } } > 0$ . See Figure 1 (left) for more illustrations.
|
| 83 |
+
|
| 84 |
+
Given the structure of the population augmentation graph, we apply spectral decomposition to the population graph to construct principled embeddings. The eigenvalue problems are closely related to graph partitioning as shown in spectral graph theory $\mathbb { \ m }$ for both worst-case graphs [11, 25, 29, 33] and random graphs $\textcircled { 1 1 } , \textcircled { 3 0 } , \textcircled { 3 4 } \textcircled { 3 0 }$ . In machine learning, spectral clustering $\pm \pm \pm \pm$ is a classical algorithm that learns embeddings by eigendecomposition on an empirical distance graph and invoking $k$ -means on the embeddings.
|
| 85 |
+
|
| 86 |
+
We will apply eigendecomposition to the population augmentation graph (and then later use linear probe for classification). Let $\begin{array} { r } { w _ { x } = \sum _ { x ^ { \prime } \in \mathcal { X } } \bar { w } _ { x x ^ { \prime } } } \end{array}$ be the total weights associated to $x$ , which is often viewed as an analog of the degree of $x$ in weighted graph. A central object in spectral graph theory is the so-called normalized adjacency matrix:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\overline { { A } } : = D ^ { - 1 / 2 } A D ^ { - 1 / 2 }
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $A \in \mathbb { R } ^ { N \times N }$ is adjacency matrix with entires $A _ { x x ^ { \prime } } = w _ { x x ^ { \prime } }$ and $D \in \mathbb { R } ^ { N \times N }$ is a diagonal matrix with $D _ { x x } = w _ { x }$ . 2
|
| 93 |
+
|
| 94 |
+
Standard spectral graph theory approaches produce vertex embeddings as follows. Let $\gamma _ { 1 } , \gamma _ { 2 } , \cdots , \gamma _ { k }$ be the $k$ largest eigenvalues of $\overline { { A } }$ , and $v _ { 1 } , v _ { 2 } , \cdots , v _ { k }$ be the corresponding unit-norm eigenvectors. Let $F ^ { \star } = [ \breve { v } _ { 1 } , v _ { 2 } , \cdots , v _ { k } ] \in \mathbb { R } ^ { N \times k }$ be the matrix that collects these eigenvectors in columns, and we refer to it as the eigenvector matrix. Let $u _ { x } ^ { \ast } \in \mathbb { R } ^ { k }$ be the $x$ -th row of the matrix $F ^ { \star }$ . It turns out that $u _ { x } ^ { * }$ ’s can serve as desirable embeddings of $x$ ’s because they exhibit clustering structure in Euclidean space that resembles the clustering structure of the graph $G ( \mathcal { X } , w )$ .
|
| 95 |
+
|
| 96 |
+
# 3.2 From spectral decomposition to spectral contrastive learning
|
| 97 |
+
|
| 98 |
+
The embeddings $u _ { x } ^ { * }$ obtained by eigendecomposition are nonparametric—a $k$ -dimensional parameter is needed for every $x$ —and therefore cannot be learned with a realistic amount of data. The embedding matrix $F ^ { \star }$ cannot be even stored efficiently. Therefore, we will instead parameterize the rows of the eigenvector matrix $F ^ { \star }$ as a neural net function, and assume embeddings $u _ { x } ^ { * }$ can be represented by $f ( x )$ for some $f \in { \mathcal { F } }$ , where $\mathcal { F }$ is the hypothesis class containing neural networks. As we’ll show in Section $\textcircled { 4 }$ this allows us to leverage the extrapolation power of neural networks and learn the representation on a finite dataset.
|
| 99 |
+
|
| 100 |
+
Next, we design a proper loss function for the feature extractor $f$ , such that minimizing this loss could recover $F ^ { \star }$ up to some linear transformation. As we will show in Section $\mathbb { H } ,$ the resulting population loss function on $f$ also admits an unbiased estimator with finite training samples. Let $F$ be an embedding matrix with $u _ { x }$ on the $x$ -th row, we will first design a loss function of $F$ that can be decomposed into parts about individual rows of $F$ .
|
| 101 |
+
|
| 102 |
+
We employ the following matrix factorization based formulation for eigenvectors. Consider the objective
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\operatorname* { m i n } _ { \boldsymbol { F } \in \mathbb { R } ^ { N \times k } } \mathcal { L } _ { \operatorname* { m f } } ( \boldsymbol { F } ) : = \big \| \overline { { \boldsymbol { A } } } - \boldsymbol { F } \boldsymbol { F } ^ { \top } \big \| _ { F } ^ { 2 } .
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
By the classical theory on low-rank approximation (Eckart–Young–Mirsky theorem $\mathbb { I m }$ ), any minimizer $\widehat F$ of ${ \mathcal { L } } _ { \mathrm { m f } } ( F )$ contains scaling of the largest eigenvectors of $\overline { { A } }$ up to a right transformation— for some orthonormal matrix $R \in \mathbb { R } ^ { k \times k }$ , we have $\widehat { F } = F ^ { \star } \cdot \mathrm { d i a g } ( [ \sqrt { \gamma _ { 1 } } , \dots , \sqrt { \gamma _ { k } } ] ) Q$ . Fortunately, multiplying the embedding matrix by any matrix on the right and any diagonal matrix on the left does not change its linear probe performance, which is formalized by the following lemma.
|
| 109 |
+
|
| 110 |
+
Lemma 3.1. Consider an embedding matrix $\boldsymbol { F } \in \mathbb { R } ^ { N \times k }$ and a linear classifier $\boldsymbol { B } \in \mathbb { R } ^ { k \times r }$ . Let $D \in \mathbb { R } ^ { N \times N }$ be a diagonal matrix with positive diagonal entries and $Q \in \mathbb { R } ^ { \tilde { k } \times k }$ be an invertible matrix. Then, for any embedding matrix $\widetilde { F } = D \cdot F \cdot Q$ , the linear classifier ${ \tilde { B } } = Q ^ { - 1 } B$ on $\widetilde { F }$ has the same prediction as $B$ on $F$ . As a consequence, we have
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\mathcal { E } ( F ) = \mathcal { E } ( \widetilde F ) .
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
where $\mathcal { E } ( F )$ denotes the linear probe performance when the rows of $F$ are used as embeddings.
|
| 117 |
+
|
| 118 |
+
The proof can be found in Section C.1.
|
| 119 |
+
|
| 120 |
+
The main benefit of objective ${ \mathcal { L } } _ { \mathrm { m f } } ( F )$ is that it’s based on the rows of $F$ . Recall that vectors $u _ { x }$ are the rows of $F$ . Each entry of $F F ^ { \top }$ is of the form $u _ { x } ^ { \top } x _ { x ^ { \prime } }$ , and thus ${ \mathcal { L } } _ { \mathrm { m f } } ( F )$ can be decomposed into a sum of $N ^ { 2 }$ terms involving terms $u _ { x } ^ { \top } u _ { x ^ { \prime } }$ . Interestingly, if we reparameterize each row $u _ { x }$ by $w _ { x } ^ { 1 / 2 } f ( x )$ , we obtain a very similar loss function for $f$ that resembles the contrastive learning loss used in practice $\mathbb { \lVert \rVert }$ as shown below in Lemma $\boxed { 3 . 2 }$ See Figure $\perp$ (right) for an illustration of the relationship between the eigenvector matrix and the representations learned by minimizing this loss.
|
| 121 |
+
|
| 122 |
+
We formally define the positive and negative pairs to introduce the loss. Let $\hat { x } \sim \mathcal { P } _ { \overline { { x } } }$ be a random natural data and draw $x \sim \mathcal { A } ( \cdot | \bar { x } )$ and $x ^ { + } \sim \mathcal { A } ( \cdot | \bar { x } )$ independently to form a positive pair $( x , x ^ { + } )$ . Draw $\hat { x } ^ { \prime } \sim \mathcal { P } _ { \overline { { x } } }$ and $x ^ { \prime } \sim \mathcal { A } ( \cdot | \bar { x } ^ { \prime } )$ independently with ${ \bar { x } } , x , x ^ { + }$ . We call $( x , x ^ { \prime } )$ a negative pair.3
|
| 123 |
+
|
| 124 |
+
Lemma 3.2 (Spectral contrastive loss). Recall that $u _ { x }$ is the $x$ -th row of $F$ . Let $u _ { x } = w _ { x } ^ { 1 / 2 } f ( x ) j$ w1/2 x f (x) for some function $f$ . Then, the loss function ${ \mathcal { L } } _ { \mathrm { m f } } ( F )$ is equivalent to the following loss function for $f$ , called spectral contrastive loss, up to a additive constant:
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\begin{array} { r l } & { \mathcal { L } _ { \operatorname { m f } } ( F ) = \mathcal { L } ( f ) + \mathrm { c o n s t } } \\ & { \mathrm { w h e r e } \mathcal { L } ( f ) \triangleq - 2 \cdot \mathbb { E } _ { x , x ^ { + } } \big [ f ( x ) ^ { \top } f ( x ^ { + } ) \big ] + \mathbb { E } _ { x , x ^ { \prime } } \left[ \big ( f ( x ) ^ { \top } f ( x ^ { \prime } ) \big ) ^ { 2 } \right] } \end{array}
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
The proof can be found in Section C.1.
|
| 131 |
+
|
| 132 |
+
We note that spectral contrastive loss is similar to many popular contrastive losses [12, 38, 40, 50]. For instance, the contrastive loss in SimCLR $\mathbb { \lVert 1 2 \rVert }$ can be rewritten as (with simple algebraic manipulation)
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
- f ( x ) ^ { \top } f ( x ^ { + } ) + \log \left( \exp \left( f ( x ) ^ { \top } f ( x ^ { + } ) \right) + \sum _ { i = 1 } ^ { n } \exp \left( f ( x ) ^ { \top } f ( x _ { i } ) \right) \right) .
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
Here $x$ and $x ^ { + }$ are a positive pair and $x _ { 1 } , \cdots , x _ { n }$ are augmentations of other data. Spectral contrastive loss can be seen as removing $f ( x ) ^ { \top } f ( x ^ { + } )$ from the second term, and replacing the log sum of exponential terms with the average of the squares of $f ( x ) ^ { \top } f ( x _ { i } )$ . We will show in Section $\overline { { 6 } }$ that our loss has a similar empirical performance as SimCLR without requiring a large batch size.
|
| 139 |
+
|
| 140 |
+
# 3.3 Theoretical guarantees for spectral contrastive loss on population data
|
| 141 |
+
|
| 142 |
+
In this section, we introduce the main assumptions on the data and state our main theoretical guarantee for spectral contrastive learning on population data.
|
| 143 |
+
|
| 144 |
+
To formalize the idea that $G$ cannot be partitioned into too many disconnected sub-graphs, we introduce the notions of Dirichlet conductance and sparsest $m$ -partition, which are standard in spectral graph theory. Dirichlet conductance represents the fraction of edges from $S$ to its complement:
|
| 145 |
+
|
| 146 |
+
Definition 3.3 (Dirichlet conductance). For a graph $G = ( \mathcal { X } , w )$ and a subset $S \subseteq { \mathcal { X } }$ , we define the Dirichlet conductance of $S$ as
|
| 147 |
+
|
| 148 |
+
$$
|
| 149 |
+
\phi _ { G } ( S ) : = \frac { \sum _ { x \in S , x ^ { \prime } \notin S } w _ { x x ^ { \prime } } } { \sum _ { x \in S } w _ { x } } .
|
| 150 |
+
$$
|
| 151 |
+
|
| 152 |
+
We note that when $S$ is a singleton, there is $\phi _ { G } ( S ) = 1$ due to the definition of $w _ { x }$ . We introduce the sparsest $m$ -partition to represent the number of edges between $m$ disjoint subsets.
|
| 153 |
+
|
| 154 |
+
Definition 3.4 (Sparsest $m$ -partition). Let $G = ( \mathcal { X } , w )$ be the augmentation graph. For an integer $m \in [ 2 , | \mathcal { X } | ]$ , we define the sparsest $m$ -partition as
|
| 155 |
+
|
| 156 |
+
$$
|
| 157 |
+
\rho _ { m } : = \operatorname* { m i n } _ { S _ { 1 } , \cdots , S _ { m } } \operatorname* { m a x } \{ \phi _ { G } ( S _ { 1 } ) , \ldots , \phi _ { G } ( S _ { m } ) \}
|
| 158 |
+
$$
|
| 159 |
+
|
| 160 |
+
where $S _ { 1 } , \cdots , S _ { m }$ are non-empty sets that form a partition of $\mathcal { X }$
|
| 161 |
+
|
| 162 |
+
When $r$ is the number of underlying classes, we might expect $\rho _ { r } \approx 0$ since the augmentations from different classes almost compose a disjoint $r$ -way partition of $\mathcal { X }$ . However, for $m > r$ , we can expect $\rho _ { m }$ to be much larger. For instance, in the extreme case when $m = | { \mathcal { X } } | = N$ , every set $S _ { i }$ is a singleton, which implies that $\rho _ { N } = 1$ .
|
| 163 |
+
|
| 164 |
+
Next, we formalize the assumption that very few edges cross different ground-truth classes. It turns out that it suffices to assume that the labels are recoverable from the augmentations (which is also equivalent to that two examples in different classes can rarely be augmented into the same point).
|
| 165 |
+
|
| 166 |
+
Assumption 3.5 (Labels are recoverable from augmentations). Let $\hat { x } \sim \mathcal { P } _ { \overline { { x } } }$ and $y ( \bar { x } )$ be its label. Let the augmentation $x \sim \mathcal { A } ( \cdot | \bar { x } )$ . We assume that there exists a classifier $g$ that can predict $y ( \bar { x } )$ given x with error at most $\alpha$ . That is, $g ( x ) = y ( \bar { x } )$ with probability at least $1 - \alpha$ .
|
| 167 |
+
|
| 168 |
+
We also introduce the following assumption which states that some universal minimizer of the population spectral contrastive loss can be realized by the hypothesis class.
|
| 169 |
+
|
| 170 |
+
Assumption 3.6 (Realizability). Let $\mathcal { F }$ be a hypothesis class containing functions from $\mathcal { X }$ to $\mathbb { R } ^ { k }$ . We assume that at least one of the global minima of $\mathcal { L } ( f )$ belongs to $\mathcal { F }$ .
|
| 171 |
+
|
| 172 |
+
Our main theorem bound from above the linear probe error of the features learned by minimizing the population spectral contrastive loss.
|
| 173 |
+
|
| 174 |
+
Theorem 3.7. Assume the representation dimension $k \geq 2 r$ and Assumption $\boxed { 3 . 5 }$ holds for $\alpha > 0$ . Let $\mathcal { F }$ be a hypothesis class that satisfies Assumption $\boxed { 3 . 6 }$ and let $f _ { \mathrm { p o p } } ^ { * } \in \mathcal { F }$ be a minimizer of $\mathcal { L } ( f )$ . Then, we have
|
| 175 |
+
|
| 176 |
+
$$
|
| 177 |
+
\begin{array} { r } { \mathcal { E } ( f _ { \mathrm { p o p } } ^ { * } ) \leq \widetilde { O } \left( \alpha / \rho _ { \lfloor k / 2 \rfloor } ^ { 2 } \right) . } \end{array}
|
| 178 |
+
$$
|
| 179 |
+
|
| 180 |
+
Here we use ${ \widetilde { O } } ( \cdot )$ to hide universal constant factors and logarithmic factor in $k$ . We note that $\alpha = 0$ when augmentations from different classes are perfectly disconnected in the augmentation graph, in which case the above theorem guarantees the exact recovery of the ground truth. Generally, we expect $\alpha$ to be an extremely small constant independent of $k$ , whereas $\rho _ { \lfloor k / 2 \rfloor }$ increases with $k$ and can be much larger than $\alpha$ when $k$ is reasonably large. For instance, when there are $t$ sub-graphs that have sufficient inner connections, we expect $\rho _ { t + 1 }$ to be on the order of a constant because any $t + 1$ partition needs to break one sub-graph into two pieces and incur a large conductance. We characterize the $\rho _ { k }$ ’s growth on more concrete distributions in the next subsection.
|
| 181 |
+
|
| 182 |
+
Previous works on graph partitioning [2, 29, 31] often analyze the so-called rounding algorithms that conduct clustering based on the representations of unlabeled data and do not analyze the performance of linear probe (which has access to labeled data). These results provide guarantees on the approximation ratio—the ratio between the conductance of the obtained partition to the best partition—which may depend on graph size $\left[ \left[ 2 \right] \right]$ that can be exponentially large in our setting. The approximation ratio guarantee does not lead to a guarantee on the representations’ performance on downstream tasks. Our guarantees are on the linear probe accuracy on the downstream tasks and independent of the graph size. We rely on the formulation of the downstream task’s labeling function (Assumption $3 . 5 )$ as well as a novel analysis technique that characterizes the linear structure of the representations. In Section $\mathbf { C } ,$ we provide the proof of Theorem $\boxed { 3 . 7 }$ as well as its more generalized version where $k / 2$ is relaxed to be any constant fraction of $k$ .
|
| 183 |
+
|
| 184 |
+
# 3.4 Provable instantiation of Theorem $\pmb { \bigtriangledown } . \pmb { \bigtriangledown } .$ to mixture of manifold data
|
| 185 |
+
|
| 186 |
+
In this section, we exemplify Theorem $3 . 7$ on an example where the natural data distribution is a mixture of manifolds, and the augmentation transformation is adding Gaussian noise.
|
| 187 |
+
|
| 188 |
+
Example 3.8 (Mixture of manifolds). Suppose $\mathcal { P } _ { \overline { { \mathcal { X } } } }$ is mixture of $r \leq d$ distributions $P _ { 1 } , \cdots , P _ { r }$ , where each $P _ { i }$ is generated by some $\kappa$ X -bi-Lipschitz4 generator $Q : \mathbb { R } ^ { d ^ { \prime } } \mathbb { R } ^ { d }$ on some latent variable $z \in \mathbb { R } ^ { d ^ { \prime } }$ with $d ^ { \prime } \leq d$ which as a mixture of Gaussian distribution:
|
| 189 |
+
|
| 190 |
+
$$
|
| 191 |
+
x \sim P _ { i } \Longleftrightarrow x = Q ( z ) , z \sim { \mathcal N } ( \mu _ { i } , \frac { 1 } { d ^ { \prime } } \cdot I _ { d ^ { \prime } \times d ^ { \prime } } ) .
|
| 192 |
+
$$
|
| 193 |
+
|
| 194 |
+
Let the data augmentation of a natural data sample $\bar { x }$ is $\bar { x } + \xi$ where $\begin{array} { r } { \xi \sim \mathcal { N } ( 0 , \frac { \sigma ^ { 2 } } { d } \cdot I _ { d \times d } ) } \end{array}$ is isotropic Gaussian noise with $\begin{array} { r } { 0 < \sigma \lesssim \frac { 1 } { \sqrt { d } } } \end{array}$ . We also assume $\begin{array} { r } { \operatorname* { m i n } _ { i \neq j } \| \mu _ { i } - \mu _ { j } \| _ { 2 } \gtrsim \frac { \kappa \cdot \sqrt { \log d } } { \sqrt { d ^ { \prime } } } } \end{array}$ .
|
| 195 |
+
|
| 196 |
+
Let the ground-truth label be the most likely mixture index $i$ that generates $x$ : $y ( x ) : = \arg \operatorname* { m a x } _ { i } P _ { i } ( x )$ . We note that the intra-class distance in the latent space is on the scale of $\Omega ( 1 )$ , which can be much larger than the distance between class means which is assumed to be $\gtrsim \frac { \kappa \cdot \sqrt { \log d } } { \sqrt { d ^ { \prime } } }$ . Therefore, distancebased clustering algorithms do not apply. We apply Theorem $3 . 7$ and get the following theorem:
|
| 197 |
+
|
| 198 |
+
Theorem 3.9. When $\rho _ { \lfloor k / 2 \rfloor } \gtrsim \frac { \sigma } { \kappa \sqrt { d } }$ . As a consequence, the error bound is $k \geq 2 r + 2$ , Example 3.8 satisfies Assumption 3.5 with $\begin{array} { r } { { \mathcal { E } } ( f _ { \mathrm { p o p } } ^ { * } ) \leq { \tilde { O } } \left( \frac { \kappa ^ { 2 } } { \sigma ^ { 2 } \cdot \mathrm { p o l y } \left( d \right) } \right) } \end{array}$ $\alpha \leq { \frac { 1 } { \mathrm { p o l y } ( d ) } }$ . , and has
|
| 199 |
+
|
| 200 |
+
The theorem above guarantees small error even when $\sigma$ is polynomially small. In this case, the augmentation noise has a much smaller scale than the data (which is at least on the order of $1 / \kappa \mathrm { \lrcorner }$ ). This suggests that contrastive learning can non-trivially leverage the structure of the underlying data and learn good representations with relatively weak augmentation. The proof can be found in Section D.
|
| 201 |
+
|
| 202 |
+
# 4 Finite-sample generalization bounds
|
| 203 |
+
|
| 204 |
+
In Section $\textcircled { 3 } ,$ we provide guarantees for spectral contrastive learning on population data. In this section, we show that these guarantees can be naturally extended to the finite-sample regime with standard concentration bounds. In particular, given a training dataset $\{ \bar { x } _ { 1 } , \bar { x } _ { 2 } , \cdot \cdot \cdot , \bar { x } _ { n } \}$ with $\bar { x } _ { i } \sim \mathcal { P } _ { \overline { { x } } }$ , we learn a feature extractor by minimizing the following empirical spectral contrastive loss:
|
| 205 |
+
|
| 206 |
+
$$
|
| 207 |
+
\widehat { \mathcal { L } } _ { n } ( f ) : = - \frac { 2 } { n } \sum _ { i = 1 } ^ { n } \mathbb { E } _ { \underset { x ^ { + } \sim A ( x ^ { + } \mid \bar { x } _ { i } ) } { x ^ { \sim A ( \cdot \mid \bar { x } _ { i } ) } } } \left[ f ( x ) ^ { \top } f ( x ^ { + } ) \right] + \frac { 1 } { n ( n - 1 ) } \sum _ { i \neq j } \mathbb { E } _ { \underset { x ^ { \prime } \sim A ( \cdot \mid \bar { x } _ { j } ) } { x ^ { \sim A ( \cdot \mid \bar { x } _ { i } ) } } } \left[ \left( f ( x ) ^ { \top } f ( x ^ { \prime } ) \right) ^ { 2 } \right] .
|
| 208 |
+
$$
|
| 209 |
+
|
| 210 |
+
It is worth noting that ${ \widehat { \mathcal { L } } } _ { n } ( f )$ is an unbiased estimator of the population spectral contrastive loss $\mathcal { L } ( f )$ . (See Claim $\mathbf { E . } 2$ for a proof.) Therefore, we can derive generalization bounds via off-the-shelf concentration inequalities. Let $\mathcal { F }$ be a hypothesis class containing feature extractors from $\mathcal { X }$ to $\mathbb { R } ^ { k }$ . We extend Rademacher complexity to function classes with highdimensional outputs and define the Rademacher complexity of $\mathcal { F }$ on $n$ data as $\widehat { \mathcal { R } } _ { n } ( \mathcal { F } ) \overset { \cdot } { : = }$ $\begin{array} { r } { \operatorname* { m a x } _ { x _ { 1 } , \cdots , x _ { n } \in \mathcal { X } } \bar { \mathbb { E } } _ { \sigma } \left[ \operatorname* { s u p } _ { f \in \mathcal { F } , i \in [ k ] } \frac { 1 } { n } \left( \sum _ { j = 1 } ^ { n } \sigma _ { j } f _ { i } ( x _ { j } ) \right) \right] , } \end{array}$ ,
|
| 211 |
+
|
| 212 |
+
where $\sigma$ is a uniform random vector in $\{ - 1 , 1 \} ^ { n }$ and $f _ { i } ( z )$ is the $i$ -th dimension of $f ( z )$ .
|
| 213 |
+
|
| 214 |
+
Recall that $f _ { \mathrm { p o p } } ^ { * } \in \mathcal { F }$ is a minimizer of $\mathcal { L } ( f )$ . The following theorem with proofs in Section bounds the population loss of a feature extractor trained with finite data:
|
| 215 |
+
|
| 216 |
+
Theorem 4.1. For some $\kappa > 0$ , assume $\| f ( x ) \| _ { \infty } \leq \kappa$ for all $f \in { \mathcal { F } }$ and $x \in \mathcal { X }$ . Let $f _ { \mathrm { p o p } } ^ { * } \in \mathcal { F }$ be $a$ minimizer of the population loss $\mathcal { L } ( f )$ . Given a random dataset of size $n$ , let $\hat { f } _ { \mathrm { e m p } } \in \mathcal { F }$ be a minimizer of empirical loss ${ \widehat { \mathcal { L } } } _ { n } ( f )$ . Then, with probability at least $1 - \delta$ over the randomness of data, we have
|
| 217 |
+
|
| 218 |
+
$$
|
| 219 |
+
\mathcal { L } ( \hat { f } _ { \mathrm { e m p } } ) \leq \mathcal { L } ( f _ { \mathrm { p o p } } ^ { * } ) + c _ { 1 } \cdot \widehat { \mathcal { R } } _ { n / 2 } ( \mathcal { F } ) + c _ { 2 } \cdot \left( \sqrt { \frac { \log 2 / \delta } { n } } + \delta \right) ,
|
| 220 |
+
$$
|
| 221 |
+
|
| 222 |
+
where constants $c _ { 1 } \lesssim k ^ { 2 } \kappa ^ { 2 } + k \kappa$ and $c _ { 2 } \lesssim k \kappa ^ { 2 } + k ^ { 2 } \kappa ^ { 4 }$ .
|
| 223 |
+
|
| 224 |
+
We can apply Theorem $\boxed { 4 . 1 }$ to any hypothesis class $\mathcal { F }$ of interest (e.g., deep neural networks) and plug in off-the-shelf Rademacher complexity bounds. For instance, in Section $\boxed { \ E . 2 }$ we give a corollary of Theorem $\boxed { 4 . 1 }$ when $\mathcal { F }$ contains deep neural networks with ReLU activation.
|
| 225 |
+
|
| 226 |
+
The theorem above shows that we can achieve near-optimal population loss by minimizing empirical loss up to some small excess loss. The following theorem characterizes how the error propagates to the linear probe performance mildly under some spectral gap conditions.
|
| 227 |
+
|
| 228 |
+
Theorem 4.2. Assume representation dimension $k \geq 4 r + 2$ , Assumption $\boxed { 3 . 5 }$ holds for $\alpha > 0$ and Assumption $\boxed { 3 . 6 }$ holds. Recall $\gamma _ { i }$ be the $i$ -th largest eigenvalue of the normalized adjacency matrix. Then, for any $\epsilon < \gamma _ { k } ^ { 2 }$ and $\hat { f } _ { \mathrm { e m p } } \in \mathcal { F }$ such that $\mathcal { L } ( \hat { f } _ { \mathrm { e m p } } ) < \mathcal { L } ( f _ { \mathrm { p o p } } ^ { * } ) + \epsilon ,$ , we have:
|
| 229 |
+
|
| 230 |
+
$$
|
| 231 |
+
\mathcal { E } ( \hat { f } _ { \mathrm { e m p } } ) \lesssim \frac { \alpha } { \rho _ { \lfloor k / 2 \rfloor } ^ { 2 } } \cdot \log k + \frac { k \epsilon } { \Delta _ { \gamma } ^ { 2 } } ,
|
| 232 |
+
$$
|
| 233 |
+
|
| 234 |
+
where $\Delta _ { \gamma } : = \gamma _ { \left\lfloor 3 k / 4 \right\rfloor } - \gamma _ { k }$ is the eigenvalue gap between the $\lfloor 3 k / 4 \rfloor$ -th and the $k$ -th eigenvalue.
|
| 235 |
+
|
| 236 |
+
This theorem shows that the error on the downstream task only grows linearly with the error $\epsilon$ during pretraining. We can relax Assumption $\boxed { 3 . 6 }$ to approximate realizability in the sense that $\mathcal { F }$ contains some sub-optimal feature extractor under the population spectral loss and pay an additional error term in the linear probe error bound. The proof of Theorem $\mathsf { \bar { 4 } } . 2$ can be found in Section E.3.
|
| 237 |
+
|
| 238 |
+
# 5 Guarantee for learning linear probe with labeled data
|
| 239 |
+
|
| 240 |
+
In this section, we provide theoretical guarantees for learning a linear probe with labeled data. Theorem $3 . 7$ guarantees the existence of a linear probe that achieves a small downstream classification error. However, a priori it is unclear how large the margin of the linear classifier can be, so it is hard to apply margin theory to provide generalization bounds for 0-1 loss. We could in principle control the margin of the linear head, but using capped quadratic loss turns out to suffice and mathematically more convenient. We learn a linear head with the following capped quadratic loss: given a tuple $( z , y ( { \bar { x } } ) )$ where $z \in \mathbb { R } ^ { k }$ is a representation of augmented data $x \sim \mathcal { A } ( \cdot | \bar { x } )$ and $y ( \bar { x } ) \in [ r ]$ is the label of $\bar { x }$ , for a linear probe $B \in \mathbb { R } ^ { k \times r }$ we define loss $\begin{array} { r } { \ell ( ( z , y ( \bar { x } ) ) , B ) : = \sum _ { i = 1 } ^ { r } \operatorname* { m i n } \big \{ \left( B ^ { \top } z - \vec { y } ( \bar { x } ) \right) _ { i } ^ { 2 } , 1 \big \} } \end{array}$ , where $\vec { y } ( \bar { x } )$ is the one-hot embedding of $y ( \bar { x } )$ as a $r$ -dimensional vector (1 on the $y ( \bar { x } )$ -th dimension, 0 on other dimensions). This is a standard modification of quadratic loss in statistical learning theory that ensures the boundedness of the loss for the ease of analysis $\pmb { \mathbb { B } } 6 \|$ .
|
| 241 |
+
|
| 242 |
+
The following Theorem $5 . 1$ provides a generalization guarantee for the linear classifier that minimizes capped quadratic loss on a labeled dataset. The key challenge of the proof is showing the existence of a small-norm linear head $B$ that gives small population quadratic loss, which is not obvious from Theorem $3 . 7$ where only small 0-1 error is guaranteed. Recall $\gamma _ { i }$ is the $i$ -th largest eigenvalue of the the normalized adjacency matrix. Given a labeled dataset $\{ ( \bar { x } _ { i } , y ( \bar { x } _ { i } ) ) \} _ { i = 1 } ^ { n }$ where $\bar { x } _ { i } \sim \mathcal { P } _ { \overline { { X } } }$ and $y ( \bar { x } _ { i } )$ is its label, we sample $x _ { i } \sim \mathcal { A } ( \cdot | \bar { x } _ { i } )$ for $i \in [ n ]$ .
|
| 243 |
+
|
| 244 |
+
Theorem 5.1. In the setting of Theorem $\boxed { 3 . 7 }$ assume $\gamma _ { k } \geq C _ { \lambda }$ for some $C _ { \lambda } > 0$ . Learn a linear probe $\begin{array} { r } { \widehat { B } \in \arg \operatorname* { m i n } _ { \| B \| _ { F } \leq 1 / C _ { \lambda } } \sum _ { i = 1 } ^ { n } \ell ( ( f _ { \mathrm { p o p } } ^ { \ast } ( x _ { i } ) , y ( \bar { x } _ { i } ) ) , B ) } \end{array}$ by minimizing the capped quadratic loss subject to a norm constraint. Then, with probability at least $1 - \delta$ over random data, we have
|
| 245 |
+
|
| 246 |
+
$$
|
| 247 |
+
\operatorname* { P r } _ { \bar { x } \sim \mathcal { P } _ { \overline { { x } } } } \left( \bar { g } _ { f _ { \mathrm { p o p } } ^ { * } , \widehat { B } } ( \bar { x } ) \neq y ( \bar { x } ) \right) \lesssim \frac { \alpha } { \rho _ { \lfloor k / 2 \rfloor } ^ { 2 } } \cdot \log k + \frac { r } { C _ { \lambda } } \cdot \sqrt { \frac { k } { n } } + \sqrt { \frac { \log 1 / \delta } { n } } .
|
| 248 |
+
$$
|
| 249 |
+
|
| 250 |
+
Here the first term is the population error from Theorem $\underline { { \overline { { 3 . 7 } } } }$ The last two terms are the generalization gap from standard concentration inequalities for linear classification and are small when the number of labeled data $n$ is polynomial in the feature dimension $k$ . We note that this result reveals a tradeoff when choosing the feature dimension $k$ : when $n$ is fixed, a larger $k$ decreases the population contrastive loss while increases the generalization gap for downstream linear classification. The proof of Theorem 5.1 is in Section F.
|
| 251 |
+
|
| 252 |
+
# 6 Experiments
|
| 253 |
+
|
| 254 |
+
We test spectral contrastive learning on benchmark vision datasets. We minimize the empirical spectral contrastive loss with an encoder network $f$ and sample fresh augmentation in each iteration. The pseudo-code for the algorithm and more implementation details can be found in Section A.
|
| 255 |
+
|
| 256 |
+
Encoder / feature extractor. The encoder $f$ contains three components: a backbone network, a projection MLP and a projection function. The backbone network is a standard ResNet architecture. The projection MLP is a fully connected network with BN applied to each layer, and ReLU activation applied to each except for the last layer. The projection function takes a vector and projects it to a sphere ball with radius $\sqrt { \mu }$ , where $\mu > 0$ is a hyperparameter that we tune in experiments. We find that using a projection MLP and a projection function improves the performance.
|
| 257 |
+
|
| 258 |
+
Linear evaluation protocol. Given the pre-trained encoder network, we follow the standard linear evaluation protocol $\mathbf { \widehat { \mathbb { W } } }$ and train a supervised linear classifier on frozen representations, which are from the ResNet’s global average pooling layer.
|
| 259 |
+
|
| 260 |
+
Results. We report the accuracy on CIFAR-10/100 [26] and Tiny-ImageNet $\mathbb { \left| \overline { { 2 7 } } \right| }$ in Table 1. Our empirical results show that spectral contrastive learning achieves better performance than two popular baseline algorithms SimCLR $\pmb { \mathbb { L } 2 }$ and SimSiam $\textcircled { 1 4 } ]$ . In Table 2 we report results on ImageNet $\boxed { 1 8 }$ dataset, and show that our algorithm achieves similar performance as other state-of-the-art methods. We note that our algorithm is much more principled than previous methods and doesn’t rely on large batch sizes (SimCLR $\mathbb { I I Z }$ ), momentum encoders (BYOL [21] and MoCo $\pm \mathbb { Z } 2 \mathbb { I } .$ ) or additional tricks such as stop-gradient (SimSiam [14]).
|
| 261 |
+
|
| 262 |
+
# 7 Conclusion
|
| 263 |
+
|
| 264 |
+
In this paper, we present a novel theoretical framework of self-supervised learning and provide provable guarantees for the learned representations on downstream linear classification. We hope our study can facilitate future theoretical analyses of self-supervised learning and inspire new practical algorithms. For instance, one interesting future direction is to test the topology of the augmentation graph on empirical data distributions and design algorithms using tools from graph theory.
|
| 265 |
+
|
| 266 |
+
Table 1: Top-1 accuracy under linear evaluation protocal.
|
| 267 |
+
|
| 268 |
+
<table><tr><td>Datasets</td><td colspan="3">CIFAR-10</td><td colspan="3">CIFAR-100</td><td colspan="3">Tiny-ImageNet</td></tr><tr><td>Epochs</td><td>200</td><td>400</td><td>800</td><td>200</td><td>400</td><td>800</td><td>200</td><td>400</td><td>800</td></tr><tr><td>SimCLR (repro.)</td><td>83.73</td><td>87.72</td><td>90.60</td><td>54.74</td><td>61.05</td><td>63.88</td><td>43.30</td><td>46.46</td><td>48.12</td></tr><tr><td>SimSiam (repro.)</td><td>87.54</td><td>90.31</td><td>91.40</td><td>61.56</td><td>64.96</td><td>65.87</td><td>34.82</td><td>39.46</td><td>46.76</td></tr><tr><td>Ours</td><td>88.66</td><td>90.17</td><td>92.07</td><td>62.45</td><td>65.82</td><td>66.18</td><td>41.30</td><td>45.36</td><td>49.86</td></tr></table>
|
| 269 |
+
|
| 270 |
+
<table><tr><td></td><td>SimCLR</td><td>BYOL</td><td>MoCo v2</td><td>SimSiam</td><td>Ours</td></tr><tr><td>acc. (%)</td><td>66.5</td><td>66.5</td><td>67.4</td><td>68.1</td><td>66.97</td></tr></table>
|
| 271 |
+
|
| 272 |
+
Table 2: ImageNet linear evaluation accuracy with 100-epoch pre-training. All results but ours are reported from [14]. We use batch size 384 during pre-training.
|
| 273 |
+
|
| 274 |
+
# Acknowledgements
|
| 275 |
+
|
| 276 |
+
We thank Margalit Glasgow, Ananya Kumar, Jason D. Lee, Sang Michael Xie, and Guodong Zhang for helpful discussions. CW acknowledges support from an NSF Graduate Research Fellowship. TM acknowledges support of Google Faculty Award and NSF IIS 2045685. We also acknowledge the support of HAI and the Google Cloud. Toyota Research Institute ("TRI") provided funds to assist the authors with their research but this article solely reflects the opinions and conclusions of its authors and not TRI or any other Toyota entity.
|
| 277 |
+
|
| 278 |
+
# References
|
| 279 |
+
|
| 280 |
+
[1] E. Abbe. Community detection and stochastic block models: recent developments, 2017.
|
| 281 |
+
[2] S. Arora, S. Rao, and U. Vazirani. Expander flows, geometric embeddings and graph partitioning. Journal of the ACM (JACM), 56(2):1–37, 2009.
|
| 282 |
+
[3] S. Arora, H. Khandeparkar, M. Khodak, O. Plevrakis, and N. Saunshi. A theoretical analysis of contrastive unsupervised representation learning. arXiv preprint arXiv:1902.09229, 2019.
|
| 283 |
+
[4] P. Bachman, R. D. Hjelm, and W. Buchwalter. Learning representations by maximizing mutual information across views. arXiv preprint arXiv:1906.00910, 2019.
|
| 284 |
+
[5] Y. Bansal, G. Kaplun, and B. Barak. For self-supervised learning, rationality implies generalization, provably. arXiv preprint arXiv:2010.08508, 2020.
|
| 285 |
+
[6] A. Bardes, J. Ponce, and Y. LeCun. Vicreg: Variance-invariance-covariance regularization for self-supervised learning. arXiv preprint arXiv:2105.04906, 2021.
|
| 286 |
+
[7] S. G. Bobkov et al. An isoperimetric inequality on the discrete cube, and an elementary proof of the isoperimetric inequality in gauss space. The Annals of Probability, 25(1):206–214, 1997.
|
| 287 |
+
[8] J. Bromley, I. Guyon, Y. LeCun, E. Säckinger, and R. Shah. Signature verification using a" siamese" time delay neural network. Advances in neural information processing systems, 6: 737–744, 1993.
|
| 288 |
+
[9] T. Cai, R. Gao, J. D. Lee, and Q. Lei. A theory of label propagation for subpopulation shift. arXiv preprint arXiv:2102.11203, 2021.
|
| 289 |
+
[10] M. Caron, I. Misra, J. Mairal, P. Goyal, P. Bojanowski, and A. Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020.
|
| 290 |
+
[11] J. Cheeger. A lower bound for the smallest eigenvalue of the laplacian. In Proceedings of the Princeton conference in honor of Professor S. Bochner, pages 195–199, 1969.
|
| 291 |
+
[12] T. Chen, S. Kornblith, M. Norouzi, and G. Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020.
|
| 292 |
+
[13] T. Chen, S. Kornblith, K. Swersky, M. Norouzi, and G. Hinton. Big self-supervised models are strong semi-supervised learners. arXiv preprint arXiv:2006.10029, 2020.
|
| 293 |
+
[14] X. Chen and K. He. Exploring simple siamese representation learning. arXiv preprint arXiv:2011.10566, 2020.
|
| 294 |
+
[15] X. Chen, H. Fan, R. Girshick, and K. He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020.
|
| 295 |
+
[16] C.-Y. Chuang, J. Robinson, L. Yen-Chen, A. Torralba, and S. Jegelka. Debiased contrastive learning. arXiv preprint arXiv:2007.00224, 2020.
|
| 296 |
+
[17] F. R. Chung and F. C. Graham. Spectral graph theory. Number 92. American Mathematical Soc., 1997.
|
| 297 |
+
[18] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
|
| 298 |
+
[19] C. Eckart and G. Young. The approximation of one matrix by another of lower rank. Psychometrika, 1(3):211–218, 1936.
|
| 299 |
+
[20] N. Golowich, A. Rakhlin, and O. Shamir. Size-independent sample complexity of neural networks. In Conference On Learning Theory, pages 297–299. PMLR, 2018.
|
| 300 |
+
[21] J.-B. Grill, F. Strub, F. Altché, C. Tallec, P. H. Richemond, E. Buchatskaya, C. Doersch, B. A. Pires, Z. D. Guo, M. G. Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
|
| 301 |
+
[22] K. He, H. Fan, Y. Wu, S. Xie, and R. Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9729–9738, 2020.
|
| 302 |
+
[23] O. Henaff. Data-efficient image recognition with contrastive predictive coding. In International Conference on Machine Learning, pages 4182–4192. PMLR, 2020.
|
| 303 |
+
[24] R. D. Hjelm, A. Fedorov, S. Lavoie-Marchildon, K. Grewal, P. Bachman, A. Trischler, and Y. Bengio. Learning deep representations by mutual information estimation and maximization. In International Conference on Learning Representations, 2018.
|
| 304 |
+
[25] R. Kannan, S. Vempala, and A. Vetta. On clusterings: Good, bad and spectral. Journal of the ACM (JACM), 51(3):497–515, 2004.
|
| 305 |
+
[26] A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. 2009.
|
| 306 |
+
[27] Y. Le and X. Yang. Tiny imagenet visual recognition challenge. CS 231N, 7:7, 2015.
|
| 307 |
+
[28] J. D. Lee, Q. Lei, N. Saunshi, and J. Zhuo. Predicting what you already know helps: Provable self-supervised learning. arXiv preprint arXiv:2008.01064, 2020.
|
| 308 |
+
[29] J. R. Lee, S. O. Gharan, and L. Trevisan. Multiway spectral partitioning and higher-order cheeger inequalities. Journal of the ACM (JACM), 61(6):1–30, 2014.
|
| 309 |
+
[30] J. Lei, A. Rinaldo, et al. Consistency of spectral clustering in stochastic block models. Annals of Statistics, 43(1):215–237, 2015.
|
| 310 |
+
[31] T. Leighton and S. Rao. Multicommodity max-flow min-cut theorems and their use in designing approximation algorithms. Journal of the ACM (JACM), 46(6):787–832, 1999.
|
| 311 |
+
[32] A. Louis and K. Makarychev. Approximation algorithm for sparsest k-partitioning. In Proceedings of the twenty-fifth annual ACM-SIAM symposium on Discrete algorithms, pages 1244–1255. SIAM, 2014.
|
| 312 |
+
[33] A. Louis, P. Raghavendra, P. Tetali, and S. Vempala. Algorithmic extensions of cheeger’s inequality to higher eigenvalues and partitions. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, pages 315–326. Springer, 2011.
|
| 313 |
+
[34] F. McSherry. Spectral partitioning of random graphs. In Proceedings 42nd IEEE Symposium on Foundations of Computer Science, pages 529–537. IEEE, 2001.
|
| 314 |
+
[35] I. Misra and L. v. d. Maaten. Self-supervised learning of pretext-invariant representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6707–6717, 2020.
|
| 315 |
+
[36] M. Mohri, A. Rostamizadeh, and A. Talwalkar. Foundations of machine learning. MIT press, 2018.
|
| 316 |
+
[37] A. Ng, M. Jordan, and Y. Weiss. On spectral clustering: Analysis and an algorithm. Advances in neural information processing systems, 14:849–856, 2001.
|
| 317 |
+
[38] A. v. d. Oord, Y. Li, and O. Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 318 |
+
[39] J. Shi and J. Malik. Normalized cuts and image segmentation. IEEE Transactions on pattern analysis and machine intelligence, 22(8):888–905, 2000.
|
| 319 |
+
[40] K. Sohn. Improved deep metric learning with multi-class n-pair loss objective. In Proceedings of the 30th International Conference on Neural Information Processing Systems, pages 1857–1865, 2016.
|
| 320 |
+
[41] Y. Tian, D. Krishnan, and P. Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019.
|
| 321 |
+
[42] Y. Tian, C. Sun, B. Poole, D. Krishnan, C. Schmid, and P. Isola. What makes for good views for contrastive learning. arXiv preprint arXiv:2005.10243, 2020.
|
| 322 |
+
[43] Y. Tian, L. Yu, X. Chen, and S. Ganguli. Understanding self-supervised learning with dual deep networks. arXiv preprint arXiv:2010.00578, 2020.
|
| 323 |
+
[44] C. Tosh, A. Krishnamurthy, and D. Hsu. Contrastive estimation reveals topic posterior information to linear models. arXiv:2003.02234, 2020.
|
| 324 |
+
[45] C. Tosh, A. Krishnamurthy, and D. Hsu. Contrastive learning, multi-view redundancy, and linear models. In Algorithmic Learning Theory, pages 1179–1206. PMLR, 2021.
|
| 325 |
+
[46] T. W. Tsai, C. Li, and J. Zhu. Mice: Mixture of contrastive experts for unsupervised image clustering. arXiv preprint arXiv:2105.01899, 2021.
|
| 326 |
+
[47] Y.-H. H. Tsai, Y. Wu, R. Salakhutdinov, and L.-P. Morency. Self-supervised learning from a multi-view perspective. arXiv preprint arXiv:2006.05576, 2020.
|
| 327 |
+
[48] T. Wang and P. Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In International Conference on Machine Learning, pages 9929–9939. PMLR, 2020.
|
| 328 |
+
[49] C. Wei, K. Shen, Y. Chen, and T. Ma. Theoretical analysis of self-training with deep networks on unlabeled data. arXiv preprint arXiv:2010.03622, 2020.
|
| 329 |
+
[50] Z. Wu, Y. Xiong, S. X. Yu, and D. Lin. Unsupervised feature learning via non-parametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3733–3742, 2018.
|
| 330 |
+
[51] M. Ye, X. Zhang, P. C. Yuen, and S.-F. Chang. Unsupervised embedding learning via invariant and spreading instance feature. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6210–6219, 2019.
|
| 331 |
+
[52] J. Zbontar, L. Jing, I. Misra, Y. LeCun, and S. Deny. Barlow twins: Self-supervised learning via redundancy reduction. arXiv preprint arXiv:2103.03230, 2021.
|
md/train/nCY83KxoehA/nCY83KxoehA.md
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOMATED CONCATENATION OF EMBEDDINGS FOR STRUCTURED PREDICTION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Pretrained contextualized embeddings are powerful word representations for structured prediction tasks. Recent work found that better word representations can be obtained by concatenating different types of embeddings. However, the selection of embeddings to form the best concatenated representation usually varies depending on the task and the collection of candidate embeddings, and the everincreasing number of embedding types makes it a more difficult problem. In this paper, we propose Automated Concatenation of Embeddings (ACE) to automate the process of finding better concatenations of embeddings for structured prediction tasks, based on a formulation inspired by recent progress on neural architecture search. Specifically, a controller alternately samples a concatenation of embeddings, according to its current belief of the effectiveness of individual embedding types in consideration for a task, and updates the belief based on a reward. We follow strategies in reinforcement learning to optimize the parameters of the controller and compute the reward based on the accuracy of a task model, which is fed with the sampled concatenation as input and trained on a task dataset. Empirical results on 6 tasks and 21 datasets show that our approach outperforms strong baselines and achieves state-of-the-art performance with fine-tuned embeddings in the vast majority of evaluations.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Recent developments on pretrained contextualized embeddings have significantly improved the performance of structured prediction tasks in natural language processing. Approaches based on contextualized embeddings, such as ELMo (Peters et al., 2018), Flair (Akbik et al., 2018), BERT (Devlin et al., 2019), and XLM-R (Conneau et al., 2020), have been consistently raising the state-of-the-art for various structured prediction tasks. Concurrently, research has also showed that word representations based on the concatenation of multiple pretrained contextualized embeddings and traditional non-contextualized embeddings (such as word2vec (Mikolov et al., 2013) and character embeddings (Santos & Zadrozny, 2014)) can further improve performance (Peters et al., 2018; Akbik et al., 2018; Straková et al., 2019; He & Choi, 2020). Given the ever-increasing number of embedding learning methods that operate on different granularities (e.g., word, subword, or character level) and with different model architectures, choosing the best embeddings to concatenate for a specific task becomes non-trivial, and exploring all possible concatenations can be prohibitively demanding in computing resources.
|
| 12 |
+
|
| 13 |
+
Neural architecture search (NAS) is an active area of research in deep learning to automatically search for better model architectures, and has achieved state-of-the-art performance on various tasks in computer vision, such as image classification (Real et al., 2019), semantic segmentation (Liu et al., 2019a), and object detection (Ghiasi et al., 2019). In natural language processing, NAS has been successfully applied to find better RNN structures (Zoph & Le, 2017; Pham et al., 2018b) and recently better transformer structures (So et al., 2019; Zhu et al., 2020). In this paper, we propose the Automated Concatenation of Embeddings (ACE) approach to automate the process of finding better concatenations of embeddings for structured prediction tasks, formulated as an NAS problem. In this approach, an iterative search process is guided by a controller based on its belief that models the effectiveness of individual embedding candidates in consideration for a specific task. At each step, the controller samples a concatenation of embeddings according to the belief model and feeds the concatenated word representations as inputs to a task model, which in turn is trained on the task dataset and returns the model accuracy as a reward signal to update the belief model. We use the policy gradient algorithm (Williams, 1992) in reinforcement learning (Sutton & Barto, 1992) to solve the optimization problem. In order to improve the efficiency of the search process, we also design a special reward function by accumulating all the rewards based on the transformation between the current concatenation and all previously sampled concatenations.
|
| 14 |
+
|
| 15 |
+
Our approach is different from previous work on NAS in the following aspects:
|
| 16 |
+
|
| 17 |
+
1. Unlike most previous work, we focus on searching for better word representations rather than better model architectures.
|
| 18 |
+
2. We design a unique search space for the embedding concatenation search. Instead of using RNN as in previous work of Zoph & Le (2017), we design a more straightforward controller to generate the embedding concatenation. We design a novel reward function in the objective of optimization to better evaluate the effectiveness of each concatenated embeddings.
|
| 19 |
+
3. Our approach is efficient and practical. ACE can find a strong word representation on a single GPU with only a few GPU-hours for structured prediction tasks, while a lot of the NAS approaches require dozens of or even thousands of GPU-hours to search for good neural architecture.
|
| 20 |
+
4. The task model from ACE achieves high accuracy without the need for retraining, while in previous work of NAS the resulting neural network usually requires retraining from scratch.
|
| 21 |
+
|
| 22 |
+
Empirical results show that ACE outperforms strong baselines. Furthermore, we show that when ACE is applied to concatenate pretrained contextualized embeddings which are already fine-tuned on specific tasks, we can achieve state-of-the-art or competitive accuracy on 6 structured prediction tasks including Named Entity Recognition (Sundheim, 1995), Part-Of-Speech tagging (DeRose, 1988), chunking (Tjong Kim Sang & Buchholz, 2000), aspect extraction (Hu & Liu, 2004), syntactic dependency parsing (Tesnière, 1959) and semantic dependency parsing (Oepen et al., 2014) over 21 datasets. Besides, we also analyze the advantage of ACE and reward function design over the baselines and show the advantage of ACE over ensemble models.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
# 2.1 EMBEDDINGS
|
| 27 |
+
|
| 28 |
+
Non-contextualized embeddings, such as word2vec (Mikolov et al., 2013), GloVe (Pennington et al., 2014), and fastText (Bojanowski et al., 2017), help lots of NLP tasks. Character embeddings (Santos & Zadrozny, 2014) are trained together with the task and applied in many structured prediction tasks (Ma & Hovy, 2016; Lample et al., 2016; Dozat & Manning, 2018). For pretrained contextualized embeddings, ELMo (Peters et al., 2018), a pretrained contextualized word embedding generated with multiple Bidirectional LSTM layers, significantly outperforms previous state-of-the-art approaches on several NLP tasks. Following this idea, Akbik et al. (2018) proposed Flair embeddings, which is a kind of contextualized character embeddings and achieved strong performance in sequence labeling tasks. Recently, Devlin et al. (2019) proposed BERT, which encodes contextualized sub-word information by Transformers and significantly improves the performance on a lot of NLP tasks. Much research such as RoBERTa (Liu et al., 2019c) has focused on improving BERT model’s performance through stronger masking strategies. Moreover, multilingual contextualized embeddings become popular. Pires et al. (2019) and Wu & Dredze (2019) showed that Multilingual BERT (M-BERT) could learn a good multilingual representation effectively with strong crosslingual zero-shot transfer performance in various tasks. Conneau et al. (2020) proposed XLM-R, which is trained on a larger multilingual corpus and significantly outperforms M-BERT on various multilingual tasks.
|
| 29 |
+
|
| 30 |
+
# 2.2 NEURAL ARCHITECTURE SEARCH
|
| 31 |
+
|
| 32 |
+
Recent progress on deep learning has shown that network architecture design is crucial to the model performance. However, designing a strong neural architecture for each task requires enormous efforts, high level of knowledge, and experiences over the task domain. Therefore, automatic design of neural architecture is desired. A crucial part of NAS is search space design, which defines the discoverable NAS space. Previous work (Baker et al., 2017; Zoph & Le, 2017; Xie & Yuille, 2017) designs a global search space (Elsken et al., 2019) which incorporates structures from handcrafted architectures. For example, Zoph & Le (2017) designed a chained-structured search space with skip connections. The global search space usually has a considerable degree of freedom. As an example, the approach of Zoph & Le (2017) takes 22,400 GPU-hours to search on CIFAR-10 dataset. Based on the observation that existing hand-crafted architectures contain repeated structures (Szegedy et al., 2016; He et al., 2016; Huang et al., 2017), Zoph et al. (2018) explored cell-based search space which can reduce the search time to 2,000 GPU-hours.
|
| 33 |
+
|
| 34 |
+
In recent NAS research, reinforcement learning and evolutionary algorithms are the most usual approaches. In reinforcement learning, the agent’s actions are the generation of neural architectures and the action space is identical to the search space. Previous work usually applies an RNN layer (Zoph & Le, 2017; Zhong et al., 2018; Zoph et al., 2018) or use Markov Decision Process (Baker et al., 2017) to decide the hyper-parameter of each structure and decide the input order of each structure. Evolutionary algorithms have been applied to architecture search for many decades (Miller et al., 1989; Angeline et al., 1994; Stanley & Miikkulainen, 2002; Floreano et al., 2008; Jozefowicz et al., 2015). The algorithm repeatedly generates new populations through recombination and mutation operations and selects survivors through competing among the population. Recent work with evolutionary algorithms differ in the method on parent/survivor selection and population generation. For example, Real et al. (2017), Liu et al. (2018a), Wistuba (2018) and Real et al. (2019) applied tournament selection (Goldberg & Deb, 1991) for the parent selection while Xie & Yuille (2017) keeps all parents. Suganuma et al. (2017) and Elsken et al. (2018) chose the best model while Real et al. (2019) chose several latest models as survivors.
|
| 35 |
+
|
| 36 |
+
# 3 AUTOMATED CONCATENATION OF EMBEDDINGS
|
| 37 |
+
|
| 38 |
+
In ACE, a task model and a controller interact with each other repeatedly. The task model predicts the task output, while the controller searches for better embedding concatenation as the word representation for the task model to achieve higher accuracy. Given an embedding concatenation generated from the controller, the task model is trained over the task data and returns a reward to the controller. The controller receives the reward to update its parameter and samples a new embedding concatenation for the task model. Figure 1 shows the general architecture of our approach.
|
| 39 |
+
|
| 40 |
+
# 3.1 TASK MODEL
|
| 41 |
+
|
| 42 |
+
For the tasks model, we emphasis on sequence-structured and graph-structured outputs. Given a structured prediction task with input sentence $_ { \textbf { \em x } }$ and structured output $\textbf { { y } }$ , we can calculate the probability distribution $P ( \pmb { y } | \pmb { x } )$ by:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
P ( \pmb { y } | \pmb { x } ) = \frac { \exp \left( \mathrm { S c o r e } ( \pmb { x } , \pmb { y } ) \right) } { \sum _ { \pmb { y } ^ { \prime } \in \mathbb { Y } ( \pmb { x } ) } \exp \left( \mathrm { S c o r e } ( \pmb { x } , \pmb { y } ^ { \prime } ) \right) }
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where $\mathbb { Y } ( { \pmb x } )$ represents all possible output structures given the input sentence $_ { \textbf { \em x } }$ . Depending on different structured prediction tasks, the output structure $\textbf { { y } }$ can be label sequences, trees, graphs or other structures. In this paper, we use sequence-structured and graph-structured outputs as two exemplar structured prediction tasks. We use BiLSTM-CRF model (Ma & Hovy, 2016; Lample et al., 2016) for sequence-structured outputs and use BiLSTM-Biaffine model (Dozat & Manning, 2017) for graph-structured outputs:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
P ^ { \mathrm { s e q } } ( y | \boldsymbol { x } ) = \mathrm { B i L S T M - C R F } ( V , y ) ; P ^ { \mathrm { g r a p h } } ( y | \boldsymbol { x } ) = \mathrm { B i L S T M - B i a f f n e } ( V , y )
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $V = [ \pmb { v } _ { 1 } ; \cdots ; \pmb { v } _ { n } ]$ , $V \in \mathbb { R } ^ { d \times n }$ is a matrix of the word representations for the input sentence $_ { \textbf { \em x } }$ with $n$ words, $d$ is the hidden size of the concatenation of all embeddings. The word representation ${ \mathbf { } } v _ { i }$ of $i$ -th word is a concatenation of $L$ types of word embeddings:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\pmb { v } _ { i } ^ { l } = \mathrm { e m b e d } _ { i } ^ { l } ( \pmb { x } ) ; \pmb { v } _ { i } = [ \pmb { v } _ { i } ^ { 1 } ; \pmb { v } _ { i } ^ { 2 } ; \dots ; \pmb { v } _ { i } ^ { L } ]
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where embedl is the model of $l$ -th embeddings, $\pmb { v } _ { i } \in \mathbb { R } ^ { d }$ , $\boldsymbol { v } _ { i } ^ { l } \in \mathbb { R } ^ { d ^ { l } }$ . $d ^ { l }$ is the hidden size of embedl.
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 1: The main paradigm of our approach is shown in the middle, where an example of reward function is represented in the left and an example of a concatenation action is shown in the right.
|
| 64 |
+
|
| 65 |
+
# 3.2 SEARCH SPACE DESIGN
|
| 66 |
+
|
| 67 |
+
The neural architecture search space can be represented as a set of neural networks (Elsken et al., 2019). A neural network can be represented as a directed acyclic graph with a set of nodes and directed edges. Each node represents an operation, while each edge represents the inputs and outputs between these nodes. In ACE, we represent each embedding candidate as a node. The input to the nodes is the input sentence $_ { \textbf { \em x } }$ , and the outputs are the embeddings $v ^ { l }$ . Since we concatenate the embeddings as the word representation of the task model, there is no connection between nodes in our search space. Without considering the connections between nodes, the search space can be significantly reduced. For each node, there are a lot of options to extract word features. Taking BERT embeddings as an example, Devlin et al. (2019) concatenated the last four layers as word features while Kondratyuk & Straka (2019) applied a weighted sum of all twelve layers. However, the empirical results (Devlin et al., 2019) do not show a significant difference in accuracy. We follow the typical usage for each embedding to further reduce the search space. As a result, each embedding only has a fixed operation and the resulting search space contains $2 ^ { L } - 1$ possible combinations of nodes.
|
| 68 |
+
|
| 69 |
+
In NAS, weight sharing (Pham et al., 2018a) shares the weight of structures in training different neural architectures to reduce the training cost. In comparison, we fixed the weight of pretrained embedding candidates in ACE except for the character embeddings. Instead of sharing the parameters of the embeddings, we share the parameters of the task models at each step of search. However, the hidden size of word representation varies over the concatenations, making the weight sharing of structured prediction models difficult. Instead of deciding whether each node exists in the graph, we keep all nodes in the search space and add an additional operation for each node to indicate whether the embedding is masked out. To represent the selected concatenation, we use a binary vector $\pmb { a } = [ a _ { 1 } , \cdot \cdot \cdot , a _ { l } , \cdot \cdot \cdot , a _ { L } ]$ as an mask to mask out the embeddings which are not selected:
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
\pmb { v } _ { i } = [ \pmb { v } _ { i } ^ { 1 } a _ { 1 } ; \dots ; \pmb { v } _ { i } ^ { l } a _ { l } ; \dots ; \pmb { v } _ { i } ^ { L } a _ { L } ]
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
where $a _ { l }$ is a binary variable. Since the input $V$ is applied to a linear layer in the BiLSTM layer, multiplying the mask with the embeddings is equivalent to directly concatenating the selected embeddings:
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
W = [ W _ { 1 } ; W _ { 2 } ; . . . ; W _ { L } ] ; W ^ { \top } { \boldsymbol v } _ { i } = \sum _ { l = 1 } ^ { L } W _ { l } ^ { \top } { \boldsymbol v } _ { i } ^ { l } a _ { l } ; W \in \mathbb { R } ^ { d \times h } \mathrm { ~ a n d ~ } W _ { l } \in \mathbb { R } ^ { d } \times h
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
Therefore, the model weights can be shared after applying the embedding mask to all embedding candidates’ concatenation. Another benefit of our search space design is that we can remove the unused embedding candidates and the corresponding weights in $W$ for a lighter task model after the best concatenation is found by ACE.
|
| 82 |
+
|
| 83 |
+
# 3.3 SEARCHING IN THE SPACE
|
| 84 |
+
|
| 85 |
+
During search, the controller generates the embedding mask for the task model iteratively. We use parameters $\pmb { \theta } = [ \theta _ { 1 } ; \theta _ { 2 } ; . . . ; \theta _ { L } ]$ for the controller instead of the RNN structure applied in previous approaches (Zoph $\&$ Le, 2017; Zoph et al., 2018). The probability distribution of selecting an concatenation $^ { a }$ is $\begin{array} { r } { P ^ { \mathrm { c t r l } } ( \mathbf { a } ; \pmb { \theta } ) = \prod _ { l = 1 } ^ { \bar { L } } P _ { l } ^ { \mathrm { c t r l } } ( a _ { l } ; \theta _ { l } ) } \end{array}$ . Each element $a _ { l }$ of $\textbf { \em a }$ is sampled independently from a Bernoulli distribution, which is defined as:
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
P _ { l } ^ { \mathrm { c t r l } } ( a _ { l } = 1 ; \theta _ { l } ) = \sigma ( \theta _ { l } ) ; P _ { l } ^ { \mathrm { c t r l } } ( a _ { l } = 0 ; \theta _ { l } ) = 1 - P _ { l } ^ { \mathrm { c t r l } } ( a _ { l } = 1 ; \theta _ { l } )
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
where $\sigma$ is the sigmoid function. Given the mask, the task model is trained until convergence and returns an accuracy $R$ on the development set. As the accuracy cannot be back-propagated to the controller, we use the reinforcement algorithm for optimization. The accuracy $R$ is used as the reward signal to train the controller. The controller’s target is maximizing the expected reward $J ( \pmb \theta ) = \mathbb E _ { P ^ { \mathrm { c u r l } } ( \pmb a ; \pmb \theta ) } [ R ]$ through the policy gradient method (Williams, 1992). In our approach, since calculating the exact expectation is intractable, the gradient of $J ( \pmb \theta )$ is approximated by sampling only one selection following the distribution $P ^ { \mathrm { c t r l } } ( a ; \bar { \theta } )$ at each step for training efficiency:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\nabla _ { \pmb { \theta } } J ( \pmb { \theta } ) \approx \sum _ { l = 1 } ^ { L } \nabla _ { \pmb { \theta } } \log P _ { l } ^ { \mathrm { c t r l } } ( a _ { l } ; \theta _ { l } ) ( R - b )
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $b$ is the baseline function to reduce the high variance of the update function. The baseline usually can be the highest accuracy during the search process. Instead of merely using the highest accuracy of development set over the search process as the baseline, we design a reward function on how each embedding candidate contributes to accuracy change by utilizing all searched concatenations’ development scores. We use a binary vector $\lvert a ^ { t } - a ^ { i } \rvert$ to represent the change between current embedding concatenation $\mathbf { \Omega } _ \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { a } ^ { t } \mathbf { \Omega } \mathrm { \Omega }$ at current time step $t$ and $\mathbf { \Omega } _ { \mathbf { \Omega } _ { a _ { } } i }$ at previous time step $i$ . We then define the reward function as:
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
r ^ { t } = \sum _ { i = 1 } ^ { t - 1 } ( R _ { t } - R _ { i } ) | \pmb { a } ^ { t } - \pmb { a } ^ { i } |
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
where $r ^ { t }$ is a vector with length $L$ representing the reward of each embedding candidate. $R _ { t }$ and $R _ { i }$ are the reward at time step $t$ and $i$ . When the Hamming distance of two concatenations $H a m m ( { \pmb a } ^ { t } , { \pmb a } ^ { i } )$ gets larger, the changed candidates’ contribution to the accuracy becomes less noticeable. The controller may be misled to reward a candidate that is not very helpful. We apply a discount factor to reduce the reward for two concatenations with a large Hamming distance to alleviate this issue. Our final reward function is:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
r ^ { t } = \sum _ { i = 1 } ^ { t - 1 } ( R _ { t } - R _ { i } ) \gamma ^ { H a m m ( { \pmb a } ^ { t } , { \pmb a } ^ { i } ) - 1 } | { \pmb a } ^ { t } - { \pmb a } ^ { i } |
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
where $\gamma \in ( 0 , 1 )$ . Eq. 4 is then reformulated as:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\nabla _ { \pmb { \theta } } J _ { t } ( \pmb { \theta } ) \approx \sum _ { l = 1 } ^ { L } \nabla _ { \pmb { \theta } } \log P _ { l } ^ { \mathrm { c t r l } } ( a _ { l } ^ { t } ; \theta _ { l } ) r _ { l } ^ { t }
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
# 3.4 TRAINING
|
| 116 |
+
|
| 117 |
+
To train the controller, we use a dictionary $\mathbb { D }$ to store the concatenations and validation scores. At $t = 1$ , we train the task model with all embedding candidates concatenated. From $t = 2$ , we repeat the following steps until a maximum iteration $T$ :
|
| 118 |
+
|
| 119 |
+
• Sample a concatenation $\mathbf { \Omega } _ \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { a } ^ { t } \mathbf { \Omega } \mathrm { \Omega }$ based on the probability distribution in Eq. 3.
|
| 120 |
+
• Train the task model with $\mathbf { \Omega } _ \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { a } ^ { t }$ following Eq. 1 and evaluate the model on the development set to get the accuracy $R _ { t }$ . Given the concatenation $\mathbf { \Omega } _ { \mathbf { \Omega } _ { a } } \mathrm { { } } ^ { t }$ , accuracy $R _ { t }$ and $\mathbb { D }$ , compute the gradient of the controller following Eq. 7 and update the parameters of controller.
|
| 121 |
+
• Add $\mathbf { \Omega } _ \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { a } ^ { t } \mathbf { \Omega }$ and $R _ { t }$ into $\mathbb { D }$ , set $t = t + 1$ .
|
| 122 |
+
|
| 123 |
+
When sampling $\mathbf { \Omega } _ \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { a } ^ { t }$ , we avoid selecting the previous concatenation $\mathbf { \delta } _ { a ^ { t - 1 } }$ and the all-zero vector (i.e., selecting no embedding). If $\mathbf { \Omega } _ \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { \Omega } \mathbf { a } ^ { t }$ is in the dictionary $\mathbb { D }$ , we compare the $R _ { t }$ with the value in the dictionary and keep the highest one.
|
| 124 |
+
|
| 125 |
+
# 4 EXPERIMENTS
|
| 126 |
+
|
| 127 |
+
# 4.1 DATASETS AND CONFIGURATIONS
|
| 128 |
+
|
| 129 |
+
To show ACE’s effectiveness, we conduct extensive experiments on a variety of structured prediction tasks varying from syntactic tasks to semantic tasks.The tasks are named entity recognition (NER),
|
| 130 |
+
|
| 131 |
+
Part-Of-Speech (POS) tagging, Chunking, Aspect Extraction (AE), Syntactic Dependency Parsing (DP) and Semantic Dependency Parsing (SDP). The details of the tasks are in Appendix A.1.
|
| 132 |
+
|
| 133 |
+
We train the controller for 30 steps and save the task model with the highest accuracy on the development set as the final model for testing. For all experiments, we report the averaged accuracy of 3 runs. For other settings, please refer to Appendix A.3 for more details.
|
| 134 |
+
|
| 135 |
+
# 4.2 EMBEDDINGS
|
| 136 |
+
|
| 137 |
+
Basic Settings: For the candidates of embeddings on English datasets, we use the languagespecific model for ELMo, Flair, base BERT, GloVe word embeddings, fastText word embeddings, non-contextual character embeddings (Lample et al., 2016), multilingual Flair (M-Flair), M-BERT and XLM-R embeddings. The size of the search space in our experiments is $2 ^ { 1 1 } - 1 = 2 0 4 7 ^ { 1 }$ . For language-specific models of other languages, please refer to Section A.4 for more details. In AE, there is no available language-specific BERT, Flair and ELMo embeddings for Russian and there is no available language-specific Flair and ELMo embeddings for Turkish. We use the corresponding English embeddings instead so that the search spaces of these datasets are almost identical to those of the other datasets. All embeddings are fixed during training except that the character embeddings are trained over the task. The empirical results are reported in Section 4.3.1.
|
| 138 |
+
|
| 139 |
+
Embedding Fine-tuning: Fine-tuning transformer-based embeddings is a usual approach to get better accuracy. In sequence labeling, most of the work follows the fine-tuning pipeline of BERT that connects the BERT model with a linear layer for word-level classification. However, when multiple embeddings are concatenated, fine-tuning a specific group of embeddings becomes difficult. It is impractical to train multiple embeddings because of complicated hyper-parameter settings and massive GPU memory consumption. To alleviate this problem, we first fine-tune the transformer-based embeddings with the task and then concatenate these embeddings together with other embeddings in the basic setting to apply ACE. The empirical results are reported in Section 4.3.2.
|
| 140 |
+
|
| 141 |
+
Table 1: Comparison with concatenating all embeddings and random search baselines on 6 tasks.
|
| 142 |
+
|
| 143 |
+
<table><tr><td rowspan="2"></td><td colspan="3">NER</td><td colspan="3">POS</td><td colspan="7">AE</td></tr><tr><td>de en</td><td>es</td><td>nl</td><td>Ritter ARK</td><td>TB-v2</td><td>14Lap</td><td>14Res</td><td>15Res</td><td>16Res</td><td>es</td><td>ml</td><td>ru tr</td></tr><tr><td>ALL RANDOM</td><td colspan="2">83.1 92.4 88.9 84.0 92.6 88.8</td><td colspan="2">89.8 90.6 91.9 91.3</td><td>92.1 94.6 92.6</td><td>82.7 83.6</td><td>88.5</td><td>74.2 73.5</td><td>73.2 74.7</td><td>74.6 75.0 75.0</td><td>67.1</td><td>67.5 70.0</td></tr><tr><td>ACE</td><td colspan="2">84.2 93.0 88.9</td><td colspan="2">92.1 91.7</td><td>94.6 92.8 94.8</td><td>83.9</td><td>88.1 88.6</td><td>74.9</td><td>75.6</td><td>73.6 75.7 75.3 70.6</td><td>68.0</td><td>71.1</td></tr><tr><td rowspan="3"></td><td colspan="2">CHUNK</td><td colspan="2">DP</td><td colspan="7"></td><td rowspan="2"></td></tr><tr><td colspan="2">CoNLL 2000 UAS LAS</td><td colspan="2">DM-ID</td><td>DM-OOD PAS-ID</td><td>SDP</td><td>PAS-OOD1</td><td>PSD-ID PSD-0OD</td><td colspan="2"></td><td>AVG</td></tr><tr><td></td><td colspan="2">96.7</td><td colspan="7"></td><td>85.3</td></tr><tr><td>ALL RANDOM</td><td colspan="2">96.7 96.7</td><td colspan="2">95.1 94.3 94.4</td><td colspan="2">90.8 94.6 94.6</td><td colspan="2">92.9</td><td colspan="2">82.4 81.7 82.3</td><td colspan="2">81.8 85.7</td></tr><tr><td>ACE</td><td colspan="2">96.8 96.9</td><td colspan="2">96.8 95.2 95.3 94.5</td><td colspan="2">90.8 90.9 94.5</td><td colspan="2">93.0 93.1</td><td colspan="2">82.5 82.1</td><td colspan="2">86.2</td></tr></table>
|
| 144 |
+
|
| 145 |
+
# 4.3 RESULTS
|
| 146 |
+
|
| 147 |
+
We use the following abbreviations in our experiments: UAS: Unlabeled Attachment Score; LAS: Labeled Attachment Score; ID: In-domain test set; OOD: Out-of-domain test set; F & G (2019): Fernández-González & Gómez-Rodríguez (2019); F & G (2020): Fernández-González & GómezRodríguez (2020); D & M (2018): Dozat & Manning (2018). In all tables, we use ISO 639-1 language codes to represent each language.
|
| 148 |
+
|
| 149 |
+
# 4.3.1 COMPARISON WITH BASELINES
|
| 150 |
+
|
| 151 |
+
To show the effectiveness of our approach, we compare our approach with two strong baselines. For the first one, we let the task model learn by itself the contribution of each embedding candidate that is helpful to the task. We set $\textbf { \em a }$ to all-ones (i.e., the concatenation of all the embeddings) and train the task model (All). The linear layer weight $W$ in Eq. 2 reflects the contribution of each candidate. For the second one, we use the random search (Random), a strong baseline in NAS (Li &
|
| 152 |
+
|
| 153 |
+
Table 2: Comparison with state-of-the-art approaches in NER and POS tagging. †: Models are trained on both train and development set. ‡: Models are trained with document information. : Results are from Conneau et al. (2020).
|
| 154 |
+
|
| 155 |
+
<table><tr><td rowspan="2"></td><td colspan="5">NER</td><td rowspan="2"></td><td colspan="3">POS</td></tr><tr><td>de</td><td>de06</td><td>en</td><td>es</td><td>nl</td><td>Ritter</td><td>ARK</td><td>TB-v2</td></tr><tr><td>Akbik et al. (2018)†</td><td>1</td><td>88.3</td><td>93.1</td><td>-</td><td>-</td><td>Owoputi et al. (2013)</td><td>90.4</td><td>93.2</td><td>94.6</td></tr><tr><td>Baevski et al. (2019)</td><td>-</td><td>1</td><td>93.5</td><td>1</td><td>-</td><td>Gui et al. (2017)</td><td>90.9</td><td>1</td><td>92.8</td></tr><tr><td>Strakov et al. (2019)t</td><td>85.1</td><td>1</td><td>93.4</td><td>88.8</td><td>92.7</td><td>Gui et al. (2018)</td><td>91.2</td><td>92.4</td><td>=</td></tr><tr><td>Yu et al. (2020)†</td><td>86.4</td><td>90.3</td><td>93.5</td><td>90.3</td><td>93.7</td><td>Nguyen et al. (2020)</td><td>90.1</td><td>94.1</td><td>95.2</td></tr><tr><td>XLM-R+Fine-tune</td><td>85.8</td><td>1</td><td>92.9</td><td>89.7</td><td>92.5</td><td>XLM-R+Fine-tune</td><td>93.0</td><td>93.4</td><td>95.0</td></tr><tr><td>ACE+Fine-tune</td><td>87.0</td><td>90.5</td><td>93.5</td><td>91.7</td><td>94.6</td><td>ACE+Fine-tune</td><td>93.4</td><td>93.8</td><td>95.6</td></tr></table>
|
| 156 |
+
|
| 157 |
+
Table 3: Comparison with state-of-the-art approaches in chunking and aspect extraction. †: We report the results reproduced by Wei et al. (2020).
|
| 158 |
+
|
| 159 |
+
<table><tr><td rowspan="2"></td><td>CHUNK CoNLL2000</td><td rowspan="2"></td><td colspan="7">AE</td></tr><tr><td></td><td>14Lap 14Res</td><td>15Res</td><td>16Res</td><td></td><td>es</td><td>nl ru</td><td>tr</td></tr><tr><td>Akbik et al. (2018)</td><td>96.7</td><td>Xu et al. (2018)†</td><td>84.2</td><td>84.6</td><td>72.0 75.4</td><td>-</td><td>-</td><td>1</td><td>1</td></tr><tr><td>Clark et al. (2018)</td><td>97.0</td><td>Xu et al. (2019)</td><td>84.3</td><td>1</td><td>78.0</td><td>1</td><td>-</td><td>1</td><td>1</td></tr><tr><td>Liu et al. (2019b)</td><td>97.3</td><td>Wang et al. (2020a)</td><td>-</td><td>-</td><td>72.8</td><td></td><td></td><td></td><td>74.3 72.9 71.8 59.3</td></tr><tr><td>Wang et al. (2020b)</td><td>-</td><td>Wei et al. (2020)</td><td>82.7</td><td>87.1</td><td>72.7 77.7</td><td>1</td><td>-</td><td>-</td><td>1</td></tr><tr><td>XLM-R+Fine-tune</td><td>96.5</td><td>XLM-R+Fine-tune</td><td>81.3</td><td>88.4</td><td>77.3 78.5</td><td></td><td></td><td></td><td>77.8 72.1 75.7 66.7</td></tr><tr><td>ACE+Fine-tune</td><td>97.0</td><td>ACE+Fine-tune</td><td>85.0</td><td>89.8</td><td>78.5</td><td>81.2</td><td></td><td></td><td>78.8 76.7 76.7 77.7</td></tr></table>
|
| 160 |
+
|
| 161 |
+
Talwalkar, 2020). For Random, we run the same maximum iteration as in ACE. Table 1 shows that ACE outperforms both baselines in 6 tasks over 23 test sets with only two exceptions. Comparing Random with All, Random outperforms All by 0.4 on average and surpasses the accuracy of All on 14 out of 23 test sets, which shows that concatenating all embeddings may not be the best solution to most structured prediction tasks. In general, searching for the concatenation for the word representation is essential in most cases, and our search design can usually lead to better results compared to both of the baselines.
|
| 162 |
+
|
| 163 |
+
# 4.3.2 COMPARISON WITH STATE-OF-THE-ART APPROACHES
|
| 164 |
+
|
| 165 |
+
As we have shown, ACE has an advantage in searching for better embedding concatenations. We further show that ACE is competitive or even stronger than state-of-the-art approaches. In some tasks, We have several additional settings to better compare with previous work. In NER, we also conduct a comparison on the revised version of German datasets in the CoNLL 2006 shared task (Buchholz & Marsi, 2006). In parsing tasks, we use XLNet (Yang et al., 2019), which is significantly stronger than BERT in DP (Zhou & Zhao, 2019). In SDP, the state-of-the-art approaches used POS tags and lemmas as additional word features to the network. We add these two features to the embedding candidates and train the embeddings together with the task. We use the fine-tuned BERT embeddings, XLM-R embeddings, and XLNet embeddings on each task instead of the pretrained version of these embeddings as the candidates. For the NER tasks, we use the XLM-R models fine-tuned by Hugging Face instead.2
|
| 166 |
+
|
| 167 |
+
We additionally compare with fine-tuned XLM-R model for NER, POS tagging, chunking and AE, and compare with fine-tuned XLNet model for DP and SDP, which are strong fine-tuned models in most of the experiments. Results are shown in Table 2, 3, 4. Results show that ACE with fine-tuned embeddings achieves state-of-the-art performance in 22 out of 24 test sets and is competitive with the state-of-the-art approaches in the other 2 test sets. Our approach is competitive or even stronger than the approaches using additional information in NER and DP, which shows that finding a good word representation helps structured prediction tasks. We also show that ACE is stronger than the fine-tuned models, which shows the effectiveness of concatenating the fine-tuned embeddings.
|
| 168 |
+
|
| 169 |
+
Table 4: Comparison with state-of-the-art approaches in DP and SDP. †: For reference, they additionally used constituency dependencies in training. $^ \ddag$ : For reference, we confirmed with the authors of He & Choi (2020) that they used a different data pre-processing script with previous work.
|
| 170 |
+
|
| 171 |
+
<table><tr><td rowspan="3"></td><td colspan="2">DP</td><td rowspan="3"></td><td colspan="6">SDP</td></tr><tr><td colspan="2">PTB UAS</td><td colspan="2">DM</td><td colspan="2">PAS</td><td colspan="2">PSD</td></tr><tr><td>LAS</td><td></td><td>ID</td><td>OOD</td><td>ID</td><td>OOD</td><td>ID</td><td>0OD</td></tr><tr><td>Zhou & Zhao (2019)+</td><td>97.2</td><td>95.7</td><td>He&Choi(2020)</td><td>94.6</td><td>90.8</td><td>96.1</td><td>94.4</td><td>86.8</td><td>79.5</td></tr><tr><td>F&G(2019)</td><td>96.0</td><td>94.4</td><td>D&M(2018)</td><td>94.0</td><td>89.7</td><td>94.1</td><td>91.3</td><td>81.4</td><td>79.6</td></tr><tr><td>He& Choi (2020)</td><td>96.8</td><td>95.3</td><td>Wang et al. (2019)</td><td>93.7</td><td>88.9</td><td>93.9</td><td>90.6</td><td>81.0</td><td>79.4</td></tr><tr><td>Zhang et al. (2020)</td><td>96.1</td><td>94.5</td><td>F&G(2020)</td><td>94.4</td><td>91.0</td><td>95.1</td><td>93.4</td><td>82.6</td><td>82.0</td></tr><tr><td>XLNet+Fine-tune</td><td>97.0</td><td>95.4</td><td>XLNet+Fine-tune</td><td>94.9</td><td>92.0</td><td>94.8</td><td>93.4</td><td>82.6</td><td>82.2</td></tr><tr><td>ACE+Fine-tune</td><td>97.2</td><td>95.7</td><td>ACE+Fine-tune</td><td>95.3</td><td>92.6</td><td>95.3</td><td>93.9</td><td>83.6</td><td>83.2</td></tr></table>
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 2: Comparing the efficiency of random search (Random) and ACE. The $\mathbf { X }$ -axis is the number of time steps. The left y-axis is the averaged best validation accuracy on CoNLL English NER dataset. The right y-axis is the averaged validation accuracy of the current selection.
|
| 175 |
+
|
| 176 |
+
# 5 ANALYSIS
|
| 177 |
+
|
| 178 |
+
# 5.1 EFFICIENCY OF SEARCH METHODS
|
| 179 |
+
|
| 180 |
+
To show how efficient our approach is compared with the random search algorithm, we compare the algorithm in two aspects on CoNLL English NER dataset. The first aspect is the best development accuracy during training. The left part of Figure 2 shows that ACE is consistently stronger than the random search algorithm in this task. The second aspect is the searched concatenation at each time step. The right part of Figure 2 shows that the accuracy of ACE gradually increases and gets stable when more concatenations are sampled.
|
| 181 |
+
|
| 182 |
+
# 5.2 ABLATION STUDY ON REWARD FUNCTION DESIGN
|
| 183 |
+
|
| 184 |
+
To show the effectiveness of the designed reward function, we compare our reward function (Eq. 6) with the reward function without discount factor (Eq. 5) and the traditional reward function (reward term in Eq. 4). We sample 2000 training sentences on CoNLL English NER dataset for faster training and train the controller for 50 steps. Table 5 shows that both the discount factor and the binary vector $\lvert a ^ { t } - a ^ { i } \rvert$ for the task are helpful in both development and test datasets.
|
| 185 |
+
|
| 186 |
+
Table 5: Comparison of reward functions.
|
| 187 |
+
|
| 188 |
+
<table><tr><td></td><td>DEV TEST</td></tr><tr><td>ACE No discount (Eq. 5) Simple (Eq. 4)</td><td>93.18 90.00 92.98 89.90 92.89 89.82</td></tr></table>
|
| 189 |
+
|
| 190 |
+
# 5.3 COMPARISON WITH ADDITIONAL BASELINES
|
| 191 |
+
|
| 192 |
+
We compare ACE with two more approaches to further show the effectiveness of ACE. One is a variant of All, which uses a weighting parameter $\pmb { b } = [ b _ { 1 } , \cdots , b _ { l } , \cdots , b _ { L } ]$ passing through a sigmoid function to weight each embedding candidate. Such an approach can explicitly learn the weight of each embedding in training instead of a binary mask. We call this approach All+Weight. Another one is model ensemble, which trains the task model with each embedding candidate individually and uses the trained models to make joint prediction on the test set. We use voting for ensemble as it is simple and fast. For sequence labeling tasks, the models vote for the predicted label at each position. For DP, the models vote for the tree of each sentence. For SDP, the models vote for each potential labeled arc. We use the confidence of model predictions to break ties if there are more than one agreement with the same counts. We call this approach Ensemble. One of the benefits of voting is that it combines the predictions of the task models efficiently without any training process. We can search all possible $2 ^ { \hat { L } } - 1$ model ensembles in a short period of time through caching the outputs of the models. Therefore, we search for the best ensemble of models on the development set and then evaluate the best ensemble on the test set $\left( \mathtt { E n s e m b l e } _ { \mathtt { d e v } } \right)$ ). Moreover, we additionally search for the best ensemble on the test set for reference (Ensemb $\scriptstyle \mathtt { l e } _ { \mathtt { t e } \mathtt { s t } }$ ), which is the upper bound of the approach. We use the same setting as in Section 4.3.1 and select one of the datasets from each task. For NER, POS tagging, AE, and SDP, we use CoNLL 2003 English, Ritter, 16Res, and DM datasets, respectively. The results are shown in Table 6. Empirical results show that ACE outperforms all the settings of these approaches and even Ensemb $\scriptstyle \mathtt { l e } _ { \mathtt { t e } \mathtt { s t } }$ , which shows the effectiveness of ACE and the limitation of ensemble models. All, All+Weight and $\mathtt { E n s e m b l e } _ { \mathrm { d e v } }$ are competitive in most of the cases and there is no clear winner of these approaches on all the datasets. These results show the strength of embedding concatenation. Concatenating the embeddings incorporates information from all the embeddings and forms stronger word representations for the task model, while in model ensemble, it is difficult for the individual task models to affect each other through ensemble.
|
| 193 |
+
|
| 194 |
+
Table 6: A comparison among All, Random, ACE, Table 7: Results of models with document All+Weight and Ensemble. CHK: chunking. context on NER. $+ \mathrm { s e n t } / + \mathrm { d o c }$ : models with
|
| 195 |
+
sentence-/document-level embeddings.
|
| 196 |
+
|
| 197 |
+
<table><tr><td></td><td>DP SDP NER POS AE CHK UAS LAS ID OOD</td></tr><tr><td>All</td><td>92.4 90.6 73.2 96.7 96.7 95.1 94.3 90.8</td></tr><tr><td>Random 92.6 93.0</td><td>91.3 74.7 96.7 96.8 95.2 94.4 90.8</td></tr><tr><td>ACE All+Weight 92.7</td><td>91.7 75.6 96.8 96.9 95.3 94.5 90.9 90.4 73.7 95.1 94.3 90.7</td></tr><tr><td>Ensemble</td><td>96.7 96.7 92.2 90.6 68.1 96.5 96.1 94.3 94.1 90.3</td></tr><tr><td>Ensembledev</td><td>92.2 90.8 70.2 96.7 96.8 95.2 94.3 90.7</td></tr><tr><td>Ensembletest</td><td>92.7 91.4 73.9 96.7 96.8 95.2 94.4 90.8</td></tr></table>
|
| 198 |
+
|
| 199 |
+
<table><tr><td></td><td>de de06 en es nl</td></tr><tr><td>All+sent ACE+sent</td><td>86.8 90.1 93.3 90.0 94.4 87.1 90.5 93.6 92.4 94.6</td></tr><tr><td>BERT (2019)</td><td>- = 92.8 - -</td></tr><tr><td>Akbik et al. (2019) Yu et al. (2020)</td><td>-88.3 93.2 1 90.4 86.4 90.3 93.5 90.3 93.7</td></tr><tr><td>All+doc</td><td>87.6 91.0 93.5 93.3 93.7</td></tr><tr><td>ACE+doc</td><td>88.0 91.4 94.195.6 95.5</td></tr></table>
|
| 200 |
+
|
| 201 |
+
# 5.4 ACE WITH DOCUMENT-LEVEL REPRESENTATIONS
|
| 202 |
+
|
| 203 |
+
Recently, models with document-level word representations extracted from transformer-based embeddings significantly outperform models with sentence-level word representations in NER (Devlin et al., 2019; Yu et al., 2020). To show the effectiveness of ACE with document-level representations, we replace the sentence-level word representations from transformer-based embeddings (i.e., XLMR and BERT embeddings) with the document-level word representations. We generate documentlevel representations following Yu et al. (2020). Results are shown in Table 7. We report the test results of All to show how the gap between ACE and All changes with different kinds of representations. We report the test accuracy of the models with the highest development accuracy following Yu et al. (2020) for a fair comparison. Empirical results show that the document-level representations can significantly improve the accuracy of ACE. Comparing with models with sentence-level representations, the averaged accuracy gap between ACE and All is enhanced from 0.7 to 1.1 with document-level representations, which shows that the advantage of ACE becomes stronger with document-level representations.
|
| 204 |
+
|
| 205 |
+
# 6 CONCLUSION
|
| 206 |
+
|
| 207 |
+
In this paper, we propose the Automated Concatenation of Embeddings, which automatically searches for better embedding concatenation for structured prediction tasks. We design a simple search space and use the reinforcement learning with a novel reward function to efficiently guide the controller to search for better embedding concatenations. We take the change of embedding concatenations into the reward function design and show that our new reward function is stronger than the simpler ones. Results show that ACE outperforms strong baselines. Together with fine-tuned embeddings, ACE achieves state-of-the-art performance in 6 tasks over 19 out of 21 datasets.
|
| 208 |
+
|
| 209 |
+
# REFERENCES
|
| 210 |
+
|
| 211 |
+
Alan Akbik, Duncan Blythe, and Roland Vollgraf. Contextual string embeddings for sequence labeling. In Proceedings of the 27th International Conference on Computational Linguistics, pp. 1638–1649, Santa Fe, New Mexico, USA, August 2018. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/C18-1139.
|
| 212 |
+
|
| 213 |
+
Alan Akbik, Tanja Bergmann, and Roland Vollgraf. Pooled contextualized embeddings for named entity recognition. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 724–728, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1078. URL https://www.aclweb.org/anthology/ N19-1078.
|
| 214 |
+
|
| 215 |
+
Peter J Angeline, Gregory M Saunders, and Jordan B Pollack. An evolutionary algorithm that constructs recurrent neural networks. IEEE transactions on Neural Networks, 5(1):54–65, 1994.
|
| 216 |
+
|
| 217 |
+
Alexei Baevski, Sergey Edunov, Yinhan Liu, Luke Zettlemoyer, and Michael Auli. Cloze-driven pretraining of self-attention networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 5360–5369, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1539. URL https: //www.aclweb.org/anthology/D19-1539.
|
| 218 |
+
|
| 219 |
+
Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. In ICLR, 2017.
|
| 220 |
+
|
| 221 |
+
Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching word vectors with subword information. Transactions of the Association for Computational Linguistics, 5:135–146, 2017. ISSN 2307-387X.
|
| 222 |
+
|
| 223 |
+
Sabine Buchholz and Erwin Marsi. CoNLL-x shared task on multilingual dependency parsing. In Proceedings of the Tenth Conference on Computational Natural Language Learning (CoNLLX), pp. 149–164, New York City, June 2006. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/W06-2920.
|
| 224 |
+
|
| 225 |
+
Kevin Clark, Minh-Thang Luong, Christopher D. Manning, and Quoc Le. Semi-supervised sequence modeling with cross-view training. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 1914–1925, Brussels, Belgium, OctoberNovember 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1217. URL https://www.aclweb.org/anthology/D18-1217.
|
| 226 |
+
|
| 227 |
+
Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 8440–8451, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.747. URL https: //www.aclweb.org/anthology/2020.acl-main.747.
|
| 228 |
+
|
| 229 |
+
Steven J. DeRose. Grammatical category disambiguation by statistical optimization. Computational Linguistics, 14(1), 1988. URL https://www.aclweb.org/anthology/J88-1003.
|
| 230 |
+
|
| 231 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //www.aclweb.org/anthology/N19-1423.
|
| 232 |
+
|
| 233 |
+
Timothy Dozat and Christopher D Manning. Deep biaffine attention for neural dependency parsing. In International Conference on Learning Representations, 2017.
|
| 234 |
+
|
| 235 |
+
Timothy Dozat and Christopher D. Manning. Simpler but more accurate semantic dependency parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 484–490, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-2077. URL https://www.aclweb. org/anthology/P18-2077.
|
| 236 |
+
|
| 237 |
+
Thomas Elsken, Jan-Hendrik Metzen, and Frank Hutter. Simple and efficient architecture search for convolutional neural networks. In ICLR workshop, 2018.
|
| 238 |
+
|
| 239 |
+
Thomas Elsken, Jan Hendrik Metzen, and Frank Hutter. Neural architecture search: A survey. Journal of Machine Learning Research, 20:1–21, 2019.
|
| 240 |
+
|
| 241 |
+
Daniel Fernández-González and Carlos Gómez-Rodríguez. Left-to-right dependency parsing with pointer networks. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 710–716, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1076. URL https://www.aclweb.org/anthology/ N19-1076.
|
| 242 |
+
|
| 243 |
+
Daniel Fernández-González and Carlos Gómez-Rodríguez. Transition-based semantic dependency parsing with pointer networks. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7035–7046, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.629. URL https://www.aclweb.org/ anthology/2020.acl-main.629.
|
| 244 |
+
|
| 245 |
+
Dario Floreano, Peter Dürr, and Claudio Mattiussi. Neuroevolution: from architectures to learning. Evolutionary intelligence, 1(1):47–62, 2008.
|
| 246 |
+
|
| 247 |
+
Golnaz Ghiasi, Tsung-Yi Lin, and Quoc V Le. Nas-fpn: Learning scalable feature pyramid architecture for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7036–7045, 2019.
|
| 248 |
+
|
| 249 |
+
Kevin Gimpel, Nathan Schneider, Brendan O’Connor, Dipanjan Das, Daniel Mills, Jacob Eisenstein, Michael Heilman, Dani Yogatama, Jeffrey Flanigan, and Noah A. Smith. Part-of-speech tagging for twitter: Annotation, features, and experiments. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 42–47, Portland, Oregon, USA, June 2011. Association for Computational Linguistics. URL https: //www.aclweb.org/anthology/P11-2008.
|
| 250 |
+
|
| 251 |
+
David E Goldberg and Kalyanmoy Deb. A comparative analysis of selection schemes used in genetic algorithms. In Foundations of genetic algorithms, volume 1, pp. 69–93. Elsevier, 1991.
|
| 252 |
+
|
| 253 |
+
Tao Gui, Qi Zhang, Haoran Huang, Minlong Peng, and Xuanjing Huang. Part-of-speech tagging for twitter with adversarial neural networks. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2411–2420, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/D17-1256. URL https: //www.aclweb.org/anthology/D17-1256.
|
| 254 |
+
|
| 255 |
+
Tao Gui, Qi Zhang, Jingjing Gong, Minlong Peng, Di Liang, Keyu Ding, and Xuanjing Huang. Transferring from formal newswire domain with hypernet for twitter POS tagging. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2540–2549, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1275. URL https://www.aclweb.org/anthology/D18-1275.
|
| 256 |
+
|
| 257 |
+
Han He and Jinho Choi. Establishing strong baselines for the new decade: Sequence tagging, syntactic and semantic parsing with bert. In The Thirty-Third International Flairs Conference, 2020.
|
| 258 |
+
|
| 259 |
+
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.
|
| 260 |
+
|
| 261 |
+
Minqing Hu and Bing Liu. Mining and summarizing customer reviews. In Proceedings of the Tenth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD $^ { \circ } 0 4$ , pp. 168–177, New York, NY, USA, 2004. Association for Computing Machinery. ISBN 1581138881. doi: 10.1145/1014052.1014073. URL https://doi.org/10.1145/ 1014052.1014073.
|
| 262 |
+
|
| 263 |
+
Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700–4708, 2017.
|
| 264 |
+
|
| 265 |
+
Rafal Jozefowicz, Wojciech Zaremba, and Ilya Sutskever. An empirical exploration of recurrent network architectures. In International conference on machine learning, pp. 2342–2350, 2015.
|
| 266 |
+
|
| 267 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
|
| 268 |
+
|
| 269 |
+
Dan Kondratyuk and Milan Straka. 75 languages, 1 model: Parsing Universal Dependencies universally. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pp. 2779–2795, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1279. URL https://www.aclweb.org/anthology/ D19-1279.
|
| 270 |
+
|
| 271 |
+
Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. Neural architectures for named entity recognition. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 260–270, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1030. URL https://www.aclweb.org/anthology/ N16-1030.
|
| 272 |
+
|
| 273 |
+
Liam Li and Ameet Talwalkar. Random search and reproducibility for neural architecture search. In Uncertainty in Artificial Intelligence, pp. 367–377. PMLR, 2020.
|
| 274 |
+
|
| 275 |
+
Xin Li, Lidong Bing, Wenxuan Zhang, and Wai Lam. Exploiting BERT for end-to-end aspectbased sentiment analysis. In Proceedings of the 5th Workshop on Noisy User-generated Text (W-NUT 2019), pp. 34–41, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-5505. URL https://www.aclweb.org/anthology/ D19-5505.
|
| 276 |
+
|
| 277 |
+
Chenxi Liu, Liang-Chieh Chen, Florian Schroff, Hartwig Adam, Wei Hua, Alan L Yuille, and Li FeiFei. Auto-deeplab: Hierarchical neural architecture search for semantic image segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 82–92, 2019a.
|
| 278 |
+
|
| 279 |
+
Hanxiao Liu, Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, and Koray Kavukcuoglu. Hierarchical representations for efficient architecture search. In International Conference on Learning Representations, 2018a.
|
| 280 |
+
|
| 281 |
+
Yijia Liu, Yi Zhu, Wanxiang Che, Bing Qin, Nathan Schneider, and Noah A. Smith. Parsing tweets into universal dependencies. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 965–975, New Orleans, Louisiana, June 2018b. Association for Computational Linguistics. doi: 10.18653/v1/N18-1088. URL https://www.aclweb.org/anthology/ N18-1088.
|
| 282 |
+
|
| 283 |
+
Yijin Liu, Fandong Meng, Jinchao Zhang, Jinan Xu, Yufeng Chen, and Jie Zhou. GCDT: A global context enhanced deep transition architecture for sequence labeling. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2431–2441, Florence, Italy, July 2019b. Association for Computational Linguistics. doi: 10.18653/v1/P19-1233. URL https://www.aclweb.org/anthology/P19-1233.
|
| 284 |
+
|
| 285 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019c.
|
| 286 |
+
|
| 287 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2018.
|
| 288 |
+
|
| 289 |
+
Xuezhe Ma and Eduard Hovy. End-to-end sequence labeling via bi-directional LSTM-CNNs-CRF. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1064–1074, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1101. URL https://www.aclweb.org/ anthology/P16-1101.
|
| 290 |
+
|
| 291 |
+
Xuezhe Ma, Zecong Hu, Jingzhou Liu, Nanyun Peng, Graham Neubig, and Eduard Hovy. Stackpointer networks for dependency parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1403–1414, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1130. URL https://www.aclweb.org/anthology/P18-1130.
|
| 292 |
+
|
| 293 |
+
Ryan McDonald, Fernando Pereira, Kiril Ribarov, and Jan Hajic. Non-projective dependency pars- ˇ ing using spanning tree algorithms. In Proceedings of Human Language Technology Conference and Conference on Empirical Methods in Natural Language Processing, pp. 523–530, Vancouver, British Columbia, Canada, October 2005. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/H05-1066.
|
| 294 |
+
|
| 295 |
+
Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013.
|
| 296 |
+
|
| 297 |
+
Geoffrey Miller, Peter Todd, and Shailesh Hegde. Designing neural networks using genetic algorithms. In 3rd International Conference on Genetic Algorithms, pp. 379–384, 01 1989.
|
| 298 |
+
|
| 299 |
+
Dat Quoc Nguyen, Thanh Vu, and Anh Tuan Nguyen. BERTweet: A pre-trained language model for English Tweets. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, 2020.
|
| 300 |
+
|
| 301 |
+
Stephan Oepen, Marco Kuhlmann, Yusuke Miyao, Daniel Zeman, Dan Flickinger, Jan Hajic, Angelina Ivanova, and Yi Zhang. Semeval 2014 task 8: Broad-coverage semantic dependency parsing. SemEval 2014, 2014.
|
| 302 |
+
|
| 303 |
+
Stephan Oepen, Marco Kuhlmann, Yusuke Miyao, Daniel Zeman, Silvie Cinková, Dan Flickinger, Jan Hajic, and Zdenka Uresova. Semeval 2015 task 18: Broad-coverage semantic dependency parsing. In Proceedings of the 9th International Workshop on Semantic Evaluation (SemEval 2015), pp. 915–926, 2015.
|
| 304 |
+
|
| 305 |
+
Olutobi Owoputi, Brendan O’Connor, Chris Dyer, Kevin Gimpel, Nathan Schneider, and Noah A. Smith. Improved part-of-speech tagging for online conversational text with word clusters. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 380–390, Atlanta, Georgia, June 2013. Association for Computational Linguistics. URL https://www.aclweb.org/ anthology/N13-1039.
|
| 306 |
+
|
| 307 |
+
Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
|
| 308 |
+
|
| 309 |
+
Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 2227–2237, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1202. URL https://www.aclweb.org/anthology/N18-1202.
|
| 310 |
+
|
| 311 |
+
Hieu Pham, Melody Guan, Barret Zoph, Quoc Le, and Jeff Dean. Efficient neural architecture search via parameters sharing. In International Conference on Machine Learning, pp. 4095–4104, 2018a.
|
| 312 |
+
|
| 313 |
+
Hieu Pham, Melody Y Guan, Barret Zoph, Quoc V Le, and Jeff Dean. Efficient neural architecture search via parameter sharing. In International Conference on Machine Learning, 2018b.
|
| 314 |
+
|
| 315 |
+
Telmo Pires, Eva Schlinger, and Dan Garrette. How multilingual is multilingual BERT? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4996–5001, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1493. URL https://www.aclweb.org/anthology/P19-1493.
|
| 316 |
+
|
| 317 |
+
Maria Pontiki, Dimitris Galanis, John Pavlopoulos, Harris Papageorgiou, Ion Androutsopoulos, and Suresh Manandhar. SemEval-2014 task 4: Aspect based sentiment analysis. In Proceedings of the 8th International Workshop on Semantic Evaluation (SemEval 2014), pp. 27–35, Dublin, Ireland, August 2014. Association for Computational Linguistics. doi: 10.3115/v1/S14-2004. URL https://www.aclweb.org/anthology/S14-2004.
|
| 318 |
+
|
| 319 |
+
Maria Pontiki, Dimitris Galanis, Haris Papageorgiou, Suresh Manandhar, and Ion Androutsopoulos. SemEval-2015 task 12: Aspect based sentiment analysis. In Proceedings of the 9th International Workshop on Semantic Evaluation (SemEval 2015), pp. 486–495, Denver, Colorado, June 2015. Association for Computational Linguistics. doi: 10.18653/v1/S15-2082. URL https://www. aclweb.org/anthology/S15-2082.
|
| 320 |
+
|
| 321 |
+
Maria Pontiki, Dimitris Galanis, Haris Papageorgiou, Ion Androutsopoulos, Suresh Manandhar, Mohammad AL-Smadi, Mahmoud Al-Ayyoub, Yanyan Zhao, Bing Qin, Orphée De Clercq, Véronique Hoste, Marianna Apidianaki, Xavier Tannier, Natalia Loukachevitch, Evgeniy Kotelnikov, Nuria Bel, Salud María Jiménez-Zafra, and Gül¸sen Eryigit. SemEval-2016 task 5: As- ˘ pect based sentiment analysis. In Proceedings of the 10th International Workshop on Semantic Evaluation (SemEval-2016), pp. 19–30, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/S16-1002. URL https://www.aclweb.org/ anthology/S16-1002.
|
| 322 |
+
|
| 323 |
+
Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Jie Tan, Quoc V Le, and Alexey Kurakin. Large-scale evolution of image classifiers. In International Conference on Machine Learning, pp. 2902–2911, 2017.
|
| 324 |
+
|
| 325 |
+
Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V Le. Regularized evolution for image classifier architecture search. In Proceedings of the aaai conference on artificial intelligence, volume 33, pp. 4780–4789, 2019.
|
| 326 |
+
|
| 327 |
+
Alan Ritter, Sam Clark, Mausam, and Oren Etzioni. Named entity recognition in tweets: An experimental study. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pp. 1524–1534, Edinburgh, Scotland, UK., July 2011. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D11-1141.
|
| 328 |
+
|
| 329 |
+
Cicero D Santos and Bianca Zadrozny. Learning character-level representations for part-of-speech tagging. In Proceedings of the 31st international conference on machine learning (ICML-14), pp. 1818–1826, 2014.
|
| 330 |
+
|
| 331 |
+
Tal Schuster, Ori Ram, Regina Barzilay, and Amir Globerson. Cross-lingual alignment of contextual word embeddings, with applications to zero-shot dependency parsing. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 1599–1613, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1162. URL https://www.aclweb.org/anthology/N19-1162.
|
| 332 |
+
|
| 333 |
+
David R So, Chen Liang, and Quoc V Le. The evolved transformer. In International Conference on Machine Learning, 2019.
|
| 334 |
+
|
| 335 |
+
Kenneth O Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary computation, 10(2):99–127, 2002.
|
| 336 |
+
|
| 337 |
+
Jana Straková, Milan Straka, and Jan Hajic. Neural architectures for nested NER through linearization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5326–5331, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1527. URL https://www.aclweb.org/anthology/P19-1527.
|
| 338 |
+
|
| 339 |
+
Masanori Suganuma, Shinichi Shirakawa, and Tomoharu Nagao. A genetic programming approach to designing convolutional neural network architectures. In Proceedings of the genetic and evolutionary computation conference, pp. 497–504, 2017.
|
| 340 |
+
|
| 341 |
+
Beth M. Sundheim. Named entity task definition, version 2.1. In Proceedings of the Sixth Message Understanding Conference, pp. 319–332, 1995.
|
| 342 |
+
|
| 343 |
+
Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 1992.
|
| 344 |
+
|
| 345 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016.
|
| 346 |
+
|
| 347 |
+
Lucien Tesnière. éléments de syntaxe structurale. Editions Klincksieck, 1959.
|
| 348 |
+
|
| 349 |
+
Erik F. Tjong Kim Sang. Introduction to the CoNLL-2002 shared task: Language-independent named entity recognition. In COLING-02: The 6th Conference on Natural Language Learning 2002 (CoNLL-2002), 2002. URL https://www.aclweb.org/anthology/W02-2024.
|
| 350 |
+
|
| 351 |
+
Erik F. Tjong Kim Sang and Sabine Buchholz. Introduction to the CoNLL-2000 shared task chunking. In Fourth Conference on Computational Natural Language Learning and the Second Learning Language in Logic Workshop, 2000. URL https://www.aclweb.org/anthology/ W00-0726.
|
| 352 |
+
|
| 353 |
+
Erik F. Tjong Kim Sang and Fien De Meulder. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pp. 142–147, 2003. URL https: //www.aclweb.org/anthology/W03-0419.
|
| 354 |
+
|
| 355 |
+
Xinyu Wang, Jingxian Huang, and Kewei Tu. Second-order semantic dependency parsing with endto-end neural networks. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4609–4618, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1454. URL https://www.aclweb.org/anthology/ P19-1454.
|
| 356 |
+
|
| 357 |
+
Xinyu Wang, Yong Jiang, Nguyen Bach, Tao Wang, Fei Huang, and Kewei Tu. Structure-level knowledge distillation for multilingual sequence labeling. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 3317–3330, Online, July 2020a. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.304. URL https: //www.aclweb.org/anthology/2020.acl-main.304.
|
| 358 |
+
|
| 359 |
+
Xinyu Wang, Yong Jiang, Nguyen Bach, Tao Wang, Huang Zhongqiang, Fei Huang, and Kewei Tu. More embeddings, better sequence labelers? In Findings of EMNLP, Online, November 2020b.
|
| 360 |
+
|
| 361 |
+
Zhenkai Wei, Yu Hong, Bowei Zou, Meng Cheng, and Jianmin Yao. Don’t eclipse your arts due to small discrepancies: Boundary repositioning with a pointer network for aspect extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 3678–3684, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.acl-main.339. URL https://www.aclweb.org/anthology/2020.acl-main. 339.
|
| 362 |
+
|
| 363 |
+
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 364 |
+
|
| 365 |
+
Martin Wistuba. Deep learning architecture search by neuro-cell-based evolution with functionpreserving mutations. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 243–258. Springer, 2018.
|
| 366 |
+
|
| 367 |
+
Shijie Wu and Mark Dredze. Beto, bentz, becas: The surprising cross-lingual effectiveness of BERT. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 833–844, Hong Kong, China, November 2019. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D19-1077.
|
| 368 |
+
|
| 369 |
+
L. Xie and A. Yuille. Genetic cnn. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 1388–1397, 2017.
|
| 370 |
+
|
| 371 |
+
Hu Xu, Bing Liu, Lei Shu, and Philip S. Yu. Double embeddings and CNN-based sequence labeling for aspect extraction. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 592–598, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-2094. URL https://www.aclweb.org/anthology/P18-2094.
|
| 372 |
+
|
| 373 |
+
Hu Xu, Bing Liu, Lei Shu, and Philip Yu. BERT post-training for review reading comprehension and aspect-based sentiment analysis. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 2324–2335, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1242. URL https://www.aclweb.org/anthology/N19-1242.
|
| 374 |
+
|
| 375 |
+
Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5753–5763, 2019.
|
| 376 |
+
|
| 377 |
+
Juntao Yu, Bernd Bohnet, and Massimo Poesio. Named entity recognition as dependency parsing. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 6470–6476, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.acl-main.577. URL https://www.aclweb.org/anthology/2020.acl-main. 577.
|
| 378 |
+
|
| 379 |
+
Yu Zhang, Zhenghua Li, and Min Zhang. Efficient second-order TreeCRF for neural dependency parsing. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 3295–3305, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.302. URL https://www.aclweb.org/anthology/2020. acl-main.302.
|
| 380 |
+
|
| 381 |
+
Zhao Zhong, Junjie Yan, Wei Wu, Jing Shao, and Cheng-Lin Liu. Practical block-wise neural network architecture generation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2423–2432, 2018.
|
| 382 |
+
|
| 383 |
+
Junru Zhou and Hai Zhao. Head-driven phrase structure grammar parsing on Penn treebank. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2396–2408, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/ v1/P19-1230. URL https://www.aclweb.org/anthology/P19-1230.
|
| 384 |
+
|
| 385 |
+
Wei Zhu, Xiaoling Wang, Xipeng Qiu, Yuan Ni, and Guotong Xie. Autotrans: Automating transformer design via reinforced architecture search. arXiv preprint arXiv:2009.02070, 2020.
|
| 386 |
+
|
| 387 |
+
Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. In ICLR, 2017.
|
| 388 |
+
|
| 389 |
+
Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8697–8710, 2018.
|
| 390 |
+
|
| 391 |
+
# A DETAILED CONFIGURATIONS
|
| 392 |
+
|
| 393 |
+
We use ISO 639-1 language codes to represent languages in the table3.
|
| 394 |
+
|
| 395 |
+
# A.1 DATASETS
|
| 396 |
+
|
| 397 |
+
The details of the 6 structured prediction tasks in our experiments are shown in below:
|
| 398 |
+
|
| 399 |
+
• NER: We use the corpora of 4 languages from the CoNLL 2002 and 2003 shared task (Tjong Kim Sang, 2002; Tjong Kim Sang & De Meulder, 2003) with standard split.
|
| 400 |
+
• POS Tagging: We use three datasets, Ritter11-T-POS (Ritter et al., 2011), ARK-Twitter (Gimpel et al., 2011; Owoputi et al., 2013) and Tweebank-v2 (Liu et al., 2018b) datasets (Ritter, ARK and TB-v2 in simplification). We follow the dataset split of (Nguyen et al., 2020).
|
| 401 |
+
• Chunking: We use CoNLL 2000 (Tjong Kim Sang & Buchholz, 2000) for chunking. Since there is no standard development set for CoNLL 2000 dataset, we split $10 \%$ of the training data as the development set.
|
| 402 |
+
• Aspect Extraction: Aspect extraction is a subtask of aspect-based sentiment analysis (Pontiki et al., 2014; 2015; 2016). The datasets are from the laptop and restaurant domain of SemEval 14, restaurant domain of SemEval 15 and restaurant domain of SemEval 16 shared task (14Lap, 14Res, 15Res and 16Res in short). Additionally, we use another 4 languages in the restaurant domain of SemEval 16 to test our approach in multiple languages. We randomly split $10 \%$ of the training data as the development set following Li et al. (2019).
|
| 403 |
+
• Syntactic Dependency Parsing: We use Penn Tree Bank (PTB) 3.0 with the same dataset preprocessing as (Ma et al., 2018).
|
| 404 |
+
• Semantic Dependency Parsing: We use DM, PAS and PSD datasets for semantic dependency parsing (Oepen et al., 2014) for the SemEval 2015 shared task (Oepen et al., 2015). The three datasets have the same sentences but with different formalisms. We use the standard split for SDP. In the split, there are in-domain test sets and out-of-domain test sets for each dataset.
|
| 405 |
+
|
| 406 |
+
Among these tasks, NER, POS tagging, chunking and aspect extraction are sequence-structured outputs while dependency parsing and semantic dependency parsing are the graph-sectured outputs. POS Tagging, chunking and DP are syntactic structured prediction tasks while NER, AE, SDP are semantic structured prediction tasks.
|
| 407 |
+
|
| 408 |
+
# A.2 EVALUATION
|
| 409 |
+
|
| 410 |
+
To evaluate our models, We use F1 score to evaluate NER, Chunking and AE, use accuracy to evaluate POS Tagging, use unlabeled attachment score (UAS) and labeled attachment score (LAS) to evaluate DP, and use labeled F1 score to evaluate SDP.
|
| 411 |
+
|
| 412 |
+
# A.3 TASK MODELS AND CONTROLLER
|
| 413 |
+
|
| 414 |
+
For sequence-structured tasks (i.e., NER, POS tagging, chunking, aspect extraction), we use a batch size of 32 sentences and an SGD optimizer with a learning rate of 0.1. We anneal the learning rate by 0.5 when there is no accuracy improvement on the development set for 5 epochs. We set the maximum training epoch to 150. For graph-structured tasks (i.e., DP and SDP), we use Adam (Kingma & Ba, 2015) to optimize the model with a learning rate of 0.002. We anneal the learning rate by 0.75 for every 5000 iterations following Dozat & Manning (2017). We set the maximum training epoch to 300. For DP, we run the maximum spanning tree McDonald et al. (2005) algorithm to output valid trees in testing. We fix the hyper-parameters of the task models.
|
| 415 |
+
|
| 416 |
+
We tune the learning rate for the controller among $\{ 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 , 0 . 5 \}$ and the discount factor among $\{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 \}$ on the same dataset in Section 5.2. We search for the hyper-parameter through grid search and find a learning rate of 0.1 and a discount factor of 0.5 performs the best on the development set. The controller’s parameters are initialized to all 0 so that each candidate is selected evenly in the first two time steps. We use Stochastic Gradient Descent (SGD) to optimize the controller. The training time depends on the task and dataset size. Take the English NER CoNLL dataset as an example. It takes 45 GPU hours to train the controller for 30 steps on a single Tesla P100 GPU, which is an acceptable training time in practice.
|
| 417 |
+
|
| 418 |
+
# A.4 SOURCES OF EMBEDDINGS
|
| 419 |
+
|
| 420 |
+
The sources of the embeddings that we used are listed in Table 8.
|
| 421 |
+
|
| 422 |
+
Table 8: The embeddings we used in our experiments. The URL is where we downloaded the embeddings. Note that we have confirmed that the XLM-R models fine-tuned on CoNLL 2002/2003 datasets are only trained on the training data.
|
| 423 |
+
|
| 424 |
+
<table><tr><td>EMBEDDING</td><td>RESOURCE</td><td>URL</td></tr><tr><td>GloVe</td><td>Pennington et al. (2014)</td><td>nlp.stanford.edu/projects/glove</td></tr><tr><td>fastText</td><td>Bojanowski et al. (2017)</td><td>github.com/facebookresearch/fastText</td></tr><tr><td>ELMo</td><td>Peters et al. (2018)</td><td>github.com/allenai/allennlp</td></tr><tr><td>ELMo (Other languages)</td><td>Schuster et al.(2019)</td><td>github.com/TalSchuster/CrossLingualContextualEmb</td></tr><tr><td>BERT</td><td>Devlin et al. (2019)</td><td>huggingface.co/bert-base-cased</td></tr><tr><td>M-BERT</td><td>Devlin et al. (2019)</td><td>huggingface.co/bert-base-multilingual-cased</td></tr><tr><td>BERT (Dutch)</td><td>wietsedv</td><td>huggingface.co/wietsedv/bert-base-dutch-cased</td></tr><tr><td>BERT(German)</td><td>dbmdz</td><td>huggingface.co/bert-base-german-dbmdz-cased</td></tr><tr><td>BERT(Spanish)</td><td>dccuchile</td><td>huggingface.co/dccuchile/bert-base-spanish-wwm-cased</td></tr><tr><td>BERT(Turkish)</td><td>dbmdz</td><td>huggingface.co/dbmdz/bert-base-turkish-cased</td></tr><tr><td>XLM-R</td><td>Conneau et al. (2020)</td><td>huggingface.co/xlm-roberta-large</td></tr><tr><td>XLM-R(CoNLL 02Dutch)</td><td>Hugging Face</td><td>huggingface.co/xlm-roberta-large-finetuned-conllo2-dutch</td></tr><tr><td>XLM-R(CoNLL 02 Spanish)</td><td>Hugging Face</td><td>huggingface.co/xlm-roberta-large-finetuned-conll02-spanish</td></tr><tr><td>XLM-R (CoNLL 03 English)</td><td>Hugging Face</td><td>huggingface.co/xlm-roberta-large-finetuned-conll03-english</td></tr><tr><td>XLM-R (CoNLL 03 German)</td><td>Hugging Face</td><td>huggingface.co/xlm-roberta-large-finetuned-conllo3-german</td></tr><tr><td>XLNet</td><td>Yang et al. (2019)</td><td>huggingface.co/xlnet-large-cased</td></tr></table>
|
| 425 |
+
|
| 426 |
+
# B ADDITIONAL ANALYSIS
|
| 427 |
+
|
| 428 |
+
# B.1 FINE-TUNED MODELS VERSUS ACE
|
| 429 |
+
|
| 430 |
+
To fine-tune the embeddings, we use AdamW (Loshchilov & Hutter, 2018) optimizer with a learning rate of 5e-5 and trained the contextualized embeddings with the task for 10 epochs. We use a batch size of 32 for BERT, M-BERT and use a batch size of 16 for XLM-R and XLNet. A comparison between ACE and the fine-tuned embeddings that we used in ACE is shown in Table 9, 10. Results show that ACE can further improve the accuracy of fine-tuned models.
|
| 431 |
+
|
| 432 |
+
Table 9: A comparison between ACE and the fine-tuned embeddings that are used in ACE for NER and POS tagging.
|
| 433 |
+
|
| 434 |
+
<table><tr><td rowspan="2"></td><td colspan="5">NER</td><td colspan="3">POS</td></tr><tr><td>de</td><td>de (Revised)</td><td>en</td><td>es</td><td>nl</td><td>Ritter</td><td>ARK</td><td>TB-v2</td></tr><tr><td>BERT+Fine-tune</td><td>78.1</td><td>82.2</td><td>91.0</td><td>83.1</td><td>83.3</td><td>91.2</td><td>91.7</td><td>94.4</td></tr><tr><td>MBERT+Fine-tune</td><td>81.9</td><td>86.2</td><td>91.3</td><td>87.6</td><td>90.7</td><td>90.8</td><td>91.5</td><td>93.9</td></tr><tr><td>XLM-R+Fine-tune</td><td>85.8</td><td>-</td><td>92.9</td><td>89.7</td><td>92.5</td><td>93.0</td><td>93.4</td><td>95.0</td></tr><tr><td>ACE+Fine-tune</td><td>87.0</td><td>90.5</td><td>93.5</td><td>91.7</td><td>94.6</td><td>93.4</td><td>93.8</td><td>95.6</td></tr></table>
|
| 435 |
+
|
| 436 |
+
Table 10: A comparison between ACE and the fine-tuned embeddings we used in ACE for chunking and AE.
|
| 437 |
+
|
| 438 |
+
<table><tr><td rowspan="2"></td><td>Chunk</td><td colspan="7">AE</td></tr><tr><td>CoNLL2000</td><td>14Lap 14Res</td><td>15Res</td><td>16Res</td><td>es</td><td>nl</td><td>ru</td><td>tr</td></tr><tr><td>BERT+Fine-tune</td><td>96.7</td><td>81.2</td><td>87.7 71.8</td><td></td><td>73.9</td><td>76.9 73.1</td><td>64.3</td><td>75.6</td></tr><tr><td>MBERT+Fine-tune</td><td>96.6</td><td>83.5 85.0</td><td>69.5</td><td>73.6</td><td>74.5</td><td>72.6</td><td>71.6</td><td>58.8</td></tr><tr><td>XLM-R+Fine-tune</td><td>96.5</td><td>81.3 88.4</td><td>77.3</td><td>78.5</td><td>77.8</td><td>72.1</td><td>75.7</td><td>66.7</td></tr><tr><td>ACE+Fine-tune</td><td>97.0</td><td>85.0 89.8</td><td>78.5</td><td>81.2</td><td>78.8</td><td>76.7</td><td>76.7</td><td>77.7</td></tr></table>
|
| 439 |
+
|
| 440 |
+
# B.2 RETRAINING
|
| 441 |
+
|
| 442 |
+
Most of the work (Zoph & Le, 2017; Zoph et al., 2018; Pham et al., 2018b; So et al., 2019; Zhu et al., 2020) in NAS retrains the searched neural architecture from scratch so that the hyper-parameters of the searched model can be modified or trained on larger datasets. To show whether our searched embedding concatenation is helpful to the task, we retrain the task model with the embedding concatenations on the same dataset from scratch. For the experiment, we use the same dataset settings as in Section 5.3. We train the searched embedding concatenation of each run from ACE 3 times (therefore, 9 runs for each dataset).
|
| 443 |
+
|
| 444 |
+
Table 11: A comparison between ACE and the fine-tuned embeddings that are used in ACE for DP and SDP.
|
| 445 |
+
|
| 446 |
+
<table><tr><td rowspan="3"></td><td colspan="2">DP</td><td colspan="6">SDP</td></tr><tr><td colspan="2">PTB</td><td colspan="2">DM</td><td colspan="2">PAS</td><td colspan="2">PSD</td></tr><tr><td>UAS</td><td>LAS</td><td>ID</td><td>OOD</td><td>ID</td><td>OOD</td><td>ID</td><td>OOD</td></tr><tr><td>BERT+Fine-tune</td><td>96.6</td><td>95.1</td><td>94.4</td><td>91.4</td><td>94.4</td><td>93.0</td><td>82.0</td><td>81.3</td></tr><tr><td>MBERT+Fine-tune</td><td>96.5</td><td>94.9</td><td>93.9</td><td>90.4</td><td>93.9</td><td>92.1</td><td>81.2</td><td>80.0</td></tr><tr><td>XLM-R+Fine-tune</td><td>96.6</td><td>95.1</td><td>94.3</td><td>91.1</td><td>94.5</td><td>92.8</td><td>82.0</td><td>81.6</td></tr><tr><td>XLNET+Fine-tune</td><td>97.0</td><td>95.4</td><td>94.9</td><td>92.0</td><td>94.8</td><td>93.4</td><td>82.6</td><td>82.2</td></tr><tr><td>ACE+Fine-tune</td><td>97.2</td><td>95.7</td><td>95.3</td><td>92.6</td><td>95.3</td><td>93.9</td><td>83.6</td><td>83.2</td></tr></table>
|
| 447 |
+
|
| 448 |
+
Table 12 shows the comparison between retrained models with the searched embedding concatenation from ACE and All. The results show that the retrained models are competitive with ACE in SDP and in chunking. However, in another three tasks, the retrained models perform inferior to ACE, which shows our approach’s advantage. The retrained models outperform All in all tasks, which shows the effectiveness of the searched embedding concatenations.
|
| 449 |
+
|
| 450 |
+
Table 12: A comparison among retrained models, All and ACE. We use the one dataset for each task.
|
| 451 |
+
|
| 452 |
+
<table><tr><td></td><td>NER</td><td>POS</td><td>Chunk</td><td>AE</td><td>DP-UAS</td><td>DP-LAS</td><td>SDP-ID</td><td>SDP-OOD</td></tr><tr><td>All</td><td>92.4</td><td>90.6</td><td>96.7</td><td>73.2</td><td>96.7</td><td>95.1</td><td>94.3</td><td>90.8</td></tr><tr><td>Retrain</td><td>92.6</td><td>90.8</td><td>96.8</td><td>73.6</td><td>96.8</td><td>95.2</td><td>94.5</td><td>90.9</td></tr><tr><td>ACE</td><td>93.0</td><td>91.7</td><td>96.8</td><td>75.6</td><td>96.9</td><td>95.3</td><td>94.5</td><td>90.9</td></tr></table>
|
| 453 |
+
|
| 454 |
+
# B.3 EFFECT OF EMBEDDINGS IN THE SEARCHED EMBEDDING CONCATENATIONS
|
| 455 |
+
|
| 456 |
+
There is no clear conclusion on what concatenation of embeddings is helpful to most of the tasks. We analyze the best searched embedding concatenations by ACE over different structured outputs, semantic/syntactic type, and monolingual/multilingual tasks. The percentage of each embedding selected by the best concatenations from all experiments of ACE are shown in Table 13. The best embedding concatenation varies over the output structure, syntactic/semantic level of understanding, and the language. The experimental results show that it is essential to select embeddings for each kind of task separately. However, we also find that the embeddings are strong in specific settings. In comparison to the sequence-structured and graph-structured tasks, we find that M-BERT and ELMo are only frequently selected in sequence-structured tasks while XLM-R embeddings are always selected in graph-structured tasks. For Flair embeddings, the forward and backward model are evenly selected. We suspect one direction of Flair embeddings is strong enough. Therefore concatenating the embeddings from two directions together cannot further improve the accuracy. For non-contextualized embeddings, pretrained word embeddings are frequently selected in sequencestructured tasks, and character embeddings are not. When we dig deeper into the semantic and syntactic type of these two structured outputs, we find that in all best concatenations, BERT embeddings are selected in all syntactic sequence-structured tasks, and Flair, M-Flair, word, and XLM-R embeddings are selected in syntactic graph-structured tasks. In multilingual tasks, all best concatenations in multilingual NER tasks select M-BERT embeddings while M-BERT is rarely selected in multilingual AE tasks. The monolingual Flair embeddings are always selected in NER tasks, and XLM-R is more frequently selected in multilingual tasks than monolingual sequence-structured tasks (SS).
|
| 457 |
+
|
| 458 |
+
Table 13: The percentage of each embedding candidate selected in the best concatenations from ACE. F and MF are monolingual and multilingual Flair embeddings. We count these two embeddings are selected if one of the forward/backward (fw/bw) direction of Flair is selected in the concatenation. We count the Word embedding is selected if one of the fastText/GloVe embeddings is selected. SS: sequence-structured tasks. GS: graph-structured tasks. Sem.: Semantic-level tasks. Syn.: Syntactic-level tasks. M-NER: Multilingual NER tasks. M-AE: Multilingual AE tasks. We only use English datasets in SS and GS. English datasets are removed for M-NER and M-AE.
|
| 459 |
+
|
| 460 |
+
<table><tr><td></td><td>BERTM-BERTChar</td><td></td><td></td><td>ELMo</td><td>F</td><td>F-bw</td><td>F-fw</td><td>MF</td><td>MF-bw</td><td>MF-fw</td><td></td><td>Word XLM-R</td></tr><tr><td>ss GS</td><td>0.81 0.75</td><td>0.74 0.17</td><td>0.37 0.50</td><td>0.85 0.25</td><td>0.70 0.83</td><td>0.48 0.75</td><td>0.59 0.42</td><td>0.78 0.83</td><td>0.59 0.58</td><td>0.41 0.58</td><td>0.81 0.50</td><td>0.70 1.00</td></tr><tr><td>Sem. SS Syn.SS</td><td>0.67 1.00</td><td>0.73 0.75</td><td>0.40 0.33</td><td>0.80 0.92</td><td>0.60 0.83</td><td>0.40 0.58</td><td>0.53 0.67</td><td>0.87 0.67</td><td>0.60 0.58</td><td>0.53 0.25</td><td>0.80 0.83</td><td>0.60 0.83</td></tr><tr><td>Sem. GS Syn. GS</td><td>0.78 0.67</td><td>0.22 0.00</td><td>0.67 0.00</td><td>0.33 0.00</td><td>0.78 1.00</td><td>0.67 1.00</td><td>0.56 0.00</td><td>0.78 1.00</td><td>0.56 0.67</td><td>0.67 0.33</td><td>0.33 1.00</td><td>1.00 1.00</td></tr><tr><td>M-NER M-AE</td><td>0.67 1.00</td><td>1.00 0.33</td><td>0.56 0.75</td><td>0.83 0.33</td><td>1.00</td><td>0.78</td><td>1.00</td><td>0.89</td><td>0.78</td><td>0.44</td><td>0.78</td><td>0.89 0.92</td></tr></table>
|
md/train/pvCLqcsLJ1N/pvCLqcsLJ1N.md
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Remember What You Want to Forget: Algorithms for Machine Unlearning
|
| 2 |
+
|
| 3 |
+
Ayush Sekhari Cornell University as3663@cornell.edu
|
| 4 |
+
|
| 5 |
+
Jayadev Acharya⇤ Cornell University acharya@cornell.edu
|
| 6 |
+
|
| 7 |
+
Gautam Kamath⇤ University of Waterloo g@csail.mit.edu
|
| 8 |
+
|
| 9 |
+
Ananda Theertha Suresh⇤ Google Research, NY theertha@google.com
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
We study the problem of unlearning datapoints from a learnt model. The learner first receives a dataset $S$ drawn i.i.d. from an unknown distribution, and outputs a model $\widehat { w }$ that performs well on unseen samples from the same distribution. However, at some point in the future, any training datapoint $z \in S$ can request to be unlearned, thus prompting the learner to modify its output model while still ensuring the same accuracy guarantees. We initiate a rigorous study of generalization in machine unlearning, where the goal is to perform well on previously unseen datapoints. Our focus is on both computational and storage complexity.
|
| 14 |
+
|
| 15 |
+
For the setting of convex losses, we provide an unlearning algorithm that can unlearn up to $O ( n / d ^ { 1 / 4 } )$ samples, where $d$ is the problem dimension. In comparison, in general, differentially private learning (which implies unlearning) only guarantees deletion of $O ( n / d ^ { 1 / 2 } )$ samples. This demonstrates a novel separation between differential privacy and machine unlearning.
|
| 16 |
+
|
| 17 |
+
# 1 Introduction
|
| 18 |
+
|
| 19 |
+
Many organizations and companies employ user data to train machine learning models for a wide array of applications, ranging from movie recommendations to health care. While some of these organizations allow users to withdraw their consent from their data being used (at which point the organization will delete the user’s data), less savory businesses might covertly retain user data. Given the potential for misuse, legislators worldwide have wisely introduced laws that mandate user data deletion upon request. These include the European Union’s General Data Protection Regulation (GDPR), the California Consumer Privacy Act (CCPA), and Canada’s proposed Consumer Privacy Protection Act (CPPA).
|
| 20 |
+
|
| 21 |
+
There is some natural ambiguity present in these guidelines. Is it sufficient to simply delete the user’s data, or must one also take action on machine learning systems that used this data for training? Indeed, by now, privacy researchers are well-aware that user data may be extracted from trained machine learning models (e.g., Shokri et al. [2017], Carlini et al. [2019]). In a potentially landmark decision, the Federal Trade Commission recently ordered a company to delete not only data from users who deleted their accounts, but also models and algorithms derived from this data [Federal Trade Commission, 2021]. This suggests that organizations have an obligation to retrain any machine learning models after excluding users whose data has been deleted.
|
| 22 |
+
|
| 23 |
+
However, naïvely retraining models after every deletion request would be prohibitively expensive: training modern machine learning models may take weeks, and use resources of value in the millions. One could instead imagine more careful methods, which attempt to excise the required datapoints from the model: crucially, without incurring the cost of retraining from scratch. This notion is called machine unlearning. The goal would be to obtain a model which is identical to the alternative model that would be obtained when trained on the dataset after removing the points that need to be forgotten. This requirement is rather strong: Ginart et al. [2019] proposed a relaxed notion of deletion, in which the model must only be close to the alternative, where closeness is defined in a way reminiscent of differential privacy [Dwork et al., 2006a,b] (our variant of this notion is described in Definition 2). This relaxation has inspired the design of several efficient algorithms for data deletion from machine learning models [Guo et al., 2020, Izzo et al., 2021, Neel et al., 2021, Ullah et al., 2021].
|
| 24 |
+
|
| 25 |
+
As mentioned before, one naïve strategy involves retraining the model from scratch, sans the deleted datapoints. When the training dataset is large, this approach is undesirable for several reasons. First, it is computationally very expensive. Even iteration over the training data can be too costly, let alone training a new model on it. Second, preserving the entire training dataset consumes a significant amount of storage.2
|
| 26 |
+
|
| 27 |
+
Another straightforward approach involves model checkpointing, in which the learner preemptively stores backup models in which certain points have been excluded. While this strategy makes it easy to quickly return an appropriate backup model upon receiving a deletion request, the downside is that one typically has to store a number of additional models which scales with the training data size, which may be prohibitively large. As we can see from these examples, computational and storage complexity are two vital metrics when designing a machine unlearning algorithm.
|
| 28 |
+
|
| 29 |
+
Finally, while there has recently been a wealth of results in machine unlearning, all of it has focused on the core problem of empirical risk minimization, where the goal is to minimize the training loss. However, to fulfil the promise of machine learning, we desire algorithms that can generalize to previously unseen test data. Motivated simultaneously by all of these concerns, our goal is to address the following question:
|
| 30 |
+
|
| 31 |
+
How do we design resource-efficient machine unlearning algorithms which generalize?
|
| 32 |
+
|
| 33 |
+
Our contributions. We initiate a new line of inquiry in machine unlearning:
|
| 34 |
+
|
| 35 |
+
• We investigate generalization properties of unlearning algorithms, in particular asking: how many samples can we unlearn while still ensuring good performance on unseen test data? In comparison, prior work focused on the empirical training loss only.
|
| 36 |
+
|
| 37 |
+
• We consider machine unlearning simultaneously under storage constraints as well as the previously studied computation constraints. Unlike prior work, our algorithms do not require the training data to be available to the unlearning algorithm when deleting samples.
|
| 38 |
+
|
| 39 |
+
• A clean approach for unlearning is to ignore which particular samples are being unlearnt and directly apply known algorithms and guarantees from differential privacy (DP). We show a strict separation between DP and machine unlearning.
|
| 40 |
+
|
| 41 |
+
In particular, algorithms based on DP can delete at most $\widetilde { \Theta } ( n / \sqrt { d } )$ samples while still retaining test loss performance, where $d$ denotes the dimension of the problem. On the other hand, we provide efficient unlearning algorithms that take into account the particular samples to be unlearnt and show that we can delete up to $\widetilde { \cal O } ( n / d ^ { 1 / 4 } )$ samples, thus giving a quadratic improvement in terms of dependence of $d$ over DP. Our results apply to both strongly convex and convex loss functions.
|
| 42 |
+
|
| 43 |
+
# 1.1 Related work
|
| 44 |
+
|
| 45 |
+
Cao and Yang [2015] introduced the term “machine unlearning,” and gave efficient deterministic algorithms for exact unlearning in certain settings. This definition requires an algorithm to have identical outputs on a dataset after deleting a point, and if that point was never inserted. However, their algorithms are restricted to very structured problems only. Bourtoule et al. [2021] provide unlearning algorithms using a sharding-based strategy, though in a weaker unlearning model (requiring only that it be possible that the output may have arisen), and without error guarantees.
|
| 46 |
+
|
| 47 |
+
Ginart et al. [2019] introduced the probabilistic notion of unlearning, inspired by differential privacy [Dwork et al., 2006b,a]. Their definition requires the output distribution of the unlearning algorithm to be similar to the output distribution obtained by running the learning algorithm on the dataset without the deleted points. Several recent works [Guo et al., 2020, Izzo et al., 2021, Neel et al., 2021, Ullah et al., 2021] provide theoretical error guarantees for various problem settings under this probabilistic notion of unlearning. While our unlearning setup is closely related to that of Ginart et al. [2019] and in the related works, there are two major differences.
|
| 48 |
+
|
| 49 |
+
First, the prior work focuses on empirical risk minimization [Guo et al., 2020, Izzo et al., 2021, Neel et al., 2021, Ullah et al., 2021]. In their setup, the goal of the unlearning algorithm is to find approximate minimizers of the empirical loss on the remaining training dataset after deleting samples. In comparison, our focus in this paper is on the test loss, and we wish to understand how many samples can be deleted from a learnt model while still ensuring that the updated model performs well on unseen examples (i.e., the generalization error). As we discuss in Section 3.1, the goal of minimizing the training loss is qualitatively different from that of minimizing the test loss.
|
| 50 |
+
|
| 51 |
+
Second, the prior work focuses exclusively on the computational cost of unlearning, without concern for associated storage requirements. This has led to approaches which involve memory-intensive checkpointing data structures, which enables fast processing of deletion requests, but consumes potentially impractical amounts of storage. In contrast, we are additionally concerned with memory usage, which highlights the drawbacks of such approaches. Unlike prior work, our algorithms do not require the training data to be available to the unlearning algorithm when deleting samples, and only rely on some cheap-to-store data statistics.
|
| 52 |
+
|
| 53 |
+
The most closely related work to ours is the certified data removal framework of Guo et al. [2020] which provides efficient data deletion algorithms for generalized linear models (linear and logistic regression). While our deletion algorithm is similar to the Newton update removal mechanism considered in their work, there are some important technical differences. First, their unlearning setup requires access to the entire training dataset for deleting samples; we do not require this. Second, they provide theoretical guarantees in terms of the norm of the empirical gradient being small after data removal. In comparison, our guarantees are for the test loss. Third, their unlearning definition requires the learning algorithm to be randomized, and this leads to worse performance guarantees due to added noise. In comparison, we do not need to randomize the learning algorithm. Finally, our guarantees hold for arbitrary convex loss functions and are thus broader in scope.
|
| 54 |
+
|
| 55 |
+
Several other models of unlearning have been considered. Garg et al. [2020] give an alternative perspective on machine unlearning, grounded in cryptography. Other works in this space focus on exploring privacy risks [Chen et al., 2020] and verification [Sommer et al., 2020] in machine unlearning settings. For specific learning models like SVMs, exact unlearning has been considered under the framework of decremental learning [Cauwenberghs and Poggio, 2001, Tveit et al., 2003, Karasuyama and Takeuchi, 2010, Romero et al., 2007]. However, the primary motivation in these works is to use the framework of decremental learning to estimate the leave-one-out error in order to provide generalization guarantees for the learnt model. Finally, there has also been recent empirical and theoretical work in developing definitions and algorithms for machine unlearning with deep neural networks for application domains in computer vision [Du et al., 2019, Golatkar et al., 2020a,b, Nguyen et al., 2020].
|
| 56 |
+
|
| 57 |
+
# 2 Preliminaries
|
| 58 |
+
|
| 59 |
+
Let $\mathcal { D }$ be a distribution over an instance space $\mathcal { Z }$ and $\mathcal { W } \subseteq \mathbb { R } ^ { d }$ be the parameter space of a hypothesis class. Let $f \colon \mathcal { W } \times \mathcal { Z } \to \mathbb { R }$ be a loss function. The goal is to minimize the test loss population risk (test loss), given by
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
F ( w ) : = \mathbb { E } _ { z \sim \mathcal { D } } [ f ( w , z ) ] ,
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where $f ( w , z )$ is the loss of the hypothesis corresponding to $w \in \mathcal { W }$ on the instance $z \in { \mathcal { Z } }$ . Let $\begin{array} { r } { F ^ { * } = \operatorname* { m i n } _ { w \in \mathcal { W } } F ( w ) } \end{array}$ be the value of this minimum and $w ^ { * }$ be a corresponding minimizer. Since the distribution $\mathcal { D }$ is often unknown, we are restricted to rely on samples to find a small test loss model.
|
| 66 |
+
|
| 67 |
+
Given ${ \cal S } = ( z _ { 1 } , z _ { 2 } , \dots , z _ { n } )$ , a set of $n$ samples drawn independently from $\mathcal { D }$ , standard learning algorithms minimize the empirical loss given by
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
{ \widehat { F } } _ { n } ( w ) : = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } f ( w , z _ { i } ) .
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
# 2.1 Learning
|
| 74 |
+
|
| 75 |
+
Let $A : \mathcal { Z } ^ { n } \to \mathcal { W }$ be a learning algorithm that takes the dataset $S$ and returns a hypothesis $A ( S ) \in { \mathcal { W } }$ The quality of $A$ is measured in terms of the difference between the population risk of the hypothesis $A ( S )$ and the risk of the best hypothesis $w ^ { * }$ in $\mathcal { W }$ , i.e., the excess risk
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\mathbb { E } [ F ( A ( S ) ) ] - F ^ { * } ,
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where the expectation is over the randomness in $A$ and $S$ . This gives a natural notion of sample complexity.
|
| 82 |
+
|
| 83 |
+
Definition 1 (Sample complexity of learning). The $\gamma$ -sample complexity of a problem is defined as
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\begin{array} { r } { n _ { \gamma } : = \operatorname* { m i n } \{ n \mid \exists A \mathrm { ~ s . t . ~ } \mathbb { E } _ { S \sim \mathcal { D } ^ { n } } [ F ( A ( S ) ) ] - F ^ { * } \leq \gamma \mathrm { ~ \ o r ~ } a l l \mathcal { D } \} , } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
the fewest number of samples with which a $\gamma$ -suboptimal minimizer of the population loss $F ( w )$ can be achieved for any distribution over the data samples.
|
| 90 |
+
|
| 91 |
+
For comparing different algorithms throughout the paper, we set $\gamma = 0 . 0 1$ (or any other small arbitrary constant), and require that the provided learning algorithms learn with population risk sub-optimality of at most 0.01. Standard results in learning theory [Bubeck, 2014, Theorem 6.1] show that for convex and strongly convex losses,
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
n _ { 0 . 0 1 } = { \cal O } ( 1 ) ,
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where the hidden constant depends on the properties of $f$ such as its Lipschitzness, but is independent of the dimension $d$ of the parameter space $\mathcal { W } \subseteq \mathbb { R } ^ { d }$ .
|
| 98 |
+
|
| 99 |
+
# 2.2 Unlearning
|
| 100 |
+
|
| 101 |
+
Suppose a learning algorithm $A$ over $S$ outputs the model $A ( S )$ . An unlearning algorithm $\bar { A }$ takes as input the model $A ( S )$ and a set $U \subset S$ of data samples that are to be deleted, and is required to output a new model $\widetilde w \in \mathcal W$ . Besides the set $U$ and the model $A ( S )$ , the unlearning algorithm $\bar { A }$ can also access some additional data statistics $T ( S ) \in \mathcal T$ . We emphasize that the unlearning algorithm does not have access to the entire original dataset $S$ in this resource-constrained setting and hence cannot retrain from scratch.
|
| 102 |
+
|
| 103 |
+
This set of statistics $T ( S )$ captures the additional storage required by the algorithm to support unlearning. Thus, one of our goals is to minimize $| T ( S ) |$ , in particular aiming for memory requirements which are independent of the training data size $n$ . This precludes strategies which involve storing and reusing the entire training set, or aggressive model checkpointing. On the other hand, it permits storage of simple statistics such as the empirical mean or average gradient of training data points, which may prove useful when unlearning. At the same time, we are still concerned with our unlearning algorithm’s time complexity. This goes hand in hand with the storage complexity: for most natural algorithms, the two are likely to be polynomially related. Augmented by this set of data statistics $T ( S )$ , an unlearning algorithm is a mapping $\bar { A } : \bar { \mathcal { Z } } ^ { m } \times \mathcal { W } \times \bar { \mathcal { T } } \mathcal { W }$ .
|
| 104 |
+
|
| 105 |
+
To illustrate our unlearning setup, consider the following toy example: Suppose we train a model $\widehat { w }$ with four datapoints $S = \{ [ 0 . 0 , 0 . 1 ]$ , [2.0, 2.3], [4.0, 0.5], $[ 3 . 0 , 1 . 3 ] \}$ . After training the model, the learner only keeps $\widehat { w }$ and a cheap-to-store sufficient statistic $T ( S )$ , and deletes the dataset $S$ from the memory. At this point the learner does not have access to any datapoints from $S$ anymore. Now, when a delete request comes, the request contains just the sample $U$ to be deleted e.g. [4.0, 0.5]. The unlearning algorithm at this point will unlearn this sample, using the information $\widehat { w }$ , $T ( S )$ , and $U = [ 4 . 0 , 0 . 5 ]$ bonly. Here, note that the data sample [4.0, 0.5] is provided to the unlearning algorithm by the user who owns this data and requests for its deletion.
|
| 106 |
+
|
| 107 |
+
We now define a notion of unlearning, which is motivated by the definition of differential privacy [Dwork et al., 2006a].
|
| 108 |
+
|
| 109 |
+
Definition 2 $( \varepsilon , \delta )$ -unlearning). For all $S$ of size n and delete requests $U \subseteq S$ such that $| U | \le m$ and $W \subseteq \mathcal { W }$ , a learning algorithm $A$ and an unlearning algorithm $\bar { A }$ is $( \varepsilon , \delta )$ -unlearning $i f$
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\operatorname* { P r } \bigl ( \bar { A } ( U , A ( S ) , T ( S ) ) \in W \bigr ) \leq e ^ { \varepsilon } \cdot \operatorname* { P r } \bigl ( \bar { A } ( \emptyset , A ( S \setminus U ) , T ( S \setminus U ) ) \in W \bigr ) + \delta ,
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
and
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\begin{array} { r } { \operatorname* { P r } \bigl ( \bar { A } ( \emptyset , A ( S \setminus U ) , T ( S \setminus U ) ) \in W \bigr ) \leq e ^ { \varepsilon } \cdot \operatorname* { P r } \bigl ( \bar { A } ( U , A ( S ) , T ( S ) ) \in W \bigr ) + \delta , } \end{array}
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
where $\varnothing$ denotes the empty set and $T ( S )$ denotes the data statistics available to $\bar { A }$
|
| 122 |
+
|
| 123 |
+
The above states that with high probability, an observer cannot differentiate between the two cases (i) the model is trained on the set $S$ and then a set $U$ of $m$ points are deleted by the unlearning algorithm using statistics $T ( S )$ and (ii) the model is trained on the set $S \backslash U$ and no points are deleted thereafter by the unlearning algorithm (using statistics $T ( S \setminus U ) )$ . For simplicity, throughout the paper, we assume that $\varepsilon \leq 1$ .
|
| 124 |
+
|
| 125 |
+
While being similar, the above notion of unlearning is slightly different from the one considered in Ginart et al. [2019]. Specifically, their definition compares the output of the unlearning algorithm after deleting $m$ samples, to the output of the learning algorithm that only operates on $S \bar { \backslash } U$ . Due to this, they require the learning algorithm to be randomized, even in the situation when there would be no delete requests in the future. Thus, the output of the learning algorithm will suffer a degradation in its performance guarantees due to this added noise. On the other hand, our definition does not require the learning algorithm to be randomized since we only compare the output of the unlearning algorithms in the two scenarios with and without the delete requests. Furthermore, our definition is more general than that of Ginart et al. [2019], as we can simulate their comparison in our definition by considering the unlearning algorithms for which $\bar { A }$ simply adds noise to the output of $A ( S \backslash U )$ when $U = \emptyset$ .
|
| 126 |
+
|
| 127 |
+
Our definition of unlearning leads to the following natural definition of the deletion capacity that formalizes how many samples can be deleted while still ensuring good test loss guarantees.
|
| 128 |
+
|
| 129 |
+
Definition 3 (Deletion capacity). Let $\varepsilon , \delta \geq 0$ . Let $S$ be a dataset of size n drawn i.i.d. from $\mathcal { D }$ , and let $f ( w , z )$ be a loss function. For a pair of learning and unlearning algorithms $A , { \bar { A } }$ that are $( \varepsilon , \delta )$ -unlearning, the deletion capacity $m _ { \varepsilon , \delta } ^ { A , \bar { A } } ( d , n )$ is defined as the maximum number of samples $U$ that can be unlearnt, while still ensuring an excess population risk of 0.01. Specifically,
|
| 130 |
+
|
| 131 |
+
$$
|
| 132 |
+
m _ { \varepsilon , \delta } ^ { A , \bar { A } } ( d , n ) : = \operatorname* { m a x } \Bigl \{ m \mid \mathbb { E } \Bigl [ \operatorname* { m a x } _ { U \subseteq S : | U | \leq m } F ( \bar { A } ( U , A ( S ) , T ( S ) ) ) - F ^ { * } \Bigr ] \leq 0 . 0 1 \Bigr \} ,
|
| 133 |
+
$$
|
| 134 |
+
|
| 135 |
+
where the expectation above is with respect to $S \sim \mathcal { D } ^ { n }$ and output of the algorithms $A$ and $\bar { A }$
|
| 136 |
+
|
| 137 |
+
We are primarily interested in unlearning algorithms for which $T ( S )$ is small, and in particular does not grow with the dataset size $n$ (which can potentially be very large).
|
| 138 |
+
|
| 139 |
+
# 2.3 Unlearning via retraining from scratch
|
| 140 |
+
|
| 141 |
+
The most naïve yet natural baseline for unlearning is to simply retrain the model from scratch using the remaining data. That is, we let ${ \bar { A } } ( U , A ( S ) , { \bar { T } } ( S ) ) = { \hat { A } } ( { \bar { S } } \setminus U )$ . However, the straightforward method to implement this approach would require us to set $T ( S )$ to contain the entire training dataset $S$ , and thus $| { \bar { T } } ( S ) | \geq n$ . However, recall that, we aim to provide unlearning algorithms for which $T ( S )$ is independent of $n$ . Furthermore, retraining from scratch is computationally expensive – merely reading all the data takes $\Omega ( n - m )$ time, not accounting for the cost of actually running the algorithm. These drawbacks lead one to explore more efficient methods for unlearning.
|
| 142 |
+
|
| 143 |
+
# 3 Our results
|
| 144 |
+
|
| 145 |
+
Prior works consider unlearning from an optimization perspective, focusing on minimizing the empirical risk, and do not discuss the implications of unlearning on test loss. As we show in the next section, the two could significantly different objectives even for some of the simplest learning problems.
|
| 146 |
+
|
| 147 |
+
# 3.1 Population risk vs empirical training risk
|
| 148 |
+
|
| 149 |
+
We first provide a simple example motivating our study of population risk over empirical risk, quantified rigorously in Theorem 1. Consider the following mean estimation problem. Let $d = 1$ , ${ \mathcal { Z } } = \mathbb { R }$ , and the loss function $f ( w , z ) = ( w - z ) ^ { 2 }$ . The empirical risk of $n$ points $z _ { 1 } , z _ { 2 } , \ldots , z _ { n }$ is minimized by the average $\textstyle { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } z _ { i }$ . For this problem there is a simple unlearning algorithm that minimizes empirical risk and also unlearns exactly. We store the average of the points $\textstyle w _ { 1 } = \sum _ { i = 1 } ^ { n } z _ { i } / n$ , and upon receiving a deletion request of a set $U$ of $m$ samples, subtract those samples and renormalize to compute the minimizer of the empirical loss on the remaining training samples, i.e., we output
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
w _ { 2 } = \frac { n } { n - m } \bigg ( w _ { 1 } - \frac { 1 } { n } \sum _ { z \in U } z \bigg ) .
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
The above update rule requires $T ( S )$ to be of size $O ( d )$ and completely deletes the samples $U$ satisfying the unlearning guarantee with $\varepsilon = \delta = 0$ . The returned solution $w _ { 2 }$ is the exact minimizer of the empirical loss on left over data points.
|
| 156 |
+
|
| 157 |
+
However, $w _ { 2 }$ may not perform well on fresh samples drawn from the test distribution. Consider the same setting as above, but where the points $z _ { i }$ are drawn i.i.d. from Bernoulli(1/2). Thus, the optimal parameter $w ^ { * }$ that minimizes the test loss is given by $1 / 2$ . However, consider the scenario where all of the $m$ delete requests correspond to points with value 1. In this case, the minimizer of the updated empirical loss would be smaller by an additive factor of $m / n$ than the previous estimate, and would thus have worse test loss.
|
| 158 |
+
|
| 159 |
+
In other words, in the unlearning framework, while minimizing training loss might be a good algorithm, just providing guarantees on the training loss can be vacuous if we want the model to generalize to unseen test samples. Furthermore, focusing on the test loss inherently limits the deletion capacity as noted in example discussed above. We further formalize this intuition in Theorem 1 and show that even if the unlearning algorithm has access to all undeleted samples $S \setminus U$ , there is a non-trivial limit on the deletion capacity.
|
| 160 |
+
|
| 161 |
+
Theorem 1. Let $\delta \le 0 . 0 0 5$ and $\varepsilon = 1$ . There exists a 4-Lipschitz, 1-strongly convex function $f$ and distribution $\mathcal { D }$ , such that for any learning algorithm $A$ and unlearning algorithm $\bar { A }$ , which even has access to undeleted samples $S \backslash U$ , the deletion capacity
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
m _ { \varepsilon , \delta } ^ { A , \bar { A } } ( d , n ) \leq c n ,
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
where c depends on the properties of function $f$ and is strictly less than 1.
|
| 168 |
+
|
| 169 |
+
Prior work [Shalev-Shwartz et al., 2009a, Feldman, 2016] suggests that even in the learning setting there are problems for which empirical risk minimizer solution fails to perform well on fresh samples, and regularization does not help [Kale et al., 2021]. Our situation is worse, since the delete requests $U$ can be adversarially chosen from $S$ [Lai et al., 2016, Diakonikolas et al., 2019]. In fact, the proof of Theorem 1 relies on showing the existence of an adversary that can only delete points and can change the empirical loss considerably. We defer full details to Appendix B.1.
|
| 170 |
+
|
| 171 |
+
# 3.2 Strict separation between unlearning and differential privacy
|
| 172 |
+
|
| 173 |
+
Given the strong resemblance between differential privacy and our definition for unlearning, a natural approach would be to use tools from differential privacy (DP) for machine unlearning. The simplest way is to ignore the particular set of delete requests $U$ and construct an unlearning algorithm $\vec { A }$ that only depends on the learning algorithm $A ( S )$ . More formally, such an unlearning algorithm is of the form $\bar { A } \dot { ( } U , A ( S ) , T ( S ) ) = \bar { A } ( \breve { A } ( S ) )$ and satisfies:
|
| 174 |
+
|
| 175 |
+
$$
|
| 176 |
+
\begin{array} { r l } & { \operatorname* { P r } \bigl ( \bar { A } ( A ( S ) ) \in W \bigr ) \leq e ^ { \varepsilon } \operatorname* { P r } \bigl ( \bar { A } ( A ( S \setminus U ) ) \in W \bigr ) + \delta , } \\ & { \operatorname* { P r } \bigl ( \bar { A } ( A ( S \setminus U ) ) \in W \bigr ) \leq e ^ { \varepsilon } \operatorname* { P r } \bigl ( \bar { A } ( A ( S ) ) \in W \bigr ) + \delta . } \end{array}
|
| 177 |
+
$$
|
| 178 |
+
|
| 179 |
+
Note that any such pair of algorithms would be differentially private with respect to the original dataset $S$ , where the notion of neighboring datasets is for datasets with edit distance of $m$ . The above guarantee is stronger than the distribution-free unlearning guarantee in Definition 2, and thus it suffices to satisfy it. The key observation is that any DP algorithm $A$ , which is private for datasets with edit distance $m$ , automatically unlearns any $m$ data samples. Thus, the standard performance guarantees for DP learning yields the following bound on deletion capacity:
|
| 180 |
+
|
| 181 |
+
Lemma 1 (Unlearning via DP). There exists a polynomial time learning algorithm $A$ and unlearning algorithm $\bar { A }$ of the form $\bar { A } ( U , A ( S ) , T ( S ) ) = \bar { A } ( \bar { S } )$ such that the deletion capacity
|
| 182 |
+
|
| 183 |
+
$$
|
| 184 |
+
m _ { \varepsilon , \delta } ^ { A , \bar { A } } ( d , n ) \geq \widetilde \Omega \Big ( \frac { n \varepsilon } { \sqrt { d \log ( e ^ { \varepsilon } / \delta ) } } \Big ) ,
|
| 185 |
+
$$
|
| 186 |
+
|
| 187 |
+
where the constant in the $\Omega$ -notation above depends on the properties of the loss function $f$
|
| 188 |
+
|
| 189 |
+
The above result raises an immediate question of whether this particular dependence on $d$ and $n$ is necessary on the deletion capacity, and if it can be improved further. The following lemma shows that there exist problem instances for which any unlearning algorithm that ignores the samples $U$ , can not improve over the factor of $\sqrt { d }$ in the denominator of the deletion capacity bound in (5).
|
| 190 |
+
|
| 191 |
+
Lemma 2 (Bassily et al. [2019], Section C). For any learning algorithm $A$ and an unlearning algorithm $\bar { A }$ that does not use $U$ , i.e., ${ \bar { A } } ( U , A ( S ) ) = { \bar { A } } ( A ( S ) )$ , there exists a 1-strongly convex function and $O ( 1 )$ -Lipschitz loss function $f$ , and a distribution $\mathcal { D }$ such that we can not unlearn even a single sample point, if
|
| 192 |
+
|
| 193 |
+
$$
|
| 194 |
+
n \leq c \cdot { \frac { \sqrt { d } } { \varepsilon } } ,
|
| 195 |
+
$$
|
| 196 |
+
|
| 197 |
+
where $c$ depends on the properties of the function $f$ .
|
| 198 |
+
|
| 199 |
+
Given that the $\sqrt { d }$ dependence on dimension is unavoidable for algorithms that directly use DP, it is natural to wonder whether this factor may be bypassed using other techniques. Our main contribution in this work a positive answer in this direction. As we show in the next section, when the loss function is convex, there exist unlearning algorithms which can delete up to $n / d ^ { 1 / 4 }$ sample points while still retaining the performance guarantee with respect to the test loss.
|
| 200 |
+
|
| 201 |
+
# 3.3 Unlearning for convex loss functions
|
| 202 |
+
|
| 203 |
+
In this section, we provide an unlearning algorithm $\bar { A }$ for convex losses that can delete more points than unlearning algorithms that simply use DP.
|
| 204 |
+
|
| 205 |
+
Theorem 2. There exists a learning algorithm $A$ and an unlearning algorithm $\bar { A }$ such that for any convex (and hence strongly convex), $L$ -Lipschitz, and $M$ -Hessian-Lipschitz loss $f$ and distribution $\mathcal { D }$
|
| 206 |
+
|
| 207 |
+
$$
|
| 208 |
+
m _ { \varepsilon , \delta } ^ { A , \bar { A } } ( d , n ) \geq c \cdot \frac { n \sqrt { \varepsilon } } { ( d \log ( 1 / \delta ) ) ^ { 1 / 4 } } ,
|
| 209 |
+
$$
|
| 210 |
+
|
| 211 |
+
where the constant c depends on the Lipschitz constants $L$ and $M$ . Furthermore, for the unlearning algorithm $\bar { A }$ has running time $O ( d ^ { \omega } )$ where $\omega \in [ 2 , 2 . 3 8 ]$ is the exponent of matrix multiplication, and space complexity for $T ( S ) = { \dot { O ( d ^ { 2 } ) } }$ .
|
| 212 |
+
|
| 213 |
+
Theorem 2 and Lemma 2 together show that there exist problem settings, where the deletion capacity in unlearning and DP is different by a multiplicative $\Theta ( d ^ { 1 / 4 } )$ . In particular, when learning with convex loss functions, we can delete $O ( n / d ^ { 1 / 4 } )$ samples while still retaining good performance on the unseen test loss, whereas DP only guarantees deletion of $\Theta ( n / d ^ { 1 / 2 } )$ samples. Hence, our algorithm is at least quadratically better in terms of dependence on $d$ in deletion capacity that standard DP algorithms. Besides improving the dependence on $d$ , our algorithm also enjoys better dependence on $\varepsilon$ and $\log ( 1 / \delta )$ in the deletion capacity, by at least a quadratic factor.
|
| 214 |
+
|
| 215 |
+
Our learning algorithm stores additional statistics of the dataset $S$ in order to delete the set $U$ in the unlearning algorithm. The extra memory we need for these statistics is independent of $n$ . Furthermore, our algorithm uses the samples in $U$ during the unlearning phase. This paradox of storing and using information in order to delete it, motivates the name of the paper: Remember what you want to forget.
|
| 216 |
+
|
| 217 |
+
Characterizing the entire set of problems for which unlearning and differential privacy are different remains an interesting open question. Theorem 2 yields an improved upper bound, but it is not clear if this dependence on $d$ or $n$ in the deletion capacity is tight or if it can be improved even further. Resolving this question would be a fascinating future research direction.
|
| 218 |
+
|
| 219 |
+
# 4 Unlearning algorithms
|
| 220 |
+
|
| 221 |
+
In the following, we provide learning and unlearning algorithms when the loss function $f ( \cdot , z )$ is $\lambda$ -strongly convex. The unlearning algorithms for convex losses follows by appealing to the strongly convex case after adding regularization. We defer the algorithms and proofs for the convex case to Appendix D. Throughout this section, we make the following assumption:
|
| 222 |
+
|
| 223 |
+
Assumption 1. For any $z \in { \mathcal { Z } }$ , the function $f ( w , z )$ is $\lambda$ -strongly convex, $L$ -Lipschitz and $M$ - Hessian Lipschitz with respect to $w$ .
|
| 224 |
+
|
| 225 |
+
Learning algorithm. We denote our learning algorithm by $A _ { s c }$ . When given a dataset $S$ of $n$ points sampled i.i.d. from some distribution $\mathcal { D }$ , the algorithm $A _ { s c }$ computes the point $\widehat { w }$ by minimizing the empirical loss $\widehat { F } _ { n } ( w )$ , i.e.
|
| 226 |
+
|
| 227 |
+
$$
|
| 228 |
+
\widehat { w } \gets \mathrm { a r g m i n } \widehat { F } _ { n } ( w ) : = \frac { 1 } { n } \sum _ { z \in S } f ( w , z ) .
|
| 229 |
+
$$
|
| 230 |
+
|
| 231 |
+
$A _ { s c }$ then returns the point $\widehat { w }$ and the statistics $T ( S ) : = \{ \nabla ^ { 2 } \widehat { F } ( \widehat { w } ) \}$ containing the Hessian of $\widehat F ( w )$ bevaluated at the output point $\widehat { w }$ . We provide the pseudocode for $A _ { s c }$ in the appendix.
|
| 232 |
+
|
| 233 |
+
Unlearning algorithm. We denote our unlearning algorithm by $\bar { A } _ { s c }$ and provide the pseudocode in Algorithm 1. $\check { \bar { A } } _ { s c }$ receives as input the set of delete requests $U$ , the point $\widehat { w }$ and the data statistics $T ( S )$ . Using these inputs, $\bar { A } _ { s c }$ first estimates the matrix $\widehat { H }$ that denotes the Hessian of the empirical function on the dataset $S \setminus U$ when evaluated at the point $\widehat { w }$ . Then, $\bar { A } _ { s c }$ computes the point $\bar { w }$ by removing the contribution of the deleted points $U$ from $\widehat { w }$ busing the update in (8). Finally, $\bar { A } _ { s c } ^ { \star }$ perturbs $\bar { w }$ with noise $\nu$ drawn from $\mathcal { N } ( 0 , \bar { \sigma } ^ { 2 } \mathbb { I } _ { d } )$ and returns the perturbed point $\widetilde { w }$ .
|
| 234 |
+
|
| 235 |
+
# Algorithm 1 Unlearning algorithm $( \bar { A } _ { s c } )$
|
| 236 |
+
|
| 237 |
+
Input: Delete requests: $U = \{ z _ { j } \} _ { j = 1 } ^ { m } \subseteq S$ , output of $A _ { s c } ( S )$ : $\widehat { w }$ , additional statistic $T ( S )$ : $\{ \nabla ^ { 2 } \widehat { F } ( \widehat { w } ) \}$ , loss function: $f ( w , z )$ .
|
| 238 |
+
1: Set $\begin{array} { r } { \gamma = \frac { 2 M m ^ { 2 } L ^ { 2 } } { \lambda ^ { 3 } n ^ { 2 } } } \end{array}$ 2Mm2L2 3n2 , = " p2 ln(1.25/ |